Module: FFaker::PhoneNumberRU

Extended by:
ModuleUtils, PhoneNumberRU
Included in:
PhoneNumberRU
Defined in:
lib/ffaker/phone_number_ru.rb

Constant Summary collapse

INTERNATIONAL_COUNTRY_PREFIX =
'+7'
COUNTRY_PREFIX =
'8'
TOLL_FREE_PREFIX =
'800'

Instance Method Summary collapse

Methods included from ModuleUtils

const_missing, k, underscore, unique

Methods included from RandomUtils

#fetch_sample, #rand, #shuffle

Instance Method Details

#country_codeObject

Internal country code

8

92
93
94
# File 'lib/ffaker/phone_number_ru.rb', line 92

def country_code
  COUNTRY_PREFIX
end

#home_work_phone_numberObject

Generate home or work phone number with internal country code

8 011 232 22 22
8 836 331 23 12

70
71
72
# File 'lib/ffaker/phone_number_ru.rb', line 70

def home_work_phone_number
  build_phone_number(country_code, home_work_phone_prefix)
end

#home_work_phone_prefixObject

Home or work phone prefix

081
301

100
101
102
# File 'lib/ffaker/phone_number_ru.rb', line 100

def home_work_phone_prefix
  fetch_sample(HOME_PHONE_PREFIXES)
end

#international_country_codeObject

International country code

+7

85
86
87
# File 'lib/ffaker/phone_number_ru.rb', line 85

def international_country_code
  INTERNATIONAL_COUNTRY_PREFIX
end

#international_home_work_phone_numberObject

Generate home or work phone number with international country code

+7 842 933 24 99
+7 851 921 35 92

35
36
37
# File 'lib/ffaker/phone_number_ru.rb', line 35

def international_home_work_phone_number
  build_phone_number(international_country_code, home_work_phone_prefix)
end

#international_mobile_phone_numberObject

Generate mobile phone number with international country code

+7 929 933 24 99
+7 978 921 35 92

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

def international_mobile_phone_number
  build_phone_number(international_country_code, mobile_phone_prefix)
end

#international_phone_numberObject

Generate general phone number with international country code

+7 929 933 24 99
+7 851 921 35 92

16
17
18
19
20
21
# File 'lib/ffaker/phone_number_ru.rb', line 16

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

#international_toll_free_numberObject

Generate toll free phone number with international country code

+7 800 413 01 33
+7 800 153 55 22

43
44
45
# File 'lib/ffaker/phone_number_ru.rb', line 43

def international_toll_free_number
  build_phone_number(international_country_code, TOLL_FREE_PREFIX)
end

#mobile_phone_numberObject

Generate mobile phone number with internal country code

8 949 232 22 22
8 999 331 23 12

62
63
64
# File 'lib/ffaker/phone_number_ru.rb', line 62

def mobile_phone_number
  build_phone_number(country_code, mobile_phone_prefix)
end

#mobile_phone_prefixObject

Mobile phone prefix

929
978

108
109
110
# File 'lib/ffaker/phone_number_ru.rb', line 108

def mobile_phone_prefix
  fetch_sample(MOBILE_PHONE_PREFIXES)
end

#phone_numberObject

Generate general phone number with internal country code

8 999 044 31 33
8 843 944 33 33

51
52
53
54
55
56
# File 'lib/ffaker/phone_number_ru.rb', line 51

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

#toll_free_numberObject

Generate toll free phone number with internal country code

8 800 413 01 33
8 800 153 55 22

78
79
80
# File 'lib/ffaker/phone_number_ru.rb', line 78

def toll_free_number
  build_phone_number(country_code, TOLL_FREE_PREFIX)
end