faker 2.17.0 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +51 -2
  3. data/README.md +7 -1
  4. data/lib/faker/creature/bird.rb +203 -0
  5. data/lib/faker/default/code.rb +1 -1
  6. data/lib/faker/default/crypto.rb +13 -0
  7. data/lib/faker/default/id_number.rb +34 -0
  8. data/lib/faker/default/science.rb +26 -0
  9. data/lib/faker/default/tea.rb +41 -0
  10. data/lib/faker/games/witcher.rb +39 -0
  11. data/lib/faker/music/music.rb +12 -0
  12. data/lib/faker/version.rb +1 -1
  13. data/lib/locales/en-US.yml +1 -1
  14. data/lib/locales/en/bird.yml +1281 -0
  15. data/lib/locales/en/book.yml +487 -3
  16. data/lib/locales/en/dune.yml +266 -397
  17. data/lib/locales/en/lovecraft.yml +76 -6
  18. data/lib/locales/en/music.yml +10 -0
  19. data/lib/locales/en/science.yml +355 -3
  20. data/lib/locales/en/space.yml +1 -1
  21. data/lib/locales/en/tea.yml +172 -0
  22. data/lib/locales/en/witcher.yml +37 -0
  23. data/lib/locales/fr.yml +0 -118
  24. data/lib/locales/fr/address.yml +21 -0
  25. data/lib/locales/fr/book.yml +7 -0
  26. data/lib/locales/fr/color.yml +4 -0
  27. data/lib/locales/fr/company.yml +17 -0
  28. data/lib/locales/fr/compass.yml +23 -0
  29. data/lib/locales/fr/demographic.yml +4 -0
  30. data/lib/locales/fr/gender.yml +6 -0
  31. data/lib/locales/fr/internet.yml +5 -0
  32. data/lib/locales/fr/lorem.yml +5 -0
  33. data/lib/locales/fr/measurement.yml +7 -0
  34. data/lib/locales/fr/name.yml +21 -0
  35. data/lib/locales/fr/phone_number.yml +7 -0
  36. data/lib/locales/fr/pokemon.yml +9 -0
  37. data/lib/locales/ja/README.md +13 -0
  38. data/lib/locales/ja/address.yml +17 -0
  39. data/lib/locales/ja/ancient.yml +4 -0
  40. data/lib/locales/ja/bank.yml +4 -0
  41. data/lib/locales/ja/book.yml +7 -0
  42. data/lib/locales/ja/coffee.yml +4 -0
  43. data/lib/locales/ja/color.yml +4 -0
  44. data/lib/locales/ja/commerce.yml +11 -0
  45. data/lib/locales/ja/company.yml +8 -0
  46. data/lib/locales/ja/creature.yml +9 -0
  47. data/lib/locales/ja/food.yml +4 -0
  48. data/lib/locales/ja/games.yml +18 -0
  49. data/lib/locales/ja/gender.yml +4 -0
  50. data/lib/locales/ja/lorem.yml +9 -0
  51. data/lib/locales/ja/name.yml +13 -0
  52. data/lib/locales/ja/phone_number.yml +7 -0
  53. data/lib/locales/ja/restaurant.yml +11 -0
  54. data/lib/locales/ja/space.yml +5 -0
  55. data/lib/locales/ja/subscription.yml +8 -0
  56. data/lib/locales/ja/university.yml +9 -0
  57. data/lib/locales/pt-BR.yml +1 -0
  58. data/lib/locales/ru.yml +39 -0
  59. metadata +51 -9
  60. data/lib/locales/ja.yml +0 -118
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 057f887ea424391e1a5e3c354c93435061ed58b21e6d96c8406a3caa2c53a114
4
- data.tar.gz: 5c33ffaafb3374a76feaab9f83f03e3815e1fa5503b4aeddd40726a2fc3f5d41
3
+ metadata.gz: 63b04695b287869aee9ea8503c280ede5b543846bb5d6f38fd1d6c2bf8d1707e
4
+ data.tar.gz: bf39a485241db013ec375bb11fae3b1206f5ae04852dad927cd6b091ac0552de
5
5
  SHA512:
