class Faker::PhoneNumber
def area_code
def area_code fetch('phone_number.area_code') rescue I18n::MissingTranslationData nil end
def cell_phone
def cell_phone parse('cell_phone.formats') end
def cell_phone_with_country_code
def cell_phone_with_country_code "#{country_code} #{cell_phone}" end
def country_code
def country_code "+#{fetch('country_code')}" end
def exchange_code
def exchange_code fetch('phone_number.exchange_code') rescue I18n::MissingTranslationData nil end
def phone_number
def phone_number parse('phone_number.formats') end
def phone_number_with_country_code
def phone_number_with_country_code "#{country_code} #{phone_number}" end
def subscriber_number(legacy_length = NOT_GIVEN, length: 4)
Can be used for both extensions and last four digits of phone number.
US and Canada only
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