Skip to content

yotepresto-com/curp-generator

Repository files navigation

CURP Generator

Ruby Gem to generate mexican CURPs.

Install

Just add the gem to your project:

gem install curp_generator

# Or using bundler
bundle add curp_generator

Usage

The main class is CurpGenerator::Curp. It accepts the following parameters:

Parameter Type Description
first_name String The first name of the person.
second_name String The middle name of the person.
first_last_name String The father's last name of the person.
second_last_name String The mother's last name of the person.
gender String The gender of the person. Possible values: male, female, hombre, mujer, femenino, masculino, h (male), m (female) (case insensitive).
birth_date DateTime The date when the person was born.
birth_state String The mexican state where the person was born. Possible values are listed in the Catalogs module.

Then, just call the .generate method and it will return the CURP for that person.

Example:

require 'curp_generator'

curp = CurpGenerator::Curp.new(
  first_name: 'Maria',
  second_name: 'Alejandra',
  first_last_name: 'De la Rosa',
  second_last_name: 'Ruiz',
  gender: 'female',
  birth_date: DateTime.parse('1989-10-14 06:00:00'),
  birth_state: 'JALISCO'
)

curp.generate # Returns: RORA891014MJCSZL03

License

MIT