faker 2.9.0 → 2.12.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 +231 -0
- data/README.md +12 -3
- data/lib/faker.rb +21 -14
- data/lib/faker/default/address.rb +13 -0
- data/lib/faker/default/bank.rb +80 -1
- 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/commerce.rb +73 -10
- data/lib/faker/default/company.rb +275 -4
- 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/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/hipster.rb +94 -0
- data/lib/faker/default/internet.rb +29 -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/measurement.rb +90 -0
- data/lib/faker/default/name.rb +83 -0
- data/lib/faker/default/omniauth.rb +47 -47
- 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/games/control.rb +113 -0
- data/lib/faker/games/dnd.rb +61 -0
- data/lib/faker/games/warhammer_fantasy.rb +74 -0
- data/lib/faker/movies/departed.rb +49 -0
- data/lib/faker/music/music.rb +90 -4
- data/lib/faker/music/opera.rb +36 -0
- data/lib/faker/music/pearl_jam.rb +50 -0
- data/lib/faker/music/phish.rb +27 -1
- 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/suits.rb +37 -0
- data/lib/faker/version.rb +1 -1
- data/lib/helpers/char.rb +2 -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/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 +132 -8
- data/lib/locales/en-US.yml +29 -3
- data/lib/locales/en-ZA.yml +1 -1
- data/lib/locales/en/address.yml +6 -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/heroes_of_the_storm.yml +1 -1
- data/lib/locales/en/house.yml +1 -1
- data/lib/locales/en/name.yml +1 -1
- 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/phone_number.yml +1 -1
- data/lib/locales/en/rajnikanth.yml +77 -0
- data/lib/locales/en/shakespeare.yml +3 -3
- data/lib/locales/en/show.yml +597 -0
- data/lib/locales/en/star_wars.yml +568 -221
- 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 +37 -16
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Faker
|
|
4
|
+
class Blood < Base
|
|
5
|
+
flexible :blood
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
##
|
|
9
|
+
# Produces a random blood type.
|
|
10
|
+
#
|
|
11
|
+
# @return [String]
|
|
12
|
+
#
|
|
13
|
+
# @example
|
|
14
|
+
# Faker::Blood.type #=> "AB"
|
|
15
|
+
#
|
|
16
|
+
# @faker.version next
|
|
17
|
+
def type
|
|
18
|
+
fetch('blood.type')
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
##
|
|
22
|
+
# Produces a random blood RH-Factor.
|
|
23
|
+
#
|
|
24
|
+
# @return [String]
|
|
25
|
+
#
|
|
26
|
+
# @example
|
|
27
|
+
# Faker::Blood.rh_factor #=> "-"
|
|
28
|
+
#
|
|
29
|
+
# @faker.version next
|
|
30
|
+
def rh_factor
|
|
31
|
+
fetch('blood.rh_factor')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
##
|
|
35
|
+
# Produces a random blood group name.
|
|
36
|
+
#
|
|
37
|
+
# @return [String]
|
|
38
|
+
#
|
|
39
|
+
# @example
|
|
40
|
+
# Faker::Blood.group #=> "AB-"
|
|
41
|
+
#
|
|
42
|
+
# @faker.version next
|
|
43
|
+
def group
|
|
44
|
+
parse('blood.group')
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -26,7 +26,7 @@ module Faker
|
|
|
26
26
|
# @return [Date]
|
|
27
27
|
#
|
|
28
28
|
# @example
|
|
29
|
-
# Faker::Business.
|
|
29
|
+
# Faker::Business.credit_card_expiry_date #=> <Date: 2015-11-11 ((2457338j,0s,0n),+0s,2299161j)>
|
|
30
30
|
#
|
|
31
31
|
# @faker.version 1.2.0
|
|
32
32
|
def credit_card_expiry_date
|
|
@@ -2,42 +2,122 @@
|
|
|
2
2
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Cannabis < Base
|
|
5
|
+
# Produces a random strain.
|
|
6
|
+
#
|
|
7
|
+
# @return [String]
|
|
8
|
+
#
|
|
9
|
+
# @example
|
|
10
|
+
# Faker::Cannabis.strain #=> "Super Glue"
|
|
11
|
+
#
|
|
12
|
+
# @faker.version 1.9.1
|
|
5
13
|
def self.strain
|
|
6
14
|
fetch('cannabis.strains')
|
|
7
15
|
end
|
|
8
16
|
|
|
17
|
+
# Produces a random abbreviation.
|
|
18
|
+
#
|
|
19
|
+
# @return [String]
|
|
20
|
+
#
|
|
21
|
+
# @example
|
|
22
|
+
# Faker::Cannabis.cannabinoid_abbreviation #=> "CBGa"
|
|
23
|
+
#
|
|
24
|
+
# @faker.version 1.9.1
|
|
9
25
|
def self.cannabinoid_abbreviation
|
|
10
26
|
fetch('cannabis.cannabinoid_abbreviations')
|
|
11
27
|
end
|
|
12
28
|
|
|
29
|
+
# Produces a random cannabinoid type.
|
|
30
|
+
#
|
|
31
|
+
# @return [String]
|
|
32
|
+
#
|
|
33
|
+
# @example
|
|
34
|
+
# Faker::Cannabis.cannabinoid #=> "Cannabinolic Acid"
|
|
35
|
+
#
|
|
36
|
+
# @faker.version 1.9.1
|
|
13
37
|
def self.cannabinoid
|
|
14
38
|
fetch('cannabis.cannabinoids')
|
|
15
39
|
end
|
|
16
40
|
|
|
41
|
+
# Produces a random terpene type.
|
|
42
|
+
#
|
|
43
|
+
# @return [String]
|
|
44
|
+
#
|
|
45
|
+
# @example
|
|
46
|
+
# Faker::Cannabis.terpene #=> "Terpinene"
|
|
47
|
+
#
|
|
48
|
+
# @faker.version 1.9.1
|
|
17
49
|
def self.terpene
|
|
18
50
|
fetch('cannabis.terpenes')
|
|
19
51
|
end
|
|
20
52
|
|
|
53
|
+
# Produces a random kind of medical use.
|
|
54
|
+
#
|
|
55
|
+
# @return [String]
|
|
56
|
+
#
|
|
57
|
+
# @example
|
|
58
|
+
# Faker::Cannabis.medical_use #=> "anti-cancer"
|
|
59
|
+
#
|
|
60
|
+
# @faker.version 1.9.1
|
|
21
61
|
def self.medical_use
|
|
22
62
|
fetch('cannabis.medical_uses')
|
|
23
63
|
end
|
|
24
64
|
|
|
65
|
+
# Produces a random health benefit.
|
|
66
|
+
#
|
|
67
|
+
# @return [String]
|
|
68
|
+
#
|
|
69
|
+
# @example
|
|
70
|
+
# Faker::Cannabis.health_benefit #=> "prevents infection"
|
|
71
|
+
#
|
|
72
|
+
# @faker.version 1.9.1
|
|
25
73
|
def self.health_benefit
|
|
26
74
|
fetch('cannabis.health_benefits')
|
|
27
75
|
end
|
|
28
76
|
|
|
77
|
+
# Produces a random category.
|
|
78
|
+
#
|
|
79
|
+
# @return [String]
|
|
80
|
+
#
|
|
81
|
+
# @example
|
|
82
|
+
# Faker::Cannabis.category #=> "crystalline"
|
|
83
|
+
#
|
|
84
|
+
# @faker.version 1.9.1
|
|
29
85
|
def self.category
|
|
30
86
|
fetch('cannabis.categories')
|
|
31
87
|
end
|
|
32
88
|
|
|
89
|
+
# Produces a random type.
|
|
90
|
+
#
|
|
91
|
+
# @return [String]
|
|
92
|
+
#
|
|
93
|
+
# @example
|
|
94
|
+
# Faker::Cannabis.type #=> "indica"
|
|
95
|
+
#
|
|
96
|
+
# @faker.version 1.9.1
|
|
33
97
|
def self.type
|
|
34
98
|
fetch('cannabis.types')
|
|
35
99
|
end
|
|
36
100
|
|
|
101
|
+
# Produces a random buzzword.
|
|
102
|
+
#
|
|
103
|
+
# @return [String]
|
|
104
|
+
#
|
|
105
|
+
# @example
|
|
106
|
+
# Faker::Cannabis.buzzword #=> "high"
|
|
107
|
+
#
|
|
108
|
+
# @faker.version 1.9.1
|
|
37
109
|
def self.buzzword
|
|
38
110
|
fetch('cannabis.buzzwords')
|
|
39
111
|
end
|
|
40
112
|
|
|
113
|
+
# Produces a random brand.
|
|
114
|
+
#
|
|
115
|
+
# @return [String]
|
|
116
|
+
#
|
|
117
|
+
# @example
|
|
118
|
+
# Faker::Cannabis.brand #=> "Cannavore Confections"
|
|
119
|
+
#
|
|
120
|
+
# @faker.version 1.9.1
|
|
41
121
|
def self.brand
|
|
42
122
|
fetch('cannabis.brands')
|
|
43
123
|
end
|
|
@@ -3,10 +3,30 @@
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Commerce < Base
|
|
5
5
|
class << self
|
|
6
|
+
##
|
|
7
|
+
# Produces a random color.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
#
|
|
11
|
+
# @example
|
|
12
|
+
# Faker::Commerce.color #=> "lavender"
|
|
13
|
+
#
|
|
14
|
+
# @faker.version 1.2.0
|
|
6
15
|
def color
|
|
7
16
|
fetch('color.name')
|
|
8
17
|
end
|
|
9
18
|
|
|
19
|
+
##
|
|
20
|
+
# Produces a random promotion code.
|
|
21
|
+
#
|
|
22
|
+
# @param digits [Integer] Updates the number of numerical digits used to generate the promotion code.
|
|
23
|
+
# @return [String]
|
|
24
|
+
#
|
|
25
|
+
# @example
|
|
26
|
+
# Faker::Commerce.promotion_code #=> "AmazingDeal829102"
|
|
27
|
+
# Faker::Commerce.promotion_code(digits: 2) #=> "AmazingPrice57"
|
|
28
|
+
#
|
|
29
|
+
# @faker.version 1.7.0
|
|
10
30
|
def promotion_code(legacy_digits = NOT_GIVEN, digits: 6)
|
|
11
31
|
warn_for_deprecated_arguments do |keywords|
|
|
12
32
|
keywords << :digits if legacy_digits != NOT_GIVEN
|
|
@@ -19,6 +39,19 @@ module Faker
|
|
|
19
39
|
].join
|
|
20
40
|
end
|
|
21
41
|
|
|
42
|
+
##
|
|
43
|
+
# Produces a random department.
|
|
44
|
+
#
|
|
45
|
+
# @param max [Integer] Updates the maximum number of names used to generate the department name.
|
|
46
|
+
# @param fixed_amount [Boolean] Fixes the amount of departments to use instead of using a range.
|
|
47
|
+
# @return [String]
|
|
48
|
+
#
|
|
49
|
+
# @example
|
|
50
|
+
# Faker::Commerce.department #=> "Grocery, Health & Beauty"
|
|
51
|
+
# Faker::Commerce.department(max: 5) #=> "Grocery, Books, Health & Beauty"
|
|
52
|
+
# Faker::Commerce.department(max: 2, fixed_amount: true) #=> "Books & Tools"
|
|
53
|
+
#
|
|
54
|
+
# @faker.version 1.2.0
|
|
22
55
|
def department(legacy_max = NOT_GIVEN, legacy_fixed_amount = NOT_GIVEN, max: 3, fixed_amount: false)
|
|
23
56
|
warn_for_deprecated_arguments do |keywords|
|
|
24
57
|
keywords << :max if legacy_max != NOT_GIVEN
|
|
@@ -30,19 +63,55 @@ module Faker
|
|
|
30
63
|
|
|
31
64
|
categories = categories(num)
|
|
32
65
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
66
|
+
if categories.is_a?(Array)
|
|
67
|
+
if categories.length > 1
|
|
68
|
+
merge_categories(categories)
|
|
69
|
+
else
|
|
70
|
+
categories[0]
|
|
71
|
+
end
|
|
72
|
+
else
|
|
73
|
+
categories
|
|
74
|
+
end
|
|
36
75
|
end
|
|
37
76
|
|
|
77
|
+
##
|
|
78
|
+
# Produces a random product name.
|
|
79
|
+
#
|
|
80
|
+
# @return [String]
|
|
81
|
+
#
|
|
82
|
+
# @example
|
|
83
|
+
# Faker::Commerce.product_name #=> "Practical Granite Shirt"
|
|
84
|
+
#
|
|
85
|
+
# @faker.version 1.2.0
|
|
38
86
|
def product_name
|
|
39
87
|
"#{fetch('commerce.product_name.adjective')} #{fetch('commerce.product_name.material')} #{fetch('commerce.product_name.product')}"
|
|
40
88
|
end
|
|
41
89
|
|
|
90
|
+
##
|
|
91
|
+
# Produces a random material.
|
|
92
|
+
#
|
|
93
|
+
# @return [String]
|
|
94
|
+
#
|
|
95
|
+
# @example
|
|
96
|
+
# Faker::Commerce.material #=> "Plastic"
|
|
97
|
+
#
|
|
98
|
+
# @faker.version 1.5.0
|
|
42
99
|
def material
|
|
43
100
|
fetch('commerce.product_name.material')
|
|
44
101
|
end
|
|
45
102
|
|
|
103
|
+
##
|
|
104
|
+
# Produces a random product price.
|
|
105
|
+
#
|
|
106
|
+
# @param range [Range] A range to generate the random number within.
|
|
107
|
+
# @param as_string [Boolean] Changes the return value to [String].
|
|
108
|
+
# @return [Float]
|
|
109
|
+
#
|
|
110
|
+
# @example
|
|
111
|
+
# Faker::Commerce.price #=> 44.6
|
|
112
|
+
# Faker::Commerce.price(range: 0..10.0, as_string: true) #=> "2.18"
|
|
113
|
+
#
|
|
114
|
+
# @faker.version 1.2.0
|
|
46
115
|
def price(legacy_range = NOT_GIVEN, legacy_as_string = NOT_GIVEN, range: 0..100.0, as_string: false)
|
|
47
116
|
warn_for_deprecated_arguments do |keywords|
|
|
48
117
|
keywords << :range if legacy_range != NOT_GIVEN
|
|
@@ -60,13 +129,7 @@ module Faker
|
|
|
60
129
|
private
|
|
61
130
|
|
|
62
131
|
def categories(num)
|
|
63
|
-
|
|
64
|
-
while categories.length < num
|
|
65
|
-
category = fetch('commerce.department')
|
|
66
|
-
categories << category unless categories.include?(category)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
categories
|
|
132
|
+
sample(fetch_all('commerce.department'), num)
|
|
70
133
|
end
|
|
71
134
|
|
|
72
135
|
def merge_categories(categories)
|
|
@@ -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,20 @@ 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
|
+
# Get a random Russian tax number.
|
|
403
|
+
def russian_tax_number(region: nil, type: :legal)
|
|
404
|
+
inn_number(region, type)
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
##
|
|
408
|
+
# Produces a company sic code.
|
|
409
|
+
#
|
|
410
|
+
# @return [String]
|
|
411
|
+
#
|
|
412
|
+
# @example
|
|
413
|
+
# Faker::Company.sic_code #=> "7383"
|
|
414
|
+
#
|
|
415
|
+
# @faker.version 1.9.4
|
|
179
416
|
def sic_code
|
|
180
417
|
fetch('company.sic_code')
|
|
181
418
|
end
|
|
@@ -259,6 +496,40 @@ module Faker
|
|
|
259
496
|
end
|
|
260
497
|
sum
|
|
261
498
|
end
|
|
499
|
+
|
|
500
|
+
# rubocop:disable Style/AsciiComments
|
|
501
|
+
#
|
|
502
|
+
# For more on Russian tax number algorithm here:
|
|
503
|
+
# https://ru.wikipedia.org/wiki/Идентификационный_номер_налогоплательщика#Вычисление_контрольных_цифр
|
|
504
|
+
#
|
|
505
|
+
# Range of regions:
|
|
506
|
+
# https://ru.wikipedia.org/wiki/Коды_субъектов_Российской_Федерации
|
|
507
|
+
#
|
|
508
|
+
# rubocop:enable Style/AsciiComments
|
|
509
|
+
def inn_number(region, type)
|
|
510
|
+
n10 = [2, 4, 10, 3, 5, 9, 4, 6, 8]
|
|
511
|
+
n11 = [7, 2, 4, 10, 3, 5, 9, 4, 6, 8]
|
|
512
|
+
n12 = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8]
|
|
513
|
+
|
|
514
|
+
region = format('%.2d', rand(0o1..92)) if region.nil?
|
|
515
|
+
checksum = if type == :legal
|
|
516
|
+
number = region.to_s + rand(1_000_000..9_999_999).to_s
|
|
517
|
+
inn_checksum(n10, number)
|
|
518
|
+
else
|
|
519
|
+
number = region.to_s + rand(10_000_000..99_999_999).to_s
|
|
520
|
+
inn_checksum(n11, number) + inn_checksum(n12, number + inn_checksum(n11, number))
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
number + checksum
|
|
524
|
+
end
|
|
525
|
+
|
|
526
|
+
def inn_checksum(factor, number)
|
|
527
|
+
(
|
|
528
|
+
factor.map.with_index.reduce(0) do |v, i|
|
|
529
|
+
v + i[0] * number[i[1]].to_i
|
|
530
|
+
end % 11 % 10
|
|
531
|
+
).to_s
|
|
532
|
+
end
|
|
262
533
|
end
|
|
263
534
|
end
|
|
264
535
|
end
|