Module: FFaker::IdentificationESCO

Extended by:
IdentificationESCO, ModuleUtils
Includes:
IdentificationES
Included in:
IdentificationESCO
Defined in:
lib/ffaker/identification_es_co.rb

Constant Summary collapse

BLOOD_TYPE =
%w[A B O AB].freeze
LICENSE_CATEGORY =
%w[A B C].freeze

Constants included from IdentificationES

FFaker::IdentificationES::GENDERS

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Methods included from IdentificationES

#gender

Instance Method Details

#blood_typeObject



29
30
31
32
# File 'lib/ffaker/identification_es_co.rb', line 29

def blood_type
  sign = fetch_sample(%w[+ -])
  "#{fetch_sample(BLOOD_TYPE)}#{sign}"
end

#driver_license_categoryObject



22
23
24
25
26
27
# File 'lib/ffaker/identification_es_co.rb', line 22

def driver_license_category
  category = fetch_sample(LICENSE_CATEGORY)
  # the categories are A1 A2 B1 B2 B3 C1 C2 C3
  num = category == 'A' ? rand(1..2) : rand(1..3)
  "#{category}#{num}"
end

#drivers_licenseObject Also known as: id



15
16
17
18
# File 'lib/ffaker/identification_es_co.rb', line 15

def drivers_license
  how_many_numbers = rand(6..13)
  FFaker.numerify('#' * how_many_numbers)
end

#expedition_dateObject



34
35
36
37
# File 'lib/ffaker/identification_es_co.rb', line 34

def expedition_date
  today = ::Date.today
  today - rand(today.year)
end