Module: FFaker::PhoneNumberPL

Extended by:
ModuleUtils
Defined in:
lib/ffaker/phone_number_pl.rb

Overview

Constant Summary collapse

PHONE_NUMBER_FORMAT =
'%s#######'
COUNTRY_CODE =
'+48'
MOBILE_PREFIXES =
%w[50 51 53 57 60 66 69 72 73 78 79 88].freeze
AREA_CODES =
%w[12 13 14 15 16 17 18 22 23 24 25 29 32 33
34 41 42 43 44 46 48 52 54 55 56 58 59 61
62 63 65 67 68 71 74 75 76 77 81 82 83 84
85 86 87 89 91 94 95].freeze

Class Method Summary collapse

Methods included from ModuleUtils

const_missing, k, luhn_check, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Class Method Details

.area_codeObject



50
51
52
# File 'lib/ffaker/phone_number_pl.rb', line 50

def area_code
  fetch_sample(AREA_CODES)
end

.home_work_phone_numberObject



27
28
29
# File 'lib/ffaker/phone_number_pl.rb', line 27

def home_work_phone_number
  FFaker.numerify(phone_number_format)
end

.international_home_work_phone_numberObject



46
47
48
# File 'lib/ffaker/phone_number_pl.rb', line 46

def international_home_work_phone_number
  FFaker.numerify("#{COUNTRY_CODE} #{phone_number_format}")
end

.international_mobile_phone_numberObject



42
43
44
# File 'lib/ffaker/phone_number_pl.rb', line 42

def international_mobile_phone_number
  FFaker.numerify("#{COUNTRY_CODE} #{mobile_phone_number_format}")
end

.international_phone_numberObject



35
36
37
38
39
40
# File 'lib/ffaker/phone_number_pl.rb', line 35

def international_phone_number
  case rand(0..1)
  when 0 then international_mobile_phone_number
  when 1 then international_home_work_phone_number
  end
end

.mobile_phone_numberObject



31
32
33
# File 'lib/ffaker/phone_number_pl.rb', line 31

def mobile_phone_number
  FFaker.numerify(mobile_phone_number_format)
end

.mobile_phone_number_formatObject



63
64
65
66
# File 'lib/ffaker/phone_number_pl.rb', line 63

def mobile_phone_number_format
  prefix = mobile_prefix
  PHONE_NUMBER_FORMAT % prefix
end

.mobile_prefixObject



54
55
56
# File 'lib/ffaker/phone_number_pl.rb', line 54

def mobile_prefix
  fetch_sample(MOBILE_PREFIXES)
end

.phone_numberObject



20
21
22
23
24
25
# File 'lib/ffaker/phone_number_pl.rb', line 20

def phone_number
  case rand(0..1)
  when 0 then home_work_phone_number
  when 1 then mobile_phone_number
  end
end

.phone_number_formatObject



58
59
60
61
# File 'lib/ffaker/phone_number_pl.rb', line 58

def phone_number_format
  prefix = area_code
  PHONE_NUMBER_FORMAT % prefix
end