module FFaker::PhoneNumberCU
def country_code
Country Code is E.164 Country Code
def country_code e164_country_code end
def e164_country_code
Based on information from http://en.wikipedia.org/wiki/E.164
E.164 formats
def e164_country_code '53' end
def e164_home_work_phone_number
def e164_home_work_phone_number phone_prefix = home_work_phone_prefix case phone_prefix.size when 2 then FFaker.numerify("#{e164_country_code}#{phone_prefix[1]}#######") when 3 then FFaker.numerify("#{e164_country_code}#{phone_prefix[1, 2]}######") end end
def e164_mobile_phone_number
def e164_mobile_phone_number FFaker.numerify("#{country_code}#{mobile_phone_prefix[1]}#######") end
def e164_phone_number
def e164_phone_number rand(0..1).zero? ? e164_mobile_phone_number : e164_home_work_phone_number end
def general_phone_number
Generates general number
def general_phone_number rand(0..1).zero? ? home_work_phone_number : mobile_phone_number end
def home_work_phone_number
(0x) xxx xxxx or (0xx) xx xxxx
Generates a general phone number
def home_work_phone_number phone_prefix = home_work_phone_prefix case phone_prefix.size when 2 then FFaker.numerify("(#{phone_prefix}) ### ####") when 3 then FFaker.numerify("(#{phone_prefix}) ## ####") end end
def home_work_phone_prefix
- See: FFaker::PhoneNumberCU::HOME_WORK_OPERATORS_PREFIX -
def home_work_phone_prefix fetch_sample(HOME_WORK_OPERATORS_PREFIX) end
def international_country_code
International formats
def international_country_code rand(0..1).zero? ? "00#{country_code}" : "+#{country_code}" end
def international_home_work_phone_number
def international_home_work_phone_number phone_prefix = home_work_phone_prefix case phone_prefix.size when 2 then FFaker.numerify("#{international_country_code}#{phone_prefix[1]} ### ####") when 3 then FFaker.numerify("#{international_country_code}#{phone_prefix[1, 2]} ## ####") end end
def international_mobile_phone_number
def international_mobile_phone_number FFaker.numerify("#{international_country_code}#{mobile_phone_prefix[1]} ### ####") end
def international_phone_number
def international_phone_number rand(0..1).zero? ? international_mobile_phone_number : international_home_work_phone_number end
def mobile_phone_number
05 xxx xxxx
Generates a mobile phone number
def mobile_phone_number FFaker.numerify("#{mobile_phone_prefix} ### ####") end
def mobile_phone_prefix
- See: FFaker::PhoneNumberCU::MOBILE_OPERATORS_PREFIX -
def mobile_phone_prefix fetch_sample(MOBILE_OPERATORS_PREFIX) end
def phone_number
Generates phone number
def phone_number case rand(0..2) when 0 then general_phone_number when 1 then international_phone_number when 2 then e164_phone_number end end
def phone_prefix
def phone_prefix fetch_sample(OPERATORS_PREFIX) end