6
- metadata.gz: d117b98af058311ad015475303910e4d0761119eb171d544760d3687fb8b2eb8ffe791c44d39db1bd5244260fb8ca04f8e19923fdb1edee4dc4876b44388bf5e
7
- data.tar.gz: cbf27dfec7b156d23eabb2136b2a265baee51b7673e8ae1ff063310fbfdc57402558574d94648ee764ba8ecc1ed732704ddfec70ec6118eaf4fb1b536cb5c039
6
+ metadata.gz: a9235021f0b2e12df7c56acf2ba17365ae423468f437359a594598757190fc0117efa6cb1c930feaa1dc7971983d0d99e7c0d258a6f4d4274e410e08b52b0195
7
+ data.tar.gz: 7e8c8f03e08e172623084fc0c4784c90f0d083f36886899155335f7de09fd9461427b8daedd88637fba8c42c37389bb680d3e578eace5b450e743f3bbb70740c
data/CHANGELOG.md CHANGED
@@ -1,6 +1,55 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.17.0](https://github.com/faker-ruby/faker/tree/v2.17.0) (2020-03-10)
3
+ ## [v2.18.0](https://github.com/faker-ruby/faker/tree/v2.18.0) (2021-05-15)
4
+
5
+ ## Bug/Fixes
6
+
7
+ - [PR #2300](https://github.com/faker-ruby/faker/pull/2300) Fix space.company by adding missing quote [@koic](https://github.com/koic)
8
+ - [PR #2044](https://github.com/faker-ruby/faker/pull/2044) Workaround for cc-test-reporter with SimpleCov 0.18 [@koic](https://github.com/koic)
9
+
10
+ ## Chores
11
+
12
+ - [PR #2316](https://github.com/faker-ruby/faker/pull/2316) Fix typo in test method [@yujideveloper](https://github.com/yujideveloper)
13
+
14
+ ## Documentation
15
+
16
+ - [PR #2290](https://github.com/faker-ruby/faker/pull/2290) Fix typo [@d-holbach](https://github.com/d-holbach)
17
+ - [PR #2282](https://github.com/faker-ruby/faker/pull/2282) fixed small typo [@koic](https://github.com/koic)
18
+
19
+ ## Feature Request
20
+
21
+ - [PR #2301](https://github.com/faker-ruby/faker/pull/2301) Add Faker::IDNumber.croatian_id method [@lovro-bikic](https://github.com/lovro-bikic)
22
+ - [PR #2299](https://github.com/faker-ruby/faker/pull/2299) Add birds [@brotherjack](https://github.com/brotherjack)
23
+ - [PR #2295](https://github.com/faker-ruby/faker/pull/2295) Add more methods to the Witcher class [@marcelobarreto](https://github.com/marcelobarreto)
24
+ - [PR #2289](https://github.com/faker-ruby/faker/pull/2289) Increase french entropy [@meuble](https://github.com/meuble)
25
+ - [PR #2287](https://github.com/faker-ruby/faker/pull/2287) Add Crypto.sha512 [@crondaemon](https://github.com/crondaemon)
26
+ - [PR #2190](https://github.com/faker-ruby/faker/pull/2190) Add Faker::Tea [@snood1205](https://github.com/snood1205)
27
+ - [PR #2175](https://github.com/faker-ruby/faker/pull/2175) Add two generators to Faker::Science [@RubyHuntsman](https://github.com/RubyHuntsman)
28
+ - [PR #1910](https://github.com/faker-ruby/faker/pull/1910) Add Faker::Music#mambo_no_5, a Generator for Random First Names that Appear in Lou Bega's Mambo No. 5 [@NickyEXE](https://github.com/NickyEXE)
29
+
30
+ ## Update locales
31
+
32
+ - [PR #2321](https://github.com/faker-ruby/faker/pull/2321) Canadian area code 226 included in array of US area codes [@jgarber623](https://github.com/jgarber623)
33
+ - [PR #2317](https://github.com/faker-ruby/faker/pull/2317) Fix ci for es-AR [@yujideveloper](https://github.com/yujideveloper)
34
+ - [PR #2315](https://github.com/faker-ruby/faker/pull/2315) Split JA translation file into one file per class [@yujideveloper](https://github.com/yujideveloper)
35
+ - [PR #2313](https://github.com/faker-ruby/faker/pull/2313) Add Japanese translation for Faker::Subscription [@yujideveloper](https://github.com/yujideveloper)
36
+ - [PR #2311](https://github.com/faker-ruby/faker/pull/2311) add yoda quotes to russian locale [@aka-nez](https://github.com/aka-nez)
37
+ - [PR #2297](https://github.com/faker-ruby/faker/pull/2297) add Japanese actual zipcodes in locals/ja.yml [@POPPIN-FUMI](https://github.com/POPPIN-FUMI)
38
+ - [PR #2291](https://github.com/faker-ruby/faker/pull/2291) Add Commerce for Japanese [@ima1zumi](https://github.com/ima1zumi)
39
+ - [PR #2285](https://github.com/faker-ruby/faker/pull/2285) Fix update Brazilian phone country code [@ricardopacheco](https://github.com/ricardopacheco)
40
+ - [PR #2154](https://github.com/faker-ruby/faker/pull/2154) Cleanup books. Add Fantasy::Tolkien to README. [@mathisto](https://github.com/mathisto)
41
+
42
+ ## Update local dependencies
43
+
44
+ - Update rubocop requirement from = 1.13.0 to = 1.14.0 (#2314)
45
+ - Upgrade to GitHub-native Dependabot (#2310)
46
+ - Update rubocop requirement from = 1.12.1 to = 1.13.0 (#2305)
47
+ - Update test-unit requirement from = 3.4.0 to = 3.4.1 (#2303)
48
+ - Update pry requirement from = 0.14.0 to = 0.14.1 (#2298)
49
+ - Update rubocop requirement from = 1.12.0 to = 1.12.1 (#2294)
50
+ - Update rubocop requirement from = 1.11.0 to = 1.12.0 (#2288)
51
+
52
+ ## [v2.17.0](https://github.com/faker-ruby/faker/tree/v2.17.0) (2021-03-10)
4
53
 
5
54
  ## Chores
6
55
 
@@ -30,7 +79,7 @@
30
79
 
31
80
  ------------------------------------------------------------------------------
32
81
 
33
- ## [v2.16.0](https://github.com/faker-ruby/faker/tree/v2.16.0) (2020-02-09)
82
+ ## [v2.16.0](https://github.com/faker-ruby/faker/tree/v2.16.0) (2021-02-09)
34
83
 
35
84
  ## Chores
36
85
 
data/README.md CHANGED
@@ -27,6 +27,7 @@ development.
27
27
  - [Default](#default)
28
28
  - [Blockchain](#blockchain)
29
29
  - [Books](#books)
30
+ - [Fantasy](#fantasy)
30
31
  - [Creature](#creature)
31
32
  - [Games](#games)
32
33
  - [Japanese Media](#japanese-media)
@@ -206,6 +207,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
206
207
  - [Faker::Stripe](doc/default/stripe.md)
207
208
  - [Faker::Subscription](doc/default/subscription.md)
208
209
  - [Faker::Superhero](doc/default/superhero.md)
210
+ - [Faker::Tea](doc/default/tea.md)
209
211
  - [Faker::Team](doc/default/team.md)
210
212
  - [Faker::Time](doc/default/time.md)
211
213
  - [Faker::Twitter](doc/default/twitter.md)
@@ -227,8 +229,12 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
227
229
  - [Faker::Books::Dune](doc/books/dune.md)
228
230
  - [Faker::Books::Lovecraft](doc/books/lovecraft.md)
229
231
 
232
+ ### Fantasy
233
+ - [Faker::Fantasy::Tolkien](doc/fantasy/tolkien.md)
234
+
230
235
  ### Creature
231
236
  - [Faker::Creature::Animal](doc/creature/animal.md)
237
+ - [Faker::Creature::Bird](doc/creature/bird.md)
232
238
  - [Faker::Creature::Cat](doc/creature/cat.md)
233
239
  - [Faker::Creature::Dog](doc/creature/dog.md)
234
240
  - [Faker::Creature::Horse](doc/creature/horse.md)
@@ -285,7 +291,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
285
291
  ### Music
286
292
  - [Faker::Music](doc/music/music.md)
287
293
  - [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
288
- - [Faker::Music::HipHop](doc/music/hiphop.md)
294
+ - [Faker::Music::Hiphop](doc/music/hiphop.md)
289
295
  - [Faker::Music::Opera](doc/music/opera.md)
290
296
  - [Faker::Music::PearlJam](doc/music/pearl_jam.md)
291
297
  - [Faker::Music::Phish](doc/music/phish.md)
@@ -0,0 +1,203 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faker
4
+ class Creature
5
+ class Bird < Base
6
+ flexible :bird
7
+
8
+ class << self
9
+ ##
10
+ # Produces a random common family name of a bird.
11
+ #
12
+ # @return [String]
13
+ #
14
+ # @example
15
+ # Faker::Creature::Bird.common_family_name #=> "Owls"
16
+ #
17
+ # @faker.version next
18
+ def common_family_name
19
+ fetch('creature.bird.common_family_name')
20
+ end
21
+
22
+ ##
23
+ # Produces a random common taxonomic order from the class Aves
24
+ #
25
+ # @return [String]
26
+ #
27
+ # @example
28
+ # Faker::Creature::Bird.order #=> "Passeriformes"
29
+ #
30
+ # @faker.version next
31
+ def order
32
+ orders = I18n.translate('faker.creature.bird.order_common_map').keys
33
+ sample(orders).to_s
34
+ end
35
+
36
+ ##
37
+ # Produces a random bird anatomy word
38
+ #
39
+ # @return [String]
40
+ #
41
+ # @example
42
+ # Faker::Creature::Bird.anatomy #=> "rump"
43
+ #
44
+ # @faker.version next
45
+ def anatomy
46
+ fetch('creature.bird.anatomy')
47
+ end
48
+
49
+ ##
50
+ # Produces a random, past tensed bird anatomy word
51
+ #
52
+ # @return [String]
53
+ #
54
+ # @example
55
+ # Faker::Creature::Bird.anatomy #=> "breasted"
56
+ #
57
+ # @faker.version next
58
+ def anatomy_past_tense
59
+ fetch('creature.bird.anatomy_past_tense')
60
+ end
61
+
62
+ ##
63
+ # Produces a random geographical word used in describing birds
64
+ #
65
+ # @return [String]
66
+ #
67
+ # @example
68
+ # Faker::Creature::Bird.geo #=> "Eurasian"
69
+ #
70
+ # @faker.version next
71
+ def geo
72
+ fetch('creature.bird.geo')
73
+ end
74
+
75
+ ##
76
+ # Produces a random color word used in describing birds
77
+ #
78
+ # @return [String]
79
+ #
80
+ # @example
81
+ # Faker::Creature::Bird.color #=> "ferruginous"
82
+ #
83
+ # @faker.version next
84
+ def color
85
+ fetch('creature.bird.colors')
86
+ end
87
+
88
+ ##
89
+ # Produces a random adjective used to described birds
90
+ #
91
+ # @return [String]
92
+ #
93
+ # @example
94
+ # Faker::Creature::Bird.adjective #=> 'common'
95
+ #
96
+ # @faker.version next
97
+ def adjective
98
+ fetch('creature.bird.adjectives')
99
+ end
100
+
101
+ ##
102
+ # Produces a random emotional adjective NOT used to described birds
103
+ # ...but could be
104
+ #
105
+ # @return [String]
106
+ #
107
+ # @example
108
+ # Faker::Creature::Bird.emotional_adjective #=> 'cantankerous'
109
+ #
110
+ # @faker.version next
111
+ def emotional_adjective
112
+ fetch('creature.bird.emotional_adjectives')
113
+ end
114
+
115
+ ##
116
+ # Produces a random adjective NOT used to described birds
117
+ # ...but probably shouldn't
118
+ #
119
+ # @return [String]
120
+ #
121
+ # @example
122
+ # Faker::Creature::Bird.silly_adjective #=> 'drunk'
123
+ #
124
+ # @faker.version next
125
+ def silly_adjective
126
+ fetch('creature.bird.silly_adjectives')
127
+ end
128
+
129
+ ##
130
+ # Produces a random common name for a bird
131
+ #
132
+ # @param [String | Symbol | nil] tax_order Tax
133
+ # @return [String]
134
+ # @raises TypeError If `tax_order` cannot be converted into a Symbol
135
+ # @raises ArgumentError If `tax_order` is not a valid taxonomic order
136
+ #
137
+ # @example
138
+ # Faker::Creature::Bird.common_name #=> 'wren'
139
+ #
140
+ # @faker.version next
141
+ def common_name(tax_order = nil)
142
+ map = translate('faker.creature.bird.order_common_map')
143
+ if tax_order.nil?
144
+ sample(map.values.flatten).downcase
145
+ else
146
+ raise TypeError, 'tax_order parameter must be symbolizable' \
147
+ unless tax_order.respond_to?(:to_sym)
148
+ raise ArgumentError, "#{tax_order} is not a valid taxonomic order" \
149
+ unless map.keys.include?(tax_order.to_sym)
150
+
151
+ the_order = translate('faker.creature.bird.order_common_map')[tax_order.to_sym]
152
+ sample(the_order).downcase
153
+ end
154
+ end
155
+
156
+ ##
157
+ # Produces a random and plausible common name for a bird
158
+ #
159
+ # @return [String]
160
+ #
161
+ # @example
162
+ # Faker::Creature::Bird.plausible_common_name #=> 'Hellinger's Wren'
163
+ #
164
+ # @faker.version next
165
+ def plausible_common_name
166
+ parse('creature.bird.plausible_common_names').capitalize
167
+ end
168
+
169
+ ##
170
+ # Produces a random and IMplausible common name for a bird
171
+ #
172
+ # @return [String]
173
+ #
174
+ # @example
175
+ # Faker::Creature::Bird.implausible_common_name #=> 'Hellinger's Cantankerous Chickadee'
176
+ #
177
+ # @faker.version next
178
+ def implausible_common_name
179
+ parse('creature.bird.implausible_common_names').capitalize
180
+ end
181
+
182
+ ##
183
+ # Produces a hash entry with a random order and a random common name
184
+ # that is of that order
185
+ #
186
+ # @return [Hash<order,common_name>]
187
+ #
188
+ # @example
189
+ # Faker::Creature::Bird.order_with_common_name #=> {
190
+ # order: ''Accipitriformes',
191
+ # common_name: 'Osprey'
192
+ # }
193
+ #
194
+ # @faker.version next
195
+ def order_with_common_name(tax_order = nil)
196
+ map = I18n.translate('faker.creature.bird.order_common_map')
197
+ o = tax_order.nil? ? order : tax_order
198
+ { order: o, common_name: sample(map[o.to_sym]) }
199
+ end
200
+ end
201
+ end
202
+ end
203
+ end
@@ -61,7 +61,7 @@ module Faker
61
61
  case base
62
62
  when 8 then generate_base8_ean
63
63
  when 13 then generate_base13_ean
64
- else raise ArgumentError, 'base must be 3 or 13'
64
+ else raise ArgumentError, 'base must be 8 or 13'
65
65
  end
66
66
  end
67
67
 
@@ -43,6 +43,19 @@ module Faker
43
43
  def sha256
44
44
  OpenSSL::Digest::SHA256.hexdigest(Lorem.characters)
45
45
  end
46
+
47
+ ##
48
+ # Produces a SHA512 hash.
49
+ #
50
+ # @return [String]
51
+ #
52
+ # @example
53
+ # Faker::Crypto.sha512 #=> "7b9fc82a6642874833d01b74a7b4fae3d15373193b55cfba47327f8f0afdc8d0ea155b58639a03a887009ef997dab8dd8d36767620d430f6e787e5996e26da80"
54
+ #
55
+ # @faker.version next
56
+ def sha512
57
+ OpenSSL::Digest::SHA512.hexdigest(Lorem.characters)
58
+ end
46
59
  end
47
60
  end
48
61
  end
@@ -200,8 +200,42 @@ module Faker
200
200
  "#{digits}-#{verification_code}"
201
201
  end
202
202
 
203
+ ##
204
+ # Produces a random Croatian ID number (OIB).
205
+ #
206
+ # @param international [Boolean] Specifies whether to add international prefix.
207
+ # @return [String]
208
+ #
209
+ # @example
210
+ # Faker::IDNumber.croatian_id #=> "88467617508"
211
+ # Faker::IDNumber.croatian_id(international: true) #=> "HR88467617508"
212
+ #
213
+ # @faker.version next
214
+ def croatian_id(international: false)
215
+ prefix = international ? 'HR' : ''
216
+ digits = Faker::Number.number(digits: 10).to_s
217
+ checksum_digit = croatian_id_checksum_digit(digits)
218
+
219
+ "#{prefix}#{digits}#{checksum_digit}"
220
+ end
221
+
203
222
  private
204
223
 
224
+ def croatian_id_checksum_digit(digits)
225
+ control_sum = 10
226
+
227
+ digits.chars.map(&:to_i).each do |digit|
228
+ control_sum += digit
229
+ control_sum %= 10
230
+ control_sum = 10 if control_sum.zero?
231
+ control_sum *= 2
232
+ control_sum %= 11
233
+ end
234
+
235
+ control_sum = 11 - control_sum
236
+ control_sum % 10
237
+ end
238
+
205
239
  def chilean_verification_code(digits)
206
240
  # First digit is multiplied by 3, second by 2, and so on
207
241
  multiplication_rule = [3, 2, 7, 6, 5, 4, 3, 2]
@@ -29,6 +29,32 @@ module Faker
29
29
  fetch('science.element_symbol')
30
30
  end
31
31
 
32
+ ##
33
+ # Produces the state of an element.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::Science.element_state #=> "Liquid"
39
+ #
40
+ # @faker.version next
41
+ def element_state
42
+ fetch('science.element_state')
43
+ end
44
+
45
+ ##
46
+ # Produces the subcategory of an element.
47
+ #
48
+ # @return [String]
49
+ #
50
+ # @example
51
+ # Faker::Science.element_subcategory #=> "Reactive nonmetal"
52
+ #
53
+ # @faker.version next
54
+ def element_subcategory
55
+ fetch('science.element_subcategory')
56
+ end
57
+
32
58
  ##
33
59
  # Produces the name of a scientist.
34
60
  #
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faker
4
+ class Tea < Base
5
+ flexible :tea
6
+
7
+ class << self
8
+ ##
9
+ # Produces a random variety or blend of tea.
10
+ #
11
+ # @param type [String, nil] the type of tea to query for (valid types: 'Black', 'Green', 'Oolong', 'White', and 'Herbal')
12
+ # @return [String] a variety of tea
13
+ #
14
+ # @example
15
+ # Faker::Tea.variety
16
+ # #=> "Earl Grey"
17
+ #
18
+ # @example
19
+ # Faker::Tea.variety(type: 'Green')
20
+ # #=> "Jasmine"
21
+ # @faker.version next
22
+ def variety(type: nil)
23
+ type ||= fetch('tea.type')
24
+ fetch "tea.variety.#{type.downcase}"
25
+ end
26
+
27
+ ##
28
+ # Produces a random type of tea.
29
+ #
30
+ # @return [String] a type of tea
31
+ #
32
+ # @example
33
+ # Faker::Tea.type
34
+ # #=> "Green"
35
+ # @faker.version next
36
+ def type
37
+ fetch 'tea.type'
38
+ end
39
+ end
40
+ end
41
+ end