faker 2.8.0 → 2.10.2
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 +185 -18
- data/README.md +1 -1
- data/lib/faker.rb +3 -5
- data/lib/faker/default/address.rb +215 -0
- data/lib/faker/default/ancient.rb +36 -0
- data/lib/faker/default/bank.rb +1 -1
- data/lib/faker/default/beer.rb +72 -0
- data/lib/faker/default/bossa_nova.rb +18 -0
- data/lib/faker/default/business.rb +27 -0
- data/lib/faker/default/chuck_norris.rb +11 -1
- data/lib/faker/default/color.rb +48 -1
- data/lib/faker/default/company.rb +236 -4
- data/lib/faker/default/crypto.rb +27 -0
- data/lib/faker/default/currency.rb +27 -0
- data/lib/faker/default/dc_comics.rb +45 -0
- data/lib/faker/default/demographic.rb +57 -0
- data/lib/faker/default/educator.rb +60 -6
- data/lib/faker/default/esport.rb +45 -0
- data/lib/faker/default/file.rb +2 -2
- data/lib/faker/default/fillmurray.rb +23 -1
- data/lib/faker/default/food.rb +65 -1
- data/lib/faker/default/gender.rb +13 -0
- data/lib/faker/default/internet.rb +13 -4
- data/lib/faker/default/job.rb +36 -0
- data/lib/faker/default/kpop.rb +54 -0
- data/lib/faker/default/lorem.rb +1 -1
- data/lib/faker/default/space.rb +127 -0
- data/lib/faker/default/team.rb +45 -0
- data/lib/faker/music/music.rb +90 -4
- data/lib/faker/music/opera.rb +36 -0
- data/lib/faker/version.rb +1 -1
- 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/en-NEP.yml +1 -1
- data/lib/locales/en-NZ.yml +132 -8
- data/lib/locales/en-ZA.yml +1 -1
- data/lib/locales/en/address.yml +4 -0
- data/lib/locales/en/color.yml +1 -1
- data/lib/locales/en/educator.yml +69 -6
- data/lib/locales/en/gender.yml +1 -0
- data/lib/locales/en/phone_number.yml +1 -1
- data/lib/locales/en/shakespeare.yml +3 -3
- data/lib/locales/en/stripe.yml +3 -3
- data/lib/locales/es-MX.yml +3 -0
- data/lib/locales/fa.yml +2 -0
- data/lib/locales/fr-CA.yml +5 -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/pt-BR.yml +23 -2
- 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 +12 -12
|
@@ -3,18 +3,54 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Ancient < Base
|
|
5
5
|
class << self
|
|
6
|
+
##
|
|
7
|
+
# Produces a god from ancient mythology.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::Ancient.god #=> "Zeus"
|
|
13
|
+
#
|
|
14
|
+
# @faker.version 1.7.0
|
|
6
15
|
def god
|
|
7
16
|
fetch('ancient.god')
|
|
8
17
|
end
|
|
9
18
|
|
|
19
|
+
##
|
|
20
|
+
# Produces a primordial from ancient mythology.
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# Faker::Ancient.primordial #=> "Gaia"
|
|
26
|
+
#
|
|
27
|
+
# @faker.version 1.7.0
|
|
10
28
|
def primordial
|
|
11
29
|
fetch('ancient.primordial')
|
|
12
30
|
end
|
|
13
31
|
|
|
32
|
+
##
|
|
33
|
+
# Produces a titan from ancient mythology.
|
|
34
|
+
#
|
|
35
|
+
# @return [String]
|
|
36
|
+
#
|
|
37
|
+
# @example
|
|
38
|
+
# Faker::Ancient.titan #=> "Atlas"
|
|
39
|
+
#
|
|
40
|
+
# @faker.version 1.7.0
|
|
14
41
|
def titan
|
|
15
42
|
fetch('ancient.titan')
|
|
16
43
|
end
|
|
17
44
|
|
|
45
|
+
##
|
|
46
|
+
# Produces a hero from ancient mythology.
|
|
47
|
+
#
|
|
48
|
+
# @return [String]
|
|
49
|
+
#
|
|
50
|
+
# @example
|
|
51
|
+
# Faker::Ancient.hero #=> "Achilles"
|
|
52
|
+
#
|
|
53
|
+
# @faker.version 1.7.0
|
|
18
54
|
def hero
|
|
19
55
|
fetch('ancient.hero')
|
|
20
56
|
end
|
data/lib/faker/default/bank.rb
CHANGED
|
@@ -18,7 +18,7 @@ module Faker
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def iban(legacy_country_code = NOT_GIVEN, country_code: 'GB')
|
|
21
|
-
# Each country has
|
|
21
|
+
# Each country has its own format for bank accounts
|
|
22
22
|
# Many of them use letters in certain parts of the account
|
|
23
23
|
# Using regex patterns we can create virtually any type of bank account
|
|
24
24
|
warn_for_deprecated_arguments do |keywords|
|
data/lib/faker/default/beer.rb
CHANGED
|
@@ -5,34 +5,106 @@ module Faker
|
|
|
5
5
|
flexible :beer
|
|
6
6
|
|
|
7
7
|
class << self
|
|
8
|
+
##
|
|
9
|
+
# Produces a random beer name.
|
|
10
|
+
#
|
|
11
|
+
# @return [String]
|
|
12
|
+
#
|
|
13
|
+
# @example
|
|
14
|
+
# Faker::Beer.name #=> "Pliny The Elder"
|
|
15
|
+
#
|
|
16
|
+
# @faker.version 1.6.2
|
|
8
17
|
def name
|
|
9
18
|
fetch('beer.name')
|
|
10
19
|
end
|
|
11
20
|
|
|
21
|
+
##
|
|
22
|
+
# Produces a random beer style.
|
|
23
|
+
#
|
|
24
|
+
# @return [String]
|
|
25
|
+
#
|
|
26
|
+
# @example
|
|
27
|
+
# Faker::Beer.style #=> "Wood-aged Beer"
|
|
28
|
+
#
|
|
29
|
+
# @faker.version 1.6.2
|
|
12
30
|
def style
|
|
13
31
|
fetch('beer.style')
|
|
14
32
|
end
|
|
15
33
|
|
|
34
|
+
##
|
|
35
|
+
# Produces a random beer hops.
|
|
36
|
+
#
|
|
37
|
+
# @return [String]
|
|
38
|
+
#
|
|
39
|
+
# @example
|
|
40
|
+
# Faker::Beer.hop #=> "Sterling"
|
|
41
|
+
#
|
|
42
|
+
# @faker.version 1.6.2
|
|
16
43
|
def hop
|
|
17
44
|
fetch('beer.hop')
|
|
18
45
|
end
|
|
19
46
|
|
|
47
|
+
##
|
|
48
|
+
# Produces a random beer yeast.
|
|
49
|
+
#
|
|
50
|
+
# @return [String]
|
|
51
|
+
#
|
|
52
|
+
# @example
|
|
53
|
+
# Faker::Beer.yeast #=> "5335 - Lactobacillus"
|
|
54
|
+
#
|
|
55
|
+
# @faker.version 1.6.2
|
|
20
56
|
def yeast
|
|
21
57
|
fetch('beer.yeast')
|
|
22
58
|
end
|
|
23
59
|
|
|
60
|
+
##
|
|
61
|
+
# Produces a random beer malt.
|
|
62
|
+
#
|
|
63
|
+
# @return [String]
|
|
64
|
+
#
|
|
65
|
+
# @example
|
|
66
|
+
# Faker::Beer.malts #=> "Munich"
|
|
67
|
+
#
|
|
68
|
+
# @faker.version 1.6.2
|
|
24
69
|
def malts
|
|
25
70
|
fetch('beer.malt')
|
|
26
71
|
end
|
|
27
72
|
|
|
73
|
+
##
|
|
74
|
+
# Produces a random beer IBU.
|
|
75
|
+
#
|
|
76
|
+
# @return [String]
|
|
77
|
+
#
|
|
78
|
+
# @example
|
|
79
|
+
# Faker::Beer.ibu #=> "87 IBU"
|
|
80
|
+
#
|
|
81
|
+
# @faker.version 1.6.2
|
|
28
82
|
def ibu
|
|
29
83
|
rand(10..100).to_s + ' IBU'
|
|
30
84
|
end
|
|
31
85
|
|
|
86
|
+
##
|
|
87
|
+
# Produces a random beer alcohol percentage.
|
|
88
|
+
#
|
|
89
|
+
# @return [String]
|
|
90
|
+
#
|
|
91
|
+
# @example
|
|
92
|
+
# Faker::Beer.alcohol #=> "5.4%"
|
|
93
|
+
#
|
|
94
|
+
# @faker.version 1.6.2
|
|
32
95
|
def alcohol
|
|
33
96
|
rand(2.0..10.0).round(1).to_s + '%'
|
|
34
97
|
end
|
|
35
98
|
|
|
99
|
+
##
|
|
100
|
+
# Produces a random beer blg level.
|
|
101
|
+
#
|
|
102
|
+
# @return [String]
|
|
103
|
+
#
|
|
104
|
+
# @example
|
|
105
|
+
# Faker::Beer.blg #=> "5.1Blg"
|
|
106
|
+
#
|
|
107
|
+
# @faker.version 1.6.2
|
|
36
108
|
def blg
|
|
37
109
|
rand(5.0..20.0).round(1).to_s + '°Blg'
|
|
38
110
|
end
|
|
@@ -3,10 +3,28 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class BossaNova < Base
|
|
5
5
|
class << self
|
|
6
|
+
##
|
|
7
|
+
# Produces the name of a bossa nova artist.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::BossaNova.artist #=> "Tom Jobin"
|
|
13
|
+
#
|
|
14
|
+
# @faker.version 1.8.3
|
|
6
15
|
def artist
|
|
7
16
|
fetch('bossa_nova.artists')
|
|
8
17
|
end
|
|
9
18
|
|
|
19
|
+
##
|
|
20
|
+
# Produces a bossa nova song.
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# Faker::BossaNova.song #=> "Chega de Saudade"
|
|
26
|
+
#
|
|
27
|
+
# @faker.version 1.8.3
|
|
10
28
|
def song
|
|
11
29
|
fetch('bossa_nova.songs')
|
|
12
30
|
end
|
|
@@ -7,14 +7,41 @@ module Faker
|
|
|
7
7
|
flexible :business
|
|
8
8
|
|
|
9
9
|
class << self
|
|
10
|
+
##
|
|
11
|
+
# Produces a credit card number.
|
|
12
|
+
#
|
|
13
|
+
# @return [String]
|
|
14
|
+
#
|
|
15
|
+
# @example
|
|
16
|
+
# Faker::Business.credit_card_number #=> "1228-1221-1221-1431"
|
|
17
|
+
#
|
|
18
|
+
# @faker.version 1.2.0
|
|
10
19
|
def credit_card_number
|
|
11
20
|
fetch('business.credit_card_numbers')
|
|
12
21
|
end
|
|
13
22
|
|
|
23
|
+
##
|
|
24
|
+
# Produces a credit card expiration date.
|
|
25
|
+
#
|
|
26
|
+
# @return [Date]
|
|
27
|
+
#
|
|
28
|
+
# @example
|
|
29
|
+
# Faker::Business.credit_card_number #=> <Date: 2015-11-11 ((2457338j,0s,0n),+0s,2299161j)>
|
|
30
|
+
#
|
|
31
|
+
# @faker.version 1.2.0
|
|
14
32
|
def credit_card_expiry_date
|
|
15
33
|
::Date.today + (365 * rand(1..4))
|
|
16
34
|
end
|
|
17
35
|
|
|
36
|
+
##
|
|
37
|
+
# Produces a type of credit card.
|
|
38
|
+
#
|
|
39
|
+
# @return [String]
|
|
40
|
+
#
|
|
41
|
+
# @example
|
|
42
|
+
# Faker::Business.credit_card_type #=> "visa"
|
|
43
|
+
#
|
|
44
|
+
# @faker.version 1.2.0
|
|
18
45
|
def credit_card_type
|
|
19
46
|
fetch('business.credit_card_types')
|
|
20
47
|
end
|
|
@@ -5,7 +5,17 @@ module Faker
|
|
|
5
5
|
flexible :chuck_norris
|
|
6
6
|
|
|
7
7
|
class << self
|
|
8
|
-
#
|
|
8
|
+
# Produces a Chuck Norris Fact.
|
|
9
|
+
# Original list of facts:
|
|
10
|
+
# https://github.com/jenkinsci/chucknorris-plugin/blob/master/src/main/java/hudson/plugins/chucknorris/FactGenerator.java
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
#
|
|
14
|
+
# @example
|
|
15
|
+
# Faker::ChuckNorris.fact
|
|
16
|
+
# #=> "Chuck Norris can solve the Towers of Hanoi in one move."
|
|
17
|
+
#
|
|
18
|
+
# @faker.version 1.6.4
|
|
9
19
|
def fact
|
|
10
20
|
fetch('chuck_norris.fact')
|
|
11
21
|
end
|
data/lib/faker/default/color.rb
CHANGED
|
@@ -3,27 +3,74 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Color < Base
|
|
5
5
|
class << self
|
|
6
|
+
##
|
|
7
|
+
# Produces a hex color code.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::Color.hex_color #=> "#31a785"
|
|
13
|
+
#
|
|
14
|
+
# @faker.version 1.5.0
|
|
6
15
|
def hex_color
|
|
7
16
|
format('#%06x', (rand * 0xffffff))
|
|
8
17
|
end
|
|
9
18
|
|
|
19
|
+
##
|
|
20
|
+
# Produces the name of a color.
|
|
21
|
+
#
|
|
22
|
+
# @return [String]
|
|
23
|
+
#
|
|
24
|
+
# @example
|
|
25
|
+
# Faker::Color.color_name #=> "yellow"
|
|
26
|
+
#
|
|
27
|
+
# @faker.version 1.6.2
|
|
10
28
|
def color_name
|
|
11
29
|
fetch('color.name')
|
|
12
30
|
end
|
|
13
31
|
|
|
32
|
+
# @private
|
|
14
33
|
def single_rgb_color
|
|
15
34
|
sample((0..255).to_a)
|
|
16
35
|
end
|
|
17
36
|
|
|
37
|
+
##
|
|
38
|
+
# Produces an array of integers representing an RGB color.
|
|
39
|
+
#
|
|
40
|
+
# @return [Array(Integer, Integer, Integer)]
|
|
41
|
+
#
|
|
42
|
+
# @example
|
|
43
|
+
# Faker::Color.rgb_color #=> [54, 233, 67]
|
|
44
|
+
#
|
|
45
|
+
# @faker.version 1.5.0
|
|
18
46
|
def rgb_color
|
|
19
47
|
Array.new(3) { single_rgb_color }
|
|
20
48
|
end
|
|
21
49
|
|
|
22
|
-
|
|
50
|
+
##
|
|
51
|
+
# Produces an array of floats representing an HSL color.
|
|
52
|
+
# The array is in the form of `[hue, saturation, lightness]`.
|
|
53
|
+
#
|
|
54
|
+
# @return [Array(Float, Float, Float)]
|
|
55
|
+
#
|
|
56
|
+
# @example
|
|
57
|
+
# Faker::Color.hsl_color #=> [69.87, 0.66, 0.3]
|
|
58
|
+
#
|
|
59
|
+
# @faker.version 1.5.0
|
|
23
60
|
def hsl_color
|
|
24
61
|
[sample((0..360).to_a), rand.round(2), rand.round(2)]
|
|
25
62
|
end
|
|
26
63
|
|
|
64
|
+
##
|
|
65
|
+
# Produces an array of floats representing an HSLA color.
|
|
66
|
+
# The array is in the form of `[hue, saturation, lightness, alpha]`.
|
|
67
|
+
#
|
|
68
|
+
# @return [Array(Float, Float, Float, Float)]
|
|
69
|
+
#
|
|
70
|
+
# @example
|
|
71
|
+
# Faker::Color.hsla_color #=> [154.77, 0.36, 0.9, 0.2]
|
|
72
|
+
#
|
|
73
|
+
# @faker.version 1.5.0
|
|
27
74
|
def hsla_color
|
|
28
75
|
hsl_color << rand.round(1)
|
|
29
76
|
end
|
|
@@ -5,57 +5,163 @@ 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
|
|
@@ -64,6 +170,15 @@ module Faker
|
|
|
64
170
|
base
|
|
65
171
|
end
|
|
66
172
|
|
|
173
|
+
##
|
|
174
|
+
# Produces a company swedish organisation number.
|
|
175
|
+
#
|
|
176
|
+
# @return [String]
|
|
177
|
+
#
|
|
178
|
+
# @example
|
|
179
|
+
# Faker::Company.swedish_organisation_number #=> "3866029808"
|
|
180
|
+
#
|
|
181
|
+
# @faker.version 1.7.0
|
|
67
182
|
# Get a random Swedish organization number. See more here https://sv.wikipedia.org/wiki/Organisationsnummer
|
|
68
183
|
def swedish_organisation_number
|
|
69
184
|
# Valid leading digit: 1, 2, 3, 5, 6, 7, 8, 9
|
|
@@ -73,6 +188,15 @@ module Faker
|
|
|
73
188
|
base + luhn_algorithm(base).to_s
|
|
74
189
|
end
|
|
75
190
|
|
|
191
|
+
##
|
|
192
|
+
# Produces a company czech organisation number.
|
|
193
|
+
#
|
|
194
|
+
# @return [String]
|
|
195
|
+
#
|
|
196
|
+
# @example
|
|
197
|
+
# Faker::Company.czech_organisation_number #=> "90642741"
|
|
198
|
+
#
|
|
199
|
+
# @faker.version 1.9.1
|
|
76
200
|
def czech_organisation_number
|
|
77
201
|
sum = 0
|
|
78
202
|
base = []
|
|
@@ -84,18 +208,45 @@ module Faker
|
|
|
84
208
|
base.join
|
|
85
209
|
end
|
|
86
210
|
|
|
211
|
+
##
|
|
212
|
+
# Produces a company french siren number.
|
|
213
|
+
#
|
|
214
|
+
# @return [String]
|
|
215
|
+
#
|
|
216
|
+
# @example
|
|
217
|
+
# Faker::Company.french_siren_number #=> "163417827"
|
|
218
|
+
#
|
|
219
|
+
# @faker.version 1.8.5
|
|
87
220
|
# 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
221
|
def french_siren_number
|
|
89
222
|
base = (1..8).map { rand(10) }.join
|
|
90
223
|
base + luhn_algorithm(base).to_s
|
|
91
224
|
end
|
|
92
225
|
|
|
226
|
+
##
|
|
227
|
+
# Produces a company french siret number.
|
|
228
|
+
#
|
|
229
|
+
# @return [String]
|
|
230
|
+
#
|
|
231
|
+
# @example
|
|
232
|
+
# Faker::Company.french_siret_number #=> "76430067900496"
|
|
233
|
+
#
|
|
234
|
+
# @faker.version 1.8.5
|
|
93
235
|
def french_siret_number
|
|
94
236
|
location = rand(100).to_s.rjust(4, '0')
|
|
95
237
|
org_no = french_siren_number + location
|
|
96
238
|
org_no + luhn_algorithm(org_no).to_s
|
|
97
239
|
end
|
|
98
240
|
|
|
241
|
+
##
|
|
242
|
+
# Produces a company norwegian organisation number.
|
|
243
|
+
#
|
|
244
|
+
# @return [String]
|
|
245
|
+
#
|
|
246
|
+
# @example
|
|
247
|
+
# Faker::Company.norwegian_organisation_number #=> "842457173"
|
|
248
|
+
#
|
|
249
|
+
# @faker.version 1.8.0
|
|
99
250
|
# Get a random Norwegian organization number. Info: https://www.brreg.no/om-oss/samfunnsoppdraget-vart/registera-vare/einingsregisteret/organisasjonsnummeret/
|
|
100
251
|
def norwegian_organisation_number
|
|
101
252
|
# Valid leading digit: 8, 9
|
|
@@ -107,6 +258,15 @@ module Faker
|
|
|
107
258
|
base + mod11_check.to_s
|
|
108
259
|
end
|
|
109
260
|
|
|
261
|
+
##
|
|
262
|
+
# Produces a company australian business number.
|
|
263
|
+
#
|
|
264
|
+
# @return [String]
|
|
265
|
+
#
|
|
266
|
+
# @example
|
|
267
|
+
# Faker::Company.australian_business_number #=> "93579396170"
|
|
268
|
+
#
|
|
269
|
+
# @faker.version 1.6.4
|
|
110
270
|
def australian_business_number
|
|
111
271
|
base = format('%09d', rand(10**9))
|
|
112
272
|
abn = "00#{base}"
|
|
@@ -114,6 +274,15 @@ module Faker
|
|
|
114
274
|
(99 - (abn_checksum(abn) % 89)).to_s + base
|
|
115
275
|
end
|
|
116
276
|
|
|
277
|
+
##
|
|
278
|
+
# Produces a company polish taxpayer identification_number.
|
|
279
|
+
#
|
|
280
|
+
# @return [String]
|
|
281
|
+
#
|
|
282
|
+
# @example
|
|
283
|
+
# Faker::Company.polish_taxpayer_identification_number #=> "2767549463"
|
|
284
|
+
#
|
|
285
|
+
# @faker.version 1.9.1
|
|
117
286
|
# Get a random Polish taxpayer identification number More info https://pl.wikipedia.org/wiki/NIP
|
|
118
287
|
def polish_taxpayer_identification_number
|
|
119
288
|
result = []
|
|
@@ -125,6 +294,15 @@ module Faker
|
|
|
125
294
|
result.join('')
|
|
126
295
|
end
|
|
127
296
|
|
|
297
|
+
##
|
|
298
|
+
# Produces a company polish register of national economy.
|
|
299
|
+
#
|
|
300
|
+
# @return [String]
|
|
301
|
+
#
|
|
302
|
+
# @example
|
|
303
|
+
# Faker::Company.polish_register_of_national_economy #=> "788435970"
|
|
304
|
+
#
|
|
305
|
+
# @faker.version 1.9.1
|
|
128
306
|
# Get a random Polish register of national economy number. More info https://pl.wikipedia.org/wiki/REGON
|
|
129
307
|
def polish_register_of_national_economy(legacy_length = NOT_GIVEN, length: 9)
|
|
130
308
|
warn_for_deprecated_arguments do |keywords|
|
|
@@ -141,22 +319,67 @@ module Faker
|
|
|
141
319
|
random_digits.join('')
|
|
142
320
|
end
|
|
143
321
|
|
|
322
|
+
##
|
|
323
|
+
# Produces a company south african pty ltd registration number.
|
|
324
|
+
#
|
|
325
|
+
# @return [String]
|
|
326
|
+
#
|
|
327
|
+
# @example
|
|
328
|
+
# Faker::Company.south_african_pty_ltd_registration_number #=> "7043/2400717902/07"
|
|
329
|
+
#
|
|
330
|
+
# @faker.version 1.9.2
|
|
144
331
|
def south_african_pty_ltd_registration_number
|
|
145
332
|
regexify(/\d{4}\/\d{4,10}\/07/)
|
|
146
333
|
end
|
|
147
334
|
|
|
335
|
+
##
|
|
336
|
+
# Produces a company south african close corporation registration number.
|
|
337
|
+
#
|
|
338
|
+
# @return [String]
|
|
339
|
+
#
|
|
340
|
+
# @example
|
|
341
|
+
# Faker::Company.south_african_close_corporation_registration_number #=> "CK38/5739937418/23"
|
|
342
|
+
#
|
|
343
|
+
# @faker.version 1.9.2
|
|
148
344
|
def south_african_close_corporation_registration_number
|
|
149
345
|
regexify(/(CK\d{2}|\d{4})\/\d{4,10}\/23/)
|
|
150
346
|
end
|
|
151
347
|
|
|
348
|
+
##
|
|
349
|
+
# Produces a company south african listed company registration number.
|
|
350
|
+
#
|
|
351
|
+
# @return [String]
|
|
352
|
+
#
|
|
353
|
+
# @example
|
|
354
|
+
# Faker::Company.south_african_listed_company_registration_number #=> "2512/87676/06"
|
|
355
|
+
#
|
|
356
|
+
# @faker.version 1.9.2
|
|
152
357
|
def south_african_listed_company_registration_number
|
|
153
358
|
regexify(/\d{4}\/\d{4,10}\/06/)
|
|
154
359
|
end
|
|
155
360
|
|
|
361
|
+
##
|
|
362
|
+
# Produces a company south african trust registration number.
|
|
363
|
+
#
|
|
364
|
+
# @return [String]
|
|
365
|
+
#
|
|
366
|
+
# @example
|
|
367
|
+
# Faker::Company.south_african_trust_registration_number #=> "IT5673/937519896"
|
|
368
|
+
#
|
|
369
|
+
# @faker.version 1.9.2
|
|
156
370
|
def south_african_trust_registration_number
|
|
157
371
|
regexify(/IT\d{2,4}\/\d{2,10}/)
|
|
158
372
|
end
|
|
159
373
|
|
|
374
|
+
##
|
|
375
|
+
# Produces a company brazilian company number.
|
|
376
|
+
#
|
|
377
|
+
# @return [String]
|
|
378
|
+
#
|
|
379
|
+
# @example
|
|
380
|
+
# Faker::Company.brazilian_company_number #=> "37205322000500"
|
|
381
|
+
#
|
|
382
|
+
# @faker.version 1.9.2
|
|
160
383
|
def brazilian_company_number(legacy_formatted = NOT_GIVEN, formatted: false)
|
|
161
384
|
warn_for_deprecated_arguments do |keywords|
|
|
162
385
|
keywords << :formatted if legacy_formatted != NOT_GIVEN
|
|
@@ -176,6 +399,15 @@ module Faker
|
|
|
176
399
|
formatted ? format('%s.%s.%s/%s-%s', *number.scan(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/).flatten) : number
|
|
177
400
|
end
|
|
178
401
|
|
|
402
|
+
##
|
|
403
|
+
# Produces a company sic code.
|
|
404
|
+
#
|
|
405
|
+
# @return [String]
|
|
406
|
+
#
|
|
407
|
+
# @example
|
|
408
|
+
# Faker::Company.sic_code #=> "7383"
|
|
409
|
+
#
|
|
410
|
+
# @faker.version 1.9.4
|
|
179
411
|
def sic_code
|
|
180
412
|
fetch('company.sic_code')
|
|
181
413
|
end
|