class Faker::PhoneNumber

def area_code

Returns:
  • (String) -
def area_code
  fetch('phone_number.area_code')
rescue I18n::MissingTranslationData
  nil
end

def cell_phone

Returns:
  • (String) -
def cell_phone
  parse('cell_phone.formats')
end

def cell_phone_in_e164

Returns:
  • (String) -
def cell_phone_in_e164
  cell_phone_with_country_code.delete('^+0-9')
end

def cell_phone_with_country_code

Returns:
  • (String) -
def cell_phone_with_country_code
  "#{country_code} #{cell_phone}"
end

def country_code

Returns:
  • (String) -
def country_code
  "+#{fetch('country_code')}"
end

def exchange_code

Returns:
  • (String) -
def exchange_code
  fetch('phone_number.exchange_code')
rescue I18n::MissingTranslationData
  nil
end

def phone_number

Returns:
  • (String) -
def phone_number
  parse('phone_number.formats')
end

def phone_number_with_country_code

Returns:
  • (String) -
def phone_number_with_country_code
  "#{country_code} #{phone_number}"
end

def subscriber_number(legacy_length = NOT_GIVEN, length: 4)

Returns:
  • (String) -

Parameters:
  • length (Integer) -- Speficies the length of the return value.
def subscriber_number(legacy_length = NOT_GIVEN, length: 4)
  warn_for_deprecated_arguments do |keywords|
    keywords << :length if legacy_length != NOT_GIVEN
  end
  rand.to_s[2..(1 + length)]
end