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
  case rand(2)
  when 0 then e164_mobile_phone_number
  when 1 then e164_home_work_phone_number
  end
end

def general_phone_number


Generates general number
def general_phone_number
  case rand(2)
  when 0 then home_work_phone_number
  when 1 then mobile_phone_number
  end
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

Other tags:
    See: FFaker::PhoneNumberCU::HomeWorkOperatorsPrefix -
def home_work_phone_prefix
  HomeWorkOperatorsPrefix[rand(HomeWorkOperatorsPrefix.size)]
end

def international_country_code


International formats
def international_country_code
  case rand(2)
  when 0 then "00#{country_code}"
  when 1 then "+#{country_code}"
  end
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
  case rand(2)
  when 0 then international_mobile_phone_number
  when 1 then international_home_work_phone_number
  end
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

Other tags:
    See: FFaker::PhoneNumberCU::MobileOperatorsPrefix -
def mobile_phone_prefix
  MobileOperatorsPrefix[rand(MobileOperatorsPrefix.size)]
end

def phone_number


Generates phone number
def phone_number
  case rand(3)
  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
  OperatorsPrefix[rand(OperatorsPrefix.size)]
end