faker 2.10.0 → 2.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +265 -0
- data/README.md +14 -2
- data/lib/faker.rb +20 -10
- data/lib/faker/default/address.rb +31 -1
- data/lib/faker/default/bank.rb +79 -0
- data/lib/faker/default/blood.rb +48 -0
- data/lib/faker/default/business.rb +1 -1
- data/lib/faker/default/cannabis.rb +80 -0
- data/lib/faker/default/chile_rut.rb +44 -1
- data/lib/faker/default/commerce.rb +73 -10
- data/lib/faker/default/company.rb +276 -7
- data/lib/faker/default/compass.rb +135 -0
- data/lib/faker/default/computer.rb +63 -0
- data/lib/faker/default/construction.rb +54 -0
- data/lib/faker/default/cosmere.rb +90 -0
- data/lib/faker/default/crypto_coin.rb +45 -0
- data/lib/faker/default/date.rb +16 -12
- data/lib/faker/default/dc_comics.rb +45 -0
- data/lib/faker/default/driving_licence.rb +42 -0
- data/lib/faker/default/file.rb +51 -2
- data/lib/faker/default/finance.rb +24 -0
- data/lib/faker/default/funny_name.rb +45 -0
- data/lib/faker/default/gender.rb +1 -1
- data/lib/faker/default/hipster.rb +94 -0
- data/lib/faker/default/id_number.rb +86 -0
- data/lib/faker/default/internet.rb +64 -7
- data/lib/faker/default/internet_http.rb +48 -0
- data/lib/faker/default/invoice.rb +32 -5
- data/lib/faker/default/json.rb +55 -0
- data/lib/faker/default/lorem.rb +1 -1
- data/lib/faker/default/lorem_flickr.rb +65 -0
- data/lib/faker/default/lorem_pixel.rb +22 -0
- data/lib/faker/default/markdown.rb +89 -0
- data/lib/faker/default/measurement.rb +90 -0
- data/lib/faker/default/name.rb +98 -0
- data/lib/faker/default/nhs.rb +19 -0
- data/lib/faker/default/number.rb +5 -7
- data/lib/faker/default/omniauth.rb +105 -52
- data/lib/faker/default/phone_number.rb +88 -5
- data/lib/faker/default/placeholdit.rb +21 -0
- data/lib/faker/default/slack_emoji.rb +81 -0
- data/lib/faker/default/south_africa.rb +90 -0
- data/lib/faker/default/string.rb +19 -3
- data/lib/faker/default/stripe.rb +61 -0
- data/lib/faker/default/twitter.rb +35 -0
- data/lib/faker/default/types.rb +80 -0
- data/lib/faker/default/university.rb +45 -0
- data/lib/faker/default/vehicle.rb +184 -4
- data/lib/faker/default/verb.rb +45 -0
- data/lib/faker/default/world_cup.rb +4 -4
- data/lib/faker/games/control.rb +113 -0
- data/lib/faker/games/dnd.rb +61 -0
- data/lib/faker/games/heroes_of_the_storm.rb +16 -5
- data/lib/faker/games/minecraft.rb +48 -0
- data/lib/faker/games/warhammer_fantasy.rb +74 -0
- data/lib/faker/movies/departed.rb +49 -0
- data/lib/faker/movies/movie.rb +13 -0
- data/lib/faker/music/pearl_jam.rb +50 -0
- data/lib/faker/music/phish.rb +27 -1
- data/lib/faker/music/prince.rb +64 -0
- data/lib/faker/music/rush.rb +37 -0
- data/lib/faker/music/show.rb +49 -0
- data/lib/faker/quotes/chiquito.rb +80 -0
- data/lib/faker/quotes/quote.rb +54 -1
- data/lib/faker/quotes/rajnikanth.rb +26 -0
- data/lib/faker/quotes/shakespeare.rb +36 -0
- data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +13 -0
- data/lib/faker/tv_shows/big_bang_theory.rb +37 -0
- data/lib/faker/tv_shows/dr_who.rb +1 -1
- data/lib/faker/tv_shows/futurama.rb +65 -0
- data/lib/faker/tv_shows/simpsons.rb +14 -0
- data/lib/faker/tv_shows/suits.rb +37 -0
- data/lib/faker/version.rb +1 -1
- data/lib/helpers/base58.rb +1 -1
- data/lib/helpers/char.rb +22 -27
- data/lib/helpers/unique_generator.rb +4 -0
- data/lib/locales/bg.yml +2 -2
- data/lib/locales/ca.yml +0 -8
- data/lib/locales/da-DK.yml +3 -3
- data/lib/locales/de-CH.yml +1693 -0
- data/lib/locales/en-AU.yml +44 -10
- data/lib/locales/en-CA.yml +2 -0
- data/lib/locales/en-GB.yml +1 -1
- data/lib/locales/en-NEP.yml +1 -1
- data/lib/locales/en-NZ.yml +2 -0
- data/lib/locales/en-US.yml +29 -3
- data/lib/locales/en-ZA.yml +1 -1
- data/lib/locales/en/address.yml +2 -0
- data/lib/locales/en/aqua_teen_hunger_force.yml +33 -1
- data/lib/locales/en/bank.yml +1 -1
- data/lib/locales/en/big_bang_theory.yml +38 -0
- data/lib/locales/en/blood.yml +13 -0
- data/lib/locales/en/chiquito.yml +64 -0
- data/lib/locales/en/color.yml +1 -1
- data/lib/locales/en/computer.yml +36 -0
- data/lib/locales/en/control.yml +247 -0
- data/lib/locales/en/departed.yml +50 -0
- data/lib/locales/en/dnd.yml +54 -0
- data/lib/locales/en/futurama.yml +344 -0
- data/lib/locales/en/heroes_of_the_storm.yml +2 -2
- data/lib/locales/en/house.yml +1 -1
- data/lib/locales/en/minecraft.yml +390 -0
- data/lib/locales/en/movie.yml +192 -1
- data/lib/locales/en/name.yml +4 -3
- data/lib/locales/en/one_piece.yml +2 -2
- data/lib/locales/en/pearl_jam.yml +213 -0
- data/lib/locales/en/phish.yml +392 -1
- data/lib/locales/en/prince.yml +227 -0
- data/lib/locales/en/rajnikanth.yml +77 -0
- data/lib/locales/en/rush.yml +32 -0
- data/lib/locales/en/shakespeare.yml +3 -3
- data/lib/locales/en/show.yml +597 -0
- data/lib/locales/en/simpsons.yml +668 -0
- data/lib/locales/en/star_wars.yml +568 -220
- data/lib/locales/en/stripe.yml +3 -3
- data/lib/locales/en/suits.yml +45 -0
- data/lib/locales/en/warhammer_fantasy.yml +582 -0
- data/lib/locales/es-MX.yml +3 -0
- data/lib/locales/fr-CA.yml +7 -4
- data/lib/locales/fr-CH.yml +1 -1
- data/lib/locales/fr.yml +5 -4
- data/lib/locales/hy.yml +1 -6
- data/lib/locales/id.yml +2 -1
- data/lib/locales/ja.yml +1 -1
- data/lib/locales/ko.yml +82 -0
- data/lib/locales/pt-BR.yml +1 -0
- data/lib/locales/pt.yml +2 -2
- data/lib/locales/uk.yml +5 -5
- data/lib/locales/zh-CN.yml +1 -1
- data/lib/locales/zh-TW.yml +1 -1
- metadata +52 -19
|
@@ -5,65 +5,178 @@ module Faker
|
|
|
5
5
|
flexible :company
|
|
6
6
|
|
|
7
7
|
class << self
|
|
8
|
+
##
|
|
9
|
+
# Produces a company name.
|
|
10
|
+
#
|
|
11
|
+
# @return [String]
|
|
12
|
+
#
|
|
13
|
+
# @example
|
|
14
|
+
# Faker::Company.name #=> "Roberts Inc"
|
|
15
|
+
#
|
|
16
|
+
# @faker.version 1.6.0
|
|
8
17
|
def name
|
|
9
18
|
parse('company.name')
|
|
10
19
|
end
|
|
11
20
|
|
|
21
|
+
##
|
|
22
|
+
# Produces a company suffix.
|
|
23
|
+
#
|
|
24
|
+
# @return [String]
|
|
25
|
+
#
|
|
26
|
+
# @example
|
|
27
|
+
# Faker::Company.suffix #=> "LLC"
|
|
28
|
+
#
|
|
29
|
+
# @faker.version 1.6.0
|
|
12
30
|
def suffix
|
|
13
31
|
fetch('company.suffix')
|
|
14
32
|
end
|
|
15
33
|
|
|
34
|
+
##
|
|
35
|
+
# Produces a company industry.
|
|
36
|
+
#
|
|
37
|
+
# @return [String]
|
|
38
|
+
#
|
|
39
|
+
# @example
|
|
40
|
+
# Faker::Company.industry #=> "Food & Beverages"
|
|
41
|
+
#
|
|
42
|
+
# @faker.version 1.6.0
|
|
16
43
|
def industry
|
|
17
44
|
fetch('company.industry')
|
|
18
45
|
end
|
|
19
46
|
|
|
20
|
-
|
|
47
|
+
##
|
|
48
|
+
# Produces a company catch phrase.
|
|
49
|
+
#
|
|
50
|
+
# @return [String]
|
|
51
|
+
#
|
|
52
|
+
# @example
|
|
53
|
+
# Faker::Company.catch_phrase #=> "Grass-roots grid-enabled portal"
|
|
54
|
+
#
|
|
55
|
+
# @faker.version 1.6.0
|
|
21
56
|
def catch_phrase
|
|
22
57
|
translate('faker.company.buzzwords').collect { |list| sample(list) }.join(' ')
|
|
23
58
|
end
|
|
24
59
|
|
|
60
|
+
##
|
|
61
|
+
# Produces a company buzzword.
|
|
62
|
+
#
|
|
63
|
+
# @return [String]
|
|
64
|
+
#
|
|
65
|
+
# @example
|
|
66
|
+
# Faker::Company.buzzword #=> "flexibility"
|
|
67
|
+
#
|
|
68
|
+
# @faker.version 1.8.7
|
|
25
69
|
def buzzword
|
|
26
70
|
sample(translate('faker.company.buzzwords').flatten)
|
|
27
71
|
end
|
|
28
72
|
|
|
73
|
+
##
|
|
74
|
+
# Produces some company BS.
|
|
75
|
+
#
|
|
76
|
+
# @return [String]
|
|
77
|
+
#
|
|
78
|
+
# @example
|
|
79
|
+
# Faker::Company.bs #=> "empower customized functionalities"
|
|
80
|
+
#
|
|
81
|
+
# @faker.version 1.6.0
|
|
29
82
|
# When a straight answer won't do, BS to the rescue!
|
|
30
83
|
def bs
|
|
31
84
|
translate('faker.company.bs').collect { |list| sample(list) }.join(' ')
|
|
32
85
|
end
|
|
33
86
|
|
|
87
|
+
##
|
|
88
|
+
# Produces a company EIN (Employer Identification Number).
|
|
89
|
+
#
|
|
90
|
+
# @return [String]
|
|
91
|
+
#
|
|
92
|
+
# @example
|
|
93
|
+
# Faker::Company.ein #=> "07-4009024"
|
|
94
|
+
#
|
|
95
|
+
# @faker.version 1.6.0
|
|
34
96
|
def ein
|
|
35
97
|
format('%09d', rand(10**9)).gsub(/(\d{2})(\d{7})/, '\\1-\\2')
|
|
36
98
|
end
|
|
37
99
|
|
|
100
|
+
##
|
|
101
|
+
# Produces a company duns number.
|
|
102
|
+
#
|
|
103
|
+
# @return [String]
|
|
104
|
+
#
|
|
105
|
+
# @example
|
|
106
|
+
# Faker::Company.duns_number #=> "70-655-5105"
|
|
107
|
+
#
|
|
108
|
+
# @faker.version 1.6.0
|
|
38
109
|
def duns_number
|
|
39
110
|
format('%09d', rand(10**9)).gsub(/(\d{2})(\d{3})(\d{4})/, '\\1-\\2-\\3')
|
|
40
111
|
end
|
|
41
112
|
|
|
113
|
+
##
|
|
114
|
+
# Produces a company logo.
|
|
115
|
+
#
|
|
116
|
+
# @return [String]
|
|
117
|
+
#
|
|
118
|
+
# @example
|
|
119
|
+
# Faker::Company.logo #=> "https://pigment.github.io/fake-logos/logos/medium/color/12.png"
|
|
120
|
+
#
|
|
121
|
+
# @faker.version 1.8.7
|
|
42
122
|
# Get a random company logo url in PNG format.
|
|
43
123
|
def logo
|
|
44
124
|
rand_num = rand(1..13)
|
|
45
125
|
"https://pigment.github.io/fake-logos/logos/medium/color/#{rand_num}.png"
|
|
46
126
|
end
|
|
47
127
|
|
|
128
|
+
##
|
|
129
|
+
# Produces a company type.
|
|
130
|
+
#
|
|
131
|
+
# @return [String]
|
|
132
|
+
#
|
|
133
|
+
# @example
|
|
134
|
+
# Faker::Company.type #=> "Partnership"
|
|
135
|
+
#
|
|
136
|
+
# @faker.version 1.8.7
|
|
48
137
|
def type
|
|
49
138
|
fetch('company.type')
|
|
50
139
|
end
|
|
51
140
|
|
|
141
|
+
##
|
|
142
|
+
# Produces a company profession.
|
|
143
|
+
#
|
|
144
|
+
# @return [String]
|
|
145
|
+
#
|
|
146
|
+
# @example
|
|
147
|
+
# Faker::Company.profession #=> "factory worker"
|
|
148
|
+
#
|
|
149
|
+
# @faker.version 1.6.0
|
|
52
150
|
def profession
|
|
53
151
|
fetch('company.profession')
|
|
54
152
|
end
|
|
55
153
|
|
|
56
|
-
|
|
57
|
-
#
|
|
58
|
-
#
|
|
154
|
+
##
|
|
155
|
+
# Produces a company spanish organisation number.
|
|
156
|
+
#
|
|
157
|
+
# @return [String]
|
|
158
|
+
#
|
|
159
|
+
# @example
|
|
160
|
+
# Faker::Company.spanish_organisation_number #=> "D6819358"
|
|
161
|
+
#
|
|
162
|
+
# @faker.version 1.8.5
|
|
163
|
+
#
|
|
164
|
+
# Get a random Spanish organization number. See more here https://es.wikipedia.org/wiki/N%C3%BAmero_de_identificaci%C3%B3n_fiscal
|
|
59
165
|
def spanish_organisation_number
|
|
60
166
|
# Valid leading character: A, B, C, D, E, F, G, H, J, N, P, Q, R, S, U, V, W
|
|
61
167
|
# 7 digit numbers
|
|
62
|
-
|
|
63
|
-
base = [sample(letters), format('%07d', rand(10**7))].join
|
|
64
|
-
base
|
|
168
|
+
[sample(self::ULetters), format('%07d', rand(10**7))].join
|
|
65
169
|
end
|
|
66
170
|
|
|
171
|
+
##
|
|
172
|
+
# Produces a company swedish organisation number.
|
|
173
|
+
#
|
|
174
|
+
# @return [String]
|
|
175
|
+
#
|
|
176
|
+
# @example
|
|
177
|
+
# Faker::Company.swedish_organisation_number #=> "3866029808"
|
|
178
|
+
#
|
|
179
|
+
# @faker.version 1.7.0
|
|
67
180
|
# Get a random Swedish organization number. See more here https://sv.wikipedia.org/wiki/Organisationsnummer
|
|
68
181
|
def swedish_organisation_number
|
|
69
182
|
# Valid leading digit: 1, 2, 3, 5, 6, 7, 8, 9
|
|
@@ -73,6 +186,15 @@ module Faker
|
|
|
73
186
|
base + luhn_algorithm(base).to_s
|
|
74
187
|
end
|
|
75
188
|
|
|
189
|
+
##
|
|
190
|
+
# Produces a company czech organisation number.
|
|
191
|
+
#
|
|
192
|
+
# @return [String]
|
|
193
|
+
#
|
|
194
|
+
# @example
|
|
195
|
+
# Faker::Company.czech_organisation_number #=> "90642741"
|
|
196
|
+
#
|
|
197
|
+
# @faker.version 1.9.1
|
|
76
198
|
def czech_organisation_number
|
|
77
199
|
sum = 0
|
|
78
200
|
base = []
|
|
@@ -84,18 +206,45 @@ module Faker
|
|
|
84
206
|
base.join
|
|
85
207
|
end
|
|
86
208
|
|
|
209
|
+
##
|
|
210
|
+
# Produces a company french siren number.
|
|
211
|
+
#
|
|
212
|
+
# @return [String]
|
|
213
|
+
#
|
|
214
|
+
# @example
|
|
215
|
+
# Faker::Company.french_siren_number #=> "163417827"
|
|
216
|
+
#
|
|
217
|
+
# @faker.version 1.8.5
|
|
87
218
|
# Get a random French SIREN number. See more here https://fr.wikipedia.org/wiki/Syst%C3%A8me_d%27identification_du_r%C3%A9pertoire_des_entreprises
|
|
88
219
|
def french_siren_number
|
|
89
220
|
base = (1..8).map { rand(10) }.join
|
|
90
221
|
base + luhn_algorithm(base).to_s
|
|
91
222
|
end
|
|
92
223
|
|
|
224
|
+
##
|
|
225
|
+
# Produces a company french siret number.
|
|
226
|
+
#
|
|
227
|
+
# @return [String]
|
|
228
|
+
#
|
|
229
|
+
# @example
|
|
230
|
+
# Faker::Company.french_siret_number #=> "76430067900496"
|
|
231
|
+
#
|
|
232
|
+
# @faker.version 1.8.5
|
|
93
233
|
def french_siret_number
|
|
94
234
|
location = rand(100).to_s.rjust(4, '0')
|
|
95
235
|
org_no = french_siren_number + location
|
|
96
236
|
org_no + luhn_algorithm(org_no).to_s
|
|
97
237
|
end
|
|
98
238
|
|
|
239
|
+
##
|
|
240
|
+
# Produces a company norwegian organisation number.
|
|
241
|
+
#
|
|
242
|
+
# @return [String]
|
|
243
|
+
#
|
|
244
|
+
# @example
|
|
245
|
+
# Faker::Company.norwegian_organisation_number #=> "842457173"
|
|
246
|
+
#
|
|
247
|
+
# @faker.version 1.8.0
|
|
99
248
|
# Get a random Norwegian organization number. Info: https://www.brreg.no/om-oss/samfunnsoppdraget-vart/registera-vare/einingsregisteret/organisasjonsnummeret/
|
|
100
249
|
def norwegian_organisation_number
|
|
101
250
|
# Valid leading digit: 8, 9
|
|
@@ -107,6 +256,15 @@ module Faker
|
|
|
107
256
|
base + mod11_check.to_s
|
|
108
257
|
end
|
|
109
258
|
|
|
259
|
+
##
|
|
260
|
+
# Produces a company australian business number.
|
|
261
|
+
#
|
|
262
|
+
# @return [String]
|
|
263
|
+
#
|
|
264
|
+
# @example
|
|
265
|
+
# Faker::Company.australian_business_number #=> "93579396170"
|
|
266
|
+
#
|
|
267
|
+
# @faker.version 1.6.4
|
|
110
268
|
def australian_business_number
|
|
111
269
|
base = format('%09d', rand(10**9))
|
|
112
270
|
abn = "00#{base}"
|
|
@@ -114,6 +272,15 @@ module Faker
|
|
|
114
272
|
(99 - (abn_checksum(abn) % 89)).to_s + base
|
|
115
273
|
end
|
|
116
274
|
|
|
275
|
+
##
|
|
276
|
+
# Produces a company polish taxpayer identification_number.
|
|
277
|
+
#
|
|
278
|
+
# @return [String]
|
|
279
|
+
#
|
|
280
|
+
# @example
|
|
281
|
+
# Faker::Company.polish_taxpayer_identification_number #=> "2767549463"
|
|
282
|
+
#
|
|
283
|
+
# @faker.version 1.9.1
|
|
117
284
|
# Get a random Polish taxpayer identification number More info https://pl.wikipedia.org/wiki/NIP
|
|
118
285
|
def polish_taxpayer_identification_number
|
|
119
286
|
result = []
|
|
@@ -125,6 +292,15 @@ module Faker
|
|
|
125
292
|
result.join('')
|
|
126
293
|
end
|
|
127
294
|
|
|
295
|
+
##
|
|
296
|
+
# Produces a company polish register of national economy.
|
|
297
|
+
#
|
|
298
|
+
# @return [String]
|
|
299
|
+
#
|
|
300
|
+
# @example
|
|
301
|
+
# Faker::Company.polish_register_of_national_economy #=> "788435970"
|
|
302
|
+
#
|
|
303
|
+
# @faker.version 1.9.1
|
|
128
304
|
# Get a random Polish register of national economy number. More info https://pl.wikipedia.org/wiki/REGON
|
|
129
305
|
def polish_register_of_national_economy(legacy_length = NOT_GIVEN, length: 9)
|
|
130
306
|
warn_for_deprecated_arguments do |keywords|
|
|
@@ -141,22 +317,67 @@ module Faker
|
|
|
141
317
|
random_digits.join('')
|
|
142
318
|
end
|
|
143
319
|
|
|
320
|
+
##
|
|
321
|
+
# Produces a company south african pty ltd registration number.
|
|
322
|
+
#
|
|
323
|
+
# @return [String]
|
|
324
|
+
#
|
|
325
|
+
# @example
|
|
326
|
+
# Faker::Company.south_african_pty_ltd_registration_number #=> "7043/2400717902/07"
|
|
327
|
+
#
|
|
328
|
+
# @faker.version 1.9.2
|
|
144
329
|
def south_african_pty_ltd_registration_number
|
|
145
330
|
regexify(/\d{4}\/\d{4,10}\/07/)
|
|
146
331
|
end
|
|
147
332
|
|
|
333
|
+
##
|
|
334
|
+
# Produces a company south african close corporation registration number.
|
|
335
|
+
#
|
|
336
|
+
# @return [String]
|
|
337
|
+
#
|
|
338
|
+
# @example
|
|
339
|
+
# Faker::Company.south_african_close_corporation_registration_number #=> "CK38/5739937418/23"
|
|
340
|
+
#
|
|
341
|
+
# @faker.version 1.9.2
|
|
148
342
|
def south_african_close_corporation_registration_number
|
|
149
343
|
regexify(/(CK\d{2}|\d{4})\/\d{4,10}\/23/)
|
|
150
344
|
end
|
|
151
345
|
|
|
346
|
+
##
|
|
347
|
+
# Produces a company south african listed company registration number.
|
|
348
|
+
#
|
|
349
|
+
# @return [String]
|
|
350
|
+
#
|
|
351
|
+
# @example
|
|
352
|
+
# Faker::Company.south_african_listed_company_registration_number #=> "2512/87676/06"
|
|
353
|
+
#
|
|
354
|
+
# @faker.version 1.9.2
|
|
152
355
|
def south_african_listed_company_registration_number
|
|
153
356
|
regexify(/\d{4}\/\d{4,10}\/06/)
|
|
154
357
|
end
|
|
155
358
|
|
|
359
|
+
##
|
|
360
|
+
# Produces a company south african trust registration number.
|
|
361
|
+
#
|
|
362
|
+
# @return [String]
|
|
363
|
+
#
|
|
364
|
+
# @example
|
|
365
|
+
# Faker::Company.south_african_trust_registration_number #=> "IT5673/937519896"
|
|
366
|
+
#
|
|
367
|
+
# @faker.version 1.9.2
|
|
156
368
|
def south_african_trust_registration_number
|
|
157
369
|
regexify(/IT\d{2,4}\/\d{2,10}/)
|
|
158
370
|
end
|
|
159
371
|
|
|
372
|
+
##
|
|
373
|
+
# Produces a company brazilian company number.
|
|
374
|
+
#
|
|
375
|
+
# @return [String]
|
|
376
|
+
#
|
|
377
|
+
# @example
|
|
378
|
+
# Faker::Company.brazilian_company_number #=> "37205322000500"
|
|
379
|
+
#
|
|
380
|
+
# @faker.version 1.9.2
|
|
160
381
|
def brazilian_company_number(legacy_formatted = NOT_GIVEN, formatted: false)
|
|
161
382
|
warn_for_deprecated_arguments do |keywords|
|
|
162
383
|
keywords << :formatted if legacy_formatted != NOT_GIVEN
|
|
@@ -176,6 +397,20 @@ module Faker
|
|
|
176
397
|
formatted ? format('%s.%s.%s/%s-%s', *number.scan(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/).flatten) : number
|
|
177
398
|
end
|
|
178
399
|
|
|
400
|
+
# Get a random Russian tax number.
|
|
401
|
+
def russian_tax_number(region: nil, type: :legal)
|
|
402
|
+
inn_number(region, type)
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
##
|
|
406
|
+
# Produces a company sic code.
|
|
407
|
+
#
|
|
408
|
+
# @return [String]
|
|
409
|
+
#
|
|
410
|
+
# @example
|
|
411
|
+
# Faker::Company.sic_code #=> "7383"
|
|
412
|
+
#
|
|
413
|
+
# @faker.version 1.9.4
|
|
179
414
|
def sic_code
|
|
180
415
|
fetch('company.sic_code')
|
|
181
416
|
end
|
|
@@ -259,6 +494,40 @@ module Faker
|
|
|
259
494
|
end
|
|
260
495
|
sum
|
|
261
496
|
end
|
|
497
|
+
|
|
498
|
+
# rubocop:disable Style/AsciiComments
|
|
499
|
+
#
|
|
500
|
+
# For more on Russian tax number algorithm here:
|
|
501
|
+
# https://ru.wikipedia.org/wiki/Идентификационный_номер_налогоплательщика#Вычисление_контрольных_цифр
|
|
502
|
+
#
|
|
503
|
+
# Range of regions:
|
|
504
|
+
# https://ru.wikipedia.org/wiki/Коды_субъектов_Российской_Федерации
|
|
505
|
+
#
|
|
506
|
+
# rubocop:enable Style/AsciiComments
|
|
507
|
+
def inn_number(region, type)
|
|
508
|
+
n10 = [2, 4, 10, 3, 5, 9, 4, 6, 8]
|
|
509
|
+
n11 = [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]
|
|
510
|
+
n12 = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8]
|
|
511
|
+
|
|
512
|
+
region = format('%.2d', rand(0o1..92)) if region.nil?
|
|
513
|
+
checksum = if type == :legal
|
|
514
|
+
number = region.to_s + rand(1_000_000..9_999_999).to_s
|
|
515
|
+
inn_checksum(n10, number)
|
|
516
|
+
else
|
|
517
|
+
number = region.to_s + rand(10_000_000..99_999_999).to_s
|
|
518
|
+
inn_checksum(n11, number) + inn_checksum(n12, number + inn_checksum(n11, number))
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
number + checksum
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
def inn_checksum(factor, number)
|
|
525
|
+
(
|
|
526
|
+
factor.map.with_index.reduce(0) do |v, i|
|
|
527
|
+
v + i[0] * number[i[1]].to_i
|
|
528
|
+
end % 11 % 10
|
|
529
|
+
).to_s
|
|
530
|
+
end
|
|
262
531
|
end
|
|
263
532
|
end
|
|
264
533
|
end
|
|
@@ -3,62 +3,197 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Compass < Base
|
|
5
5
|
class << self
|
|
6
|
+
##
|
|
7
|
+
# Produces a random cardinal.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::Compass.cardinal #=> "north"
|
|
13
|
+
#
|
|
14
|
+
# @faker.version 1.8.0
|
|
6
15
|
def cardinal
|
|
7
16
|
fetch('compass.cardinal.word')
|
|
8
17
|
end
|
|
9
18
|
|
|
19
|
+
##
|
|
20
|
+
# Produces a random ordinal.
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# Faker::Compass.ordinal #=> "northwest"
|
|
26
|
+
#
|
|
27
|
+
# @faker.version 1.8.0
|
|
10
28
|
def ordinal
|
|
11
29
|
fetch('compass.ordinal.word')
|
|
12
30
|
end
|
|
13
31
|
|
|
32
|
+
##
|
|
33
|
+
# Produces a random half wind.
|
|
34
|
+
#
|
|
35
|
+
# @return [String]
|
|
36
|
+
#
|
|
37
|
+
# @example
|
|
38
|
+
# Faker::Compass.half_wind #=> "north-northwest"
|
|
39
|
+
#
|
|
40
|
+
# @faker.version 1.8.0
|
|
14
41
|
def half_wind
|
|
15
42
|
fetch('compass.half-wind.word')
|
|
16
43
|
end
|
|
17
44
|
|
|
45
|
+
##
|
|
46
|
+
# Produces a random quarter wind.
|
|
47
|
+
#
|
|
48
|
+
# @return [String]
|
|
49
|
+
#
|
|
50
|
+
# @example
|
|
51
|
+
# Faker::Compass.quarter_wind #=> "north by west"
|
|
52
|
+
#
|
|
53
|
+
# @faker.version 1.8.0
|
|
18
54
|
def quarter_wind
|
|
19
55
|
fetch('compass.quarter-wind.word')
|
|
20
56
|
end
|
|
21
57
|
|
|
58
|
+
##
|
|
59
|
+
# Produces a random direction.
|
|
60
|
+
#
|
|
61
|
+
# @return [String]
|
|
62
|
+
#
|
|
63
|
+
# @example
|
|
64
|
+
# Faker::Compass.direction #=> "southeast"
|
|
65
|
+
#
|
|
66
|
+
# @faker.version 1.8.0
|
|
22
67
|
def direction
|
|
23
68
|
parse('compass.direction')
|
|
24
69
|
end
|
|
25
70
|
|
|
71
|
+
##
|
|
72
|
+
# Produces a random abbreviation.
|
|
73
|
+
#
|
|
74
|
+
# @return [String]
|
|
75
|
+
#
|
|
76
|
+
# @example
|
|
77
|
+
# Faker::Compass.abbreviation #=> "NEbN"
|
|
78
|
+
#
|
|
79
|
+
# @faker.version 1.8.0
|
|
26
80
|
def abbreviation
|
|
27
81
|
parse('compass.abbreviation')
|
|
28
82
|
end
|
|
29
83
|
|
|
84
|
+
##
|
|
85
|
+
# Produces a random azimuth.
|
|
86
|
+
#
|
|
87
|
+
# @return [String]
|
|
88
|
+
#
|
|
89
|
+
# @example
|
|
90
|
+
# Faker::Compass.azimuth #=> "168.75"
|
|
91
|
+
#
|
|
92
|
+
# @faker.version 1.8.0
|
|
30
93
|
def azimuth
|
|
31
94
|
parse('compass.azimuth')
|
|
32
95
|
end
|
|
33
96
|
|
|
97
|
+
##
|
|
98
|
+
# Produces a random cardinal abbreviation.
|
|
99
|
+
#
|
|
100
|
+
# @return [String]
|
|
101
|
+
#
|
|
102
|
+
# @example
|
|
103
|
+
# Faker::Compass.cardinal_abbreviation #=> "N"
|
|
104
|
+
#
|
|
105
|
+
# @faker.version 1.8.0
|
|
34
106
|
def cardinal_abbreviation
|
|
35
107
|
fetch('compass.cardinal.abbreviation')
|
|
36
108
|
end
|
|
37
109
|
|
|
110
|
+
##
|
|
111
|
+
# Produces a random ordinal abbreviation.
|
|
112
|
+
#
|
|
113
|
+
# @return [String]
|
|
114
|
+
#
|
|
115
|
+
# @example
|
|
116
|
+
# Faker::Compass.ordinal_abbreviation #=> "SW"
|
|
117
|
+
#
|
|
118
|
+
# @faker.version 1.8.0
|
|
38
119
|
def ordinal_abbreviation
|
|
39
120
|
fetch('compass.ordinal.abbreviation')
|
|
40
121
|
end
|
|
41
122
|
|
|
123
|
+
##
|
|
124
|
+
# Produces a random half wind abbreviation.
|
|
125
|
+
#
|
|
126
|
+
# @return [String]
|
|
127
|
+
#
|
|
128
|
+
# @example
|
|
129
|
+
# Faker::Compass.half_wind_abbreviation #=> "NNE"
|
|
130
|
+
#
|
|
131
|
+
# @faker.version 1.8.0
|
|
42
132
|
def half_wind_abbreviation
|
|
43
133
|
fetch('compass.half-wind.abbreviation')
|
|
44
134
|
end
|
|
45
135
|
|
|
136
|
+
##
|
|
137
|
+
# Produces a random quarter wind abbreviation.
|
|
138
|
+
#
|
|
139
|
+
# @return [String]
|
|
140
|
+
#
|
|
141
|
+
# @example
|
|
142
|
+
# Faker::Compass.quarter_wind_abbreviation #=> "SWbS"
|
|
143
|
+
#
|
|
144
|
+
# @faker.version 1.8.0
|
|
46
145
|
def quarter_wind_abbreviation
|
|
47
146
|
fetch('compass.quarter-wind.abbreviation')
|
|
48
147
|
end
|
|
49
148
|
|
|
149
|
+
##
|
|
150
|
+
# Produces a random cardinal azimuth.
|
|
151
|
+
#
|
|
152
|
+
# @return [String]
|
|
153
|
+
#
|
|
154
|
+
# @example
|
|
155
|
+
# Faker::Compass.cardinal_azimuth #=> "90"
|
|
156
|
+
#
|
|
157
|
+
# @faker.version 1.8.0
|
|
50
158
|
def cardinal_azimuth
|
|
51
159
|
fetch('compass.cardinal.azimuth')
|
|
52
160
|
end
|
|
53
161
|
|
|
162
|
+
##
|
|
163
|
+
# Produces a random ordinal azimuth.
|
|
164
|
+
#
|
|
165
|
+
# @return [String]
|
|
166
|
+
#
|
|
167
|
+
# @example
|
|
168
|
+
# Faker::Compass.ordinal_azimuth #=> "135"
|
|
169
|
+
#
|
|
170
|
+
# @faker.version 1.8.0
|
|
54
171
|
def ordinal_azimuth
|
|
55
172
|
fetch('compass.ordinal.azimuth')
|
|
56
173
|
end
|
|
57
174
|
|
|
175
|
+
##
|
|
176
|
+
# Produces a random half wind azimuth.
|
|
177
|
+
#
|
|
178
|
+
# @return [String]
|
|
179
|
+
#
|
|
180
|
+
# @example
|
|
181
|
+
# Faker::Compass.half_wind_azimuth #=> "292.5"
|
|
182
|
+
#
|
|
183
|
+
# @faker.version 1.8.0
|
|
58
184
|
def half_wind_azimuth
|
|
59
185
|
fetch('compass.half-wind.azimuth')
|
|
60
186
|
end
|
|
61
187
|
|
|
188
|
+
##
|
|
189
|
+
# Produces a random quarter wind azimuth
|
|
190
|
+
#
|
|
191
|
+
# @return [String]
|
|
192
|
+
#
|
|
193
|
+
# @example
|
|
194
|
+
# Faker::Compass.quarter_wind_azimuth #=> "56.25"
|
|
195
|
+
#
|
|
196
|
+
# @faker.version 1.8.0
|
|
62
197
|
def quarter_wind_azimuth
|
|
63
198
|
fetch('compass.quarter-wind.azimuth')
|
|
64
199
|
end
|