faker 2.19.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +346 -7
  3. data/History.md +1 -1
  4. data/README.md +198 -104
  5. data/lib/faker/blockchain/aeternity.rb +1 -1
  6. data/lib/faker/blockchain/ethereum.rb +1 -1
  7. data/lib/faker/blockchain/tezos.rb +1 -1
  8. data/lib/faker/books/dune.rb +2 -10
  9. data/lib/faker/books/lovecraft.rb +7 -38
  10. data/lib/faker/books/the_kingkiller_chronicle.rb +61 -0
  11. data/lib/faker/default/address.rb +5 -25
  12. data/lib/faker/default/alphanumeric.rb +2 -8
  13. data/lib/faker/default/app.rb +1 -10
  14. data/lib/faker/default/avatar.rb +1 -12
  15. data/lib/faker/default/bank.rb +9 -17
  16. data/lib/faker/default/boolean.rb +1 -4
  17. data/lib/faker/default/chile_rut.rb +8 -14
  18. data/lib/faker/default/code.rb +11 -24
  19. data/lib/faker/default/color.rb +77 -6
  20. data/lib/faker/default/commerce.rb +3 -17
  21. data/lib/faker/default/company.rb +23 -20
  22. data/lib/faker/default/crypto_coin.rb +3 -15
  23. data/lib/faker/default/date.rb +5 -38
  24. data/lib/faker/default/demographic.rb +1 -5
  25. data/lib/faker/default/driving_licence.rb +1 -11
  26. data/lib/faker/default/drone.rb +1 -1
  27. data/lib/faker/default/file.rb +5 -24
  28. data/lib/faker/default/finance.rb +17 -7
  29. data/lib/faker/default/food.rb +14 -1
  30. data/lib/faker/default/hipster.rb +6 -45
  31. data/lib/faker/default/id_number.rb +108 -11
  32. data/lib/faker/default/internet.rb +168 -129
  33. data/lib/faker/default/invoice.rb +4 -17
  34. data/lib/faker/default/json.rb +2 -20
  35. data/lib/faker/default/lorem.rb +20 -76
  36. data/lib/faker/default/lorem_flickr.rb +4 -32
  37. data/lib/faker/default/markdown.rb +6 -11
  38. data/lib/faker/default/marketing.rb +1 -1
  39. data/lib/faker/default/measurement.rb +16 -48
  40. data/lib/faker/default/name.rb +1 -5
  41. data/lib/faker/default/nation.rb +0 -3
  42. data/lib/faker/default/nhs.rb +2 -6
  43. data/lib/faker/default/number.rb +10 -55
  44. data/lib/faker/default/omniauth.rb +51 -41
  45. data/lib/faker/default/phone_number.rb +2 -6
  46. data/lib/faker/default/placeholdit.rb +1 -12
  47. data/lib/faker/default/relationship.rb +1 -5
  48. data/lib/faker/default/religion.rb +6 -0
  49. data/lib/faker/default/source.rb +3 -16
  50. data/lib/faker/default/string.rb +1 -8
  51. data/lib/faker/default/stripe.rb +4 -20
  52. data/lib/faker/default/time.rb +4 -34
  53. data/lib/faker/default/twitter.rb +7 -23
  54. data/lib/faker/default/types.rb +5 -27
  55. data/lib/faker/default/vehicle.rb +29 -51
  56. data/lib/faker/default/vulnerability_identifier.rb +23 -0
  57. data/lib/faker/default/world_cup.rb +2 -11
  58. data/lib/faker/games/clash_of_clans.rb +1 -1
  59. data/lib/faker/games/dnd.rb +49 -7
  60. data/lib/faker/games/dota.rb +1 -5
  61. data/lib/faker/games/minecraft.rb +1 -1
  62. data/lib/faker/games/myst.rb +1 -1
  63. data/lib/faker/games/tarkov.rb +205 -0
  64. data/lib/faker/japanese_media/cowboy_bebop.rb +61 -0
  65. data/lib/faker/japanese_media/fullmetal_alchemist_brotherhood.rb +48 -0
  66. data/lib/faker/japanese_media/kamen_rider.rb +102 -0
  67. data/lib/faker/japanese_media/one_piece.rb +1 -1
  68. data/lib/faker/movies/avatar.rb +49 -0
  69. data/lib/faker/movies/hackers.rb +48 -0
  70. data/lib/faker/movies/star_wars.rb +1 -5
  71. data/lib/faker/movies/tron.rb +161 -0
  72. data/lib/faker/quotes/quote.rb +13 -0
  73. data/lib/faker/religion/bible.rb +50 -0
  74. data/lib/faker/sports/chess.rb +90 -0
  75. data/lib/faker/sports/mountaineering.rb +22 -0
  76. data/lib/faker/sports/sport.rb +116 -0
  77. data/lib/faker/travel/airport.rb +43 -0
  78. data/lib/faker/tv_shows/brooklyn_nine_nine.rb +38 -0
  79. data/lib/faker/tv_shows/michael_scott.rb +0 -3
  80. data/lib/faker/tv_shows/spongebob.rb +50 -0
  81. data/lib/faker/version.rb +1 -1
  82. data/lib/faker.rb +15 -64
  83. data/lib/helpers/base58.rb +1 -1
  84. data/lib/helpers/unique_generator.rb +13 -11
  85. data/lib/locales/ar.yml +6 -1
  86. data/lib/locales/bg.yml +1 -1
  87. data/lib/locales/da-DK.yml +1 -1
  88. data/lib/locales/de-AT.yml +3 -4
  89. data/lib/locales/de-CH.yml +1 -1
  90. data/lib/locales/de.yml +1 -1
  91. data/lib/locales/en/address.yml +2 -3
  92. data/lib/locales/en/airport.yml +381 -0
  93. data/lib/locales/en/australia.yml +3 -4
  94. data/lib/locales/en/avatar.yml +31 -0
  95. data/lib/locales/en/bible.yml +90 -0
  96. data/lib/locales/en/brooklyn_nine_nine.yml +35 -0
  97. data/lib/locales/en/cat.yml +1 -1
  98. data/lib/locales/en/chess.yml +103 -0
  99. data/lib/locales/en/coffee.yml +1 -1
  100. data/lib/locales/en/company.yml +1 -0
  101. data/lib/locales/en/computer.yml +23 -4
  102. data/lib/locales/en/cowboy_bebop.yml +163 -0
  103. data/lib/locales/en/dnd.yml +186 -1
  104. data/lib/locales/en/dota.yml +113 -0
  105. data/lib/locales/en/file.yml +9 -1
  106. data/lib/locales/en/finance.yml +3 -1
  107. data/lib/locales/en/fma_brotherhood.yml +78 -0
  108. data/lib/locales/en/food.yml +12 -0
  109. data/lib/locales/en/game.yml +11 -0
  110. data/lib/locales/en/hackers.yml +53 -0
  111. data/lib/locales/en/heroes.yml +2 -2
  112. data/lib/locales/en/internet.yml +140 -3
  113. data/lib/locales/en/kamen_rider.yml +452 -0
  114. data/lib/locales/en/mitch_hedberg.yml +46 -0
  115. data/lib/locales/en/mountain.yml +14 -1
  116. data/lib/locales/en/mountaineering.yml +14 -0
  117. data/lib/locales/en/movie.yml +2 -1
  118. data/lib/locales/en/naruto.yml +2 -3
  119. data/lib/locales/en/one_piece.yml +1 -1
  120. data/lib/locales/en/opera.yml +1 -1
  121. data/lib/locales/en/overwatch.yml +5 -7
  122. data/lib/locales/en/source.yml +5 -0
  123. data/lib/locales/en/spongebob.yml +489 -0
  124. data/lib/locales/en/sport.yml +130 -0
  125. data/lib/locales/en/star_wars.yml +1 -1
  126. data/lib/locales/en/stranger_thing.yml +1 -1
  127. data/lib/locales/en/super_smash_bros.yml +2 -0
  128. data/lib/locales/en/tarkov.yml +593 -0
  129. data/lib/locales/en/the_kingkiller_chronicle.yml +56 -0
  130. data/lib/locales/en/tron.yml +227 -0
  131. data/lib/locales/en/vehicle.yml +2809 -75
  132. data/lib/locales/en-AU.yml +2 -2
  133. data/lib/locales/en-CA.yml +2 -1
  134. data/lib/locales/en-GB.yml +2 -1
  135. data/lib/locales/en-MS.yml +1 -0
  136. data/lib/locales/en-NG.yml +1 -0
  137. data/lib/locales/en-NZ.yml +1 -0
  138. data/lib/locales/en-PAK.yml +1 -0
  139. data/lib/locales/en-SG.yml +1 -0
  140. data/lib/locales/en-UG.yml +1 -0
  141. data/lib/locales/en-US.yml +2 -2
  142. data/lib/locales/en-ZA.yml +1 -1
  143. data/lib/locales/en-au-ocker.yml +2 -0
  144. data/lib/locales/es-AR.yml +3 -2
  145. data/lib/locales/es-MX.yml +1 -1
  146. data/lib/locales/es.yml +2 -2
  147. data/lib/locales/fi-FI.yml +3 -1
  148. data/lib/locales/fr/address.yml +0 -1
  149. data/lib/locales/fr/adjective.yml +266 -0
  150. data/lib/locales/fr/ancient.yml +141 -0
  151. data/lib/locales/fr-CA.yml +1 -1
  152. data/lib/locales/fr-CH.yml +1 -1
  153. data/lib/locales/hy.yml +2 -1
  154. data/lib/locales/it.yml +1 -0
  155. data/lib/locales/ja/address.yml +258 -4169
  156. data/lib/locales/ja/adjective.yml +148 -0
  157. data/lib/locales/ja/dog.yml +1 -0
  158. data/lib/locales/ja/emotion.yml +51 -0
  159. data/lib/locales/ja/lorem.yml +2 -2
  160. data/lib/locales/ja/naruto.yml +230 -0
  161. data/lib/locales/ja/relationship.yml +10 -0
  162. data/lib/locales/ja/super_mario.yml +1 -1
  163. data/lib/locales/ja/super_smash_bros.yml +8 -0
  164. data/lib/locales/ko.yml +1 -0
  165. data/lib/locales/lt.yml +34 -0
  166. data/lib/locales/lv.yml +1 -1
  167. data/lib/locales/mi-NZ.yml +283 -0
  168. data/lib/locales/nb-NO.yml +1 -0
  169. data/lib/locales/nl.yml +1 -0
  170. data/lib/locales/pl.yml +2 -2
  171. data/lib/locales/pt-BR.yml +5 -0
  172. data/lib/locales/pt.yml +1 -1
  173. data/lib/locales/ru.yml +1 -0
  174. data/lib/locales/sk.yml +1 -0
  175. data/lib/locales/sv.yml +1 -0
  176. data/lib/locales/th.yml +76 -76
  177. data/lib/locales/tr.yml +1 -0
  178. data/lib/locales/uk.yml +1 -0
  179. data/lib/locales/vi.yml +1 -0
  180. data/lib/locales/zh-CN.yml +1 -0
  181. data/lib/locales/zh-TW.yml +1 -0
  182. metadata +96 -33
  183. data/lib/faker/default/fillmurray.rb +0 -45
  184. data/lib/faker/default/lorem_pixel.rb +0 -70
  185. /data/lib/faker/default/{faker_adjective.rb → adjective.rb} +0 -0
@@ -13,11 +13,7 @@ module Faker
13
13
  # Faker::Number.number(digits: 10) #=> 1968353479
14
14
  #
15
15
  # @faker.version 1.0.0
16
- def number(legacy_digits = NOT_GIVEN, digits: 10)
17
- warn_for_deprecated_arguments do |keywords|
18
- keywords << :digits if legacy_digits != NOT_GIVEN
19
- end
20
-
16
+ def number(digits: 10)
21
17
  return if digits < 1
22
18
  return rand(0..9).round if digits == 1
23
19
 
@@ -35,11 +31,7 @@ module Faker
35
31
  # Faker::Number.leading_zero_number(digits: 10) #=> "0669336915"
36
32
  #
37
33
  # @faker.version 1.0.0
38
- def leading_zero_number(legacy_digits = NOT_GIVEN, digits: 10)
39
- warn_for_deprecated_arguments do |keywords|
40
- keywords << :digits if legacy_digits != NOT_GIVEN
41
- end
42
-
34
+ def leading_zero_number(digits: 10)
43
35
  "0#{(2..digits).collect { digit }.join}"
44
36
  end
45
37
 
@@ -53,11 +45,7 @@ module Faker
53
45
  # Faker::Number.decimal_part(digits: 2) #=> "09"
54
46
  #
55
47
  # @faker.version 1.0.0
56
- def decimal_part(legacy_digits = NOT_GIVEN, digits: 10)
57
- warn_for_deprecated_arguments do |keywords|
58
- keywords << :digits if legacy_digits != NOT_GIVEN
59
- end
60
-
48
+ def decimal_part(digits: 10)
61
49
  num = ''
62
50
  if digits > 1
63
51
  num = non_zero_digit
@@ -78,12 +66,7 @@ module Faker
78
66
  # Faker::Number.decimal(l_digits: 3, r_digits: 3) #=> 181.843
79
67
  #
80
68
  # @faker.version 1.0.0
81
- def decimal(legacy_l_digits = NOT_GIVEN, legacy_r_digits = NOT_GIVEN, l_digits: 5, r_digits: 2)
82
- warn_for_deprecated_arguments do |keywords|
83
- keywords << :l_digits if legacy_l_digits != NOT_GIVEN
84
- keywords << :r_digits if legacy_r_digits != NOT_GIVEN
85
- end
86
-
69
+ def decimal(l_digits: 5, r_digits: 2)
87
70
  l_d = number(digits: l_digits)
88
71
 
89
72
  # Ensure the last digit is not zero
@@ -129,11 +112,7 @@ module Faker
129
112
  # Faker::Number.hexadecimal(digits: 3) #=> "e74"
130
113
  #
131
114
  # @faker.version 1.0.0
132
- def hexadecimal(legacy_digits = NOT_GIVEN, digits: 6)
133
- warn_for_deprecated_arguments do |keywords|
134
- keywords << :digits if legacy_digits != NOT_GIVEN
135
- end
136
-
115
+ def hexadecimal(digits: 6)
137
116
  hex = ''
138
117
  digits.times { hex += rand(15).to_s(16) }
139
118
  hex
@@ -165,12 +144,7 @@ module Faker
165
144
  # Faker::Number.normal(mean: 50, standard_deviation: 3.5) #=> 47.14669604069156
166
145
  #
167
146
  # @faker.version 1.0.0
168
- def normal(legacy_mean = NOT_GIVEN, legacy_standard_deviation = NOT_GIVEN, mean: 1, standard_deviation: 1)
169
- warn_for_deprecated_arguments do |keywords|
170
- keywords << :mean if legacy_mean != NOT_GIVEN
171
- keywords << :standard_deviation if legacy_standard_deviation != NOT_GIVEN
172
- end
173
-
147
+ def normal(mean: 1, standard_deviation: 1)
174
148
  theta = 2 * Math::PI * rand
175
149
  rho = Math.sqrt(-2 * Math.log(1 - rand))
176
150
  scale = standard_deviation * rho
@@ -189,12 +163,7 @@ module Faker
189
163
  # Faker::Number.between(from: 0.0, to: 1.0) #=> 0.7844640543957383
190
164
  #
191
165
  # @faker.version 1.0.0
192
- def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
193
- warn_for_deprecated_arguments do |keywords|
194
- keywords << :from if legacy_from != NOT_GIVEN
195
- keywords << :to if legacy_to != NOT_GIVEN
196
- end
197
-
166
+ def between(from: 1.00, to: 5000.00)
198
167
  Faker::Base.rand_in_range(from, to)
199
168
  end
200
169
 
@@ -209,11 +178,7 @@ module Faker
209
178
  # Faker::Number.within(range: 0.0..1.0) #=> 0.7844640543957383
210
179
  #
211
180
  # @faker.version 1.0.0
212
- def within(legacy_range = NOT_GIVEN, range: 1.00..5000.00)
213
- warn_for_deprecated_arguments do |keywords|
214
- keywords << :range if legacy_range != NOT_GIVEN
215
- end
216
-
181
+ def within(range: 1.00..5000.00)
217
182
  between(from: range.min, to: range.max)
218
183
  end
219
184
 
@@ -228,12 +193,7 @@ module Faker
228
193
  # Faker::Number.positive #=> 235.59238499107653
229
194
  #
230
195
  # @faker.version 1.0.0
231
- def positive(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
232
- warn_for_deprecated_arguments do |keywords|
233
- keywords << :from if legacy_from != NOT_GIVEN
234
- keywords << :to if legacy_to != NOT_GIVEN
235
- end
236
-
196
+ def positive(from: 1.00, to: 5000.00)
237
197
  random_number = between(from: from, to: to)
238
198
 
239
199
  greater_than_zero(random_number)
@@ -250,12 +210,7 @@ module Faker
250
210
  # Faker::Number.negative #=> -4480.042585669558
251
211
  #
252
212
  # @faker.version 1.0.0
253
- def negative(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: -5000.00, to: -1.00)
254
- warn_for_deprecated_arguments do |keywords|
255
- keywords << :from if legacy_from != NOT_GIVEN
256
- keywords << :to if legacy_to != NOT_GIVEN
257
- end
258
-
213
+ def negative(from: -5000.00, to: -1.00)
259
214
  random_number = between(from: from, to: to)
260
215
 
261
216
  less_than_zero(random_number)
@@ -12,13 +12,11 @@ module Faker
12
12
  super()
13
13
 
14
14
  @name = name || "#{Name.first_name} #{Name.last_name}"
15
- @email = email || Internet.safe_email(name: self.name)
15
+ @email = email || Internet.email(name: self.name)
16
16
  @first_name, @last_name = self.name.split
17
17
  end
18
18
 
19
19
  class << self
20
- # rubocop:disable Metrics/ParameterLists
21
-
22
20
  ##
23
21
  # Generate a mock Omniauth response from Google.
24
22
  #
@@ -29,13 +27,7 @@ module Faker
29
27
  # @return [Hash] An auth hash in the format provided by omniauth-google.
30
28
  #
31
29
  # @faker.version 1.8.0
32
- def google(legacy_name = NOT_GIVEN, legacy_email = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, email: nil, uid: Number.number(digits: 9).to_s)
33
- warn_for_deprecated_arguments do |keywords|
34
- keywords << :name if legacy_name != NOT_GIVEN
35
- keywords << :email if legacy_email != NOT_GIVEN
36
- keywords << :uid if legacy_uid != NOT_GIVEN
37
- end
38
-
30
+ def google(name: nil, email: nil, uid: Number.number(digits: 9).to_s)
39
31
  auth = Omniauth.new(name: name, email: email)
40
32
  {
41
33
  provider: 'google_oauth2',
@@ -65,7 +57,7 @@ module Faker
65
57
  picture: image,
66
58
  gender: gender,
67
59
  birthday: Date.backward(days: 36_400).strftime('%Y-%m-%d'),
68
- local: 'en',
60
+ locale: 'en',
69
61
  hd: "#{Company.name.downcase}.com"
70
62
  },
71
63
  id_info: {
@@ -95,14 +87,7 @@ module Faker
95
87
  # @return [Hash] An auth hash in the format provided by omniauth-facebook.
96
88
  #
97
89
  # @faker.version 1.8.0
98
- def facebook(legacy_name = NOT_GIVEN, legacy_email = NOT_GIVEN, legacy_username = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, email: nil, username: nil, uid: Number.number(digits: 7).to_s)
99
- warn_for_deprecated_arguments do |keywords|
100
- keywords << :name if legacy_name != NOT_GIVEN
101
- keywords << :email if legacy_email != NOT_GIVEN
102
- keywords << :username if legacy_username != NOT_GIVEN
103
- keywords << :uid if legacy_uid != NOT_GIVEN
104
- end
105
-
90
+ def facebook(name: nil, email: nil, username: nil, uid: Number.number(digits: 7).to_s)
106
91
  auth = Omniauth.new(name: name, email: email)
107
92
  username ||= "#{auth.first_name.downcase[0]}#{auth.last_name.downcase}"
108
93
  {
@@ -154,13 +139,7 @@ module Faker
154
139
  # @return [Hash] An auth hash in the format provided by omniauth-twitter.
155
140
  #
156
141
  # @faker.version 1.8.0
157
- def twitter(legacy_name = NOT_GIVEN, legacy_nickname = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, nickname: nil, uid: Number.number(digits: 6).to_s)
158
- warn_for_deprecated_arguments do |keywords|
159
- keywords << :name if legacy_name != NOT_GIVEN
160
- keywords << :nickname if legacy_nickname != NOT_GIVEN
161
- keywords << :uid if legacy_uid != NOT_GIVEN
162
- end
163
-
142
+ def twitter(name: nil, nickname: nil, uid: Number.number(digits: 6).to_s)
164
143
  auth = Omniauth.new(name: name)
165
144
  nickname ||= auth.name.downcase.delete(' ')
166
145
  location = city_state
@@ -243,13 +222,7 @@ module Faker
243
222
  # @return [Hash] An auth hash in the format provided by omniauth-linkedin.
244
223
  #
245
224
  # @faker.version 1.8.0
246
- def linkedin(legacy_name = NOT_GIVEN, legacy_email = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, email: nil, uid: Number.number(digits: 6).to_s)
247
- warn_for_deprecated_arguments do |keywords|
248
- keywords << :name if legacy_name != NOT_GIVEN
249
- keywords << :email if legacy_email != NOT_GIVEN
250
- keywords << :uid if legacy_uid != NOT_GIVEN
251
- end
252
-
225
+ def linkedin(name: nil, email: nil, uid: Number.number(digits: 6).to_s)
253
226
  auth = Omniauth.new(name: name, email: email)
254
227
  first_name = auth.first_name.downcase
255
228
  last_name = auth.last_name.downcase
@@ -322,13 +295,7 @@ module Faker
322
295
  # @return [Hash] An auth hash in the format provided by omniauth-github.
323
296
  #
324
297
  # @faker.version 1.8.0
325
- def github(legacy_name = NOT_GIVEN, legacy_email = NOT_GIVEN, legacy_uid = NOT_GIVEN, name: nil, email: nil, uid: Number.number(digits: 8).to_s)
326
- warn_for_deprecated_arguments do |keywords|
327
- keywords << :name if legacy_name != NOT_GIVEN
328
- keywords << :email if legacy_email != NOT_GIVEN
329
- keywords << :uid if legacy_uid != NOT_GIVEN
330
- end
331
-
298
+ def github(name: nil, email: nil, uid: Number.number(digits: 8).to_s)
332
299
  auth = Omniauth.new(name: name, email: email)
333
300
  login = auth.name.downcase.tr(' ', '-')
334
301
  html_url = "https://github.com/#{login}"
@@ -385,7 +352,6 @@ module Faker
385
352
  }
386
353
  }
387
354
  end
388
- # rubocop:enable Metrics/ParameterLists
389
355
 
390
356
  ##
391
357
  # Generate a mock Omniauth response from Apple.
@@ -431,6 +397,50 @@ module Faker
431
397
  }
432
398
  end
433
399
 
400
+ ##
401
+ # Generate a mock Omniauth response from Auth0.
402
+ #
403
+ # @param name [String] A specific name to return in the response.
404
+ # @param email [String] A specific email to return in the response.
405
+ # @param uid [String] A specific UID to return in the response.
406
+ #
407
+ # @return [Hash] An auth hash in the format provided by omniauth-auth0.
408
+ #
409
+ # @faker.version next
410
+ def auth0(name: nil, email: nil, uid: nil)
411
+ uid ||= "auth0|#{Number.hexadecimal(digits: 24)}"
412
+ auth = Omniauth.new(name: name, email: email)
413
+ {
414
+ provider: 'auth0',
415
+ uid: uid,
416
+ info: {
417
+ name: uid,
418
+ nickname: auth.name,
419
+ email: auth.email,
420
+ image: image
421
+ },
422
+ credentials: {
423
+ expires_at: Time.forward.to_i,
424
+ expires: true,
425
+ token_type: 'Bearer',
426
+ id_token: Crypto.sha256,
427
+ token: Crypto.md5,
428
+ refresh_token: Crypto.md5
429
+ },
430
+ extra: {
431
+ raw_info: {
432
+ email: auth.email,
433
+ email_verified: true,
434
+ iss: 'https://auth0.com/',
435
+ sub: uid,
436
+ aud: 'Auth012345',
437
+ iat: Time.forward.to_i,
438
+ exp: Time.forward.to_i
439
+ }
440
+ }
441
+ }
442
+ end
443
+
434
444
  private
435
445
 
436
446
  def gender
@@ -114,7 +114,7 @@ module Faker
114
114
  ##
115
115
  # Produces a random US or Canada-based extension / subscriber number. Can be used for both extensions and last four digits of phone number.
116
116
  #
117
- # @param length [Integer] Speficies the length of the return value.
117
+ # @param length [Integer] Specifies the length of the return value.
118
118
  # @return [String]
119
119
  #
120
120
  # @example
@@ -123,11 +123,7 @@ module Faker
123
123
  # Faker::PhoneNumber.extension #=> "3764"
124
124
  #
125
125
  # @faker.version 1.3.0
126
- def subscriber_number(legacy_length = NOT_GIVEN, length: 4)
127
- warn_for_deprecated_arguments do |keywords|
128
- keywords << :length if legacy_length != NOT_GIVEN
129
- end
130
-
126
+ def subscriber_number(length: 4)
131
127
  rand.to_s[2..(1 + length)]
132
128
  end
133
129
 
@@ -5,8 +5,6 @@ module Faker
5
5
  class << self
6
6
  SUPPORTED_FORMATS = %w[png jpg gif jpeg].freeze
7
7
 
8
- # rubocop:disable Metrics/ParameterLists
9
-
10
8
  ##
11
9
  # Produces a random placeholder image from https://via.placeholder.com.
12
10
  #
@@ -28,15 +26,7 @@ module Faker
28
26
  # Faker::Placeholdit.image(size: '50x50', format: 'jpg', background_color: 'ffffff', text_color: '000', text: 'Some Custom Text') #=> "https://via.placeholder.com/50x50.jpg/ffffff/000?text=Some Custom Text"
29
27
  #
30
28
  # @faker.version 1.6.0
31
- def image(legacy_size = NOT_GIVEN, legacy_format = NOT_GIVEN, legacy_background_color = NOT_GIVEN, legacy_text_color = NOT_GIVEN, legacy_text = NOT_GIVEN, size: '300x300', format: 'png', background_color: nil, text_color: nil, text: nil)
32
- warn_for_deprecated_arguments do |keywords|
33
- keywords << :size if legacy_size != NOT_GIVEN
34
- keywords << :format if legacy_format != NOT_GIVEN
35
- keywords << :background_color if legacy_background_color != NOT_GIVEN
36
- keywords << :text_color if legacy_text_color != NOT_GIVEN
37
- keywords << :text if legacy_text != NOT_GIVEN
38
- end
39
-
29
+ def image(size: '300x300', format: 'png', background_color: nil, text_color: nil, text: nil)
40
30
  background_color = generate_color if background_color == :random
41
31
  text_color = generate_color if text_color == :random
42
32
 
@@ -51,7 +41,6 @@ module Faker
51
41
  image_url += "?text=#{text}" if text
52
42
  image_url
53
43
  end
54
- # rubocop:enable Metrics/ParameterLists
55
44
 
56
45
  private
57
46
 
@@ -14,11 +14,7 @@ module Faker
14
14
  # Faker::Relationship.familial #=> "Grandfather"
15
15
  #
16
16
  # @faker.version 1.9.2
17
- def familial(legacy_connection = NOT_GIVEN, connection: nil)
18
- warn_for_deprecated_arguments do |keywords|
19
- keywords << :connection if legacy_connection != NOT_GIVEN
20
- end
21
-
17
+ def familial(connection: nil)
22
18
  familial_connections = translate('faker.relationship.familial').keys
23
19
 
24
20
  if connection.nil?
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Faker
4
+ module Religion
5
+ end
6
+ end
@@ -17,11 +17,7 @@ module Faker
17
17
  # #=> "alert('Hello World!');"
18
18
  #
19
19
  # @faker.version 1.9.0
20
- def hello_world(legacy_lang = NOT_GIVEN, lang: :ruby)
21
- warn_for_deprecated_arguments do |keywords|
22
- keywords << :lang if legacy_lang != NOT_GIVEN
23
- end
24
-
20
+ def hello_world(lang: :ruby)
25
21
  fetch("source.hello_world.#{lang}")
26
22
  end
27
23
 
@@ -39,13 +35,7 @@ module Faker
39
35
  # #=> "console.log('foo bar');"
40
36
  #
41
37
  # @faker.version 1.9.0
42
- def print(legacy_str = NOT_GIVEN, legacy_lang = NOT_GIVEN, str: 'some string', lang: :ruby)
43
- warn_for_deprecated_arguments do |keywords|
44
- keywords << :str if legacy_str != NOT_GIVEN
45
- end
46
- warn_for_deprecated_arguments do |keywords|
47
- keywords << :lang if legacy_lang != NOT_GIVEN
48
- end
38
+ def print(str: 'some string', lang: :ruby)
49
39
  code = fetch("source.print.#{lang}")
50
40
  code.gsub('faker_string_to_print', str)
51
41
  end
@@ -65,10 +55,7 @@ module Faker
65
55
  # # }"
66
56
  #
67
57
  # @faker.version 1.9.0
68
- def print_1_to_10(legacy_lang = NOT_GIVEN, lang: :ruby)
69
- warn_for_deprecated_arguments do |keywords|
70
- keywords << :lang if legacy_lang != NOT_GIVEN
71
- end
58
+ def print_1_to_10(lang: :ruby)
72
59
  fetch("source.print_1_to_10.#{lang}")
73
60
  end
74
61
  end
@@ -3,8 +3,6 @@
3
3
  module Faker
4
4
  class String < Base
5
5
  class << self
6
- # rubocop:disable Style/AsciiComments
7
-
8
6
  ##
9
7
  # Produces a random UTF-8 string with optional nested length selectors.
10
8
  #
@@ -19,14 +17,9 @@ module Faker
19
17
  # Faker::String.random(length: [1, (2..5), [3, 6], nil]) #=> "葓L#ћ"
20
18
  #
21
19
  # @faker.version 1.9.0
22
- def random(legacy_length = NOT_GIVEN, length: 32)
23
- warn_for_deprecated_arguments do |keywords|
24
- keywords << :length if legacy_length != NOT_GIVEN
25
- end
26
-
20
+ def random(length: 32)
27
21
  utf8string select_a length
28
22
  end
29
- # rubocop:enable Style/AsciiComments
30
23
 
31
24
  private
32
25
 
@@ -14,11 +14,7 @@ module Faker
14
14
  # Faker::Stripe.valid_card(card_type: "visa_debit") #=> "4000056655665556"
15
15
  #
16
16
  # @faker.version 1.9.0
17
- def valid_card(legacy_card_type = NOT_GIVEN, card_type: nil)
18
- warn_for_deprecated_arguments do |keywords|
19
- keywords << :card_type if legacy_card_type != NOT_GIVEN
20
- end
21
-
17
+ def valid_card(card_type: nil)
22
18
  valid_cards = translate('faker.stripe.valid_cards').keys
23
19
 
24
20
  if card_type.nil?
@@ -44,11 +40,7 @@ module Faker
44
40
  # Faker::Stripe.valid_token(card_type: "mc_debit") #=> "tok_mastercard_debit"
45
41
  #
46
42
  # @faker.version 1.9.0
47
- def valid_token(legacy_card_type = NOT_GIVEN, card_type: nil)
48
- warn_for_deprecated_arguments do |keywords|
49
- keywords << :card_type if legacy_card_type != NOT_GIVEN
50
- end
51
-
43
+ def valid_token(card_type: nil)
52
44
  valid_tokens = translate('faker.stripe.valid_tokens').keys
53
45
 
54
46
  if card_type.nil?
@@ -73,11 +65,7 @@ module Faker
73
65
  # Faker::Stripe.invalid_card(card_error: "addressZipFail") #=> "4000000000000010"
74
66
  #
75
67
  # @faker.version 1.9.0
76
- def invalid_card(legacy_card_error = NOT_GIVEN, card_error: nil)
77
- warn_for_deprecated_arguments do |keywords|
78
- keywords << :card_error if legacy_card_error != NOT_GIVEN
79
- end
80
-
68
+ def invalid_card(card_error: nil)
81
69
  invalid_cards = translate('faker.stripe.invalid_cards').keys
82
70
 
83
71
  if card_error.nil?
@@ -130,11 +118,7 @@ module Faker
130
118
  # Faker::Stripe.ccv(card_type: "amex") #=> "1234"
131
119
  #
132
120
  # @faker.version 1.9.0
133
- def ccv(legacy_card_type = NOT_GIVEN, card_type: nil)
134
- warn_for_deprecated_arguments do |keywords|
135
- keywords << :card_type if legacy_card_type != NOT_GIVEN
136
- end
137
-
121
+ def ccv(card_type: nil)
138
122
  (card_type.to_s == 'amex' ? rand_in_range(1000, 9999) : rand_in_range(100, 999)).to_s
139
123
  end
140
124
  end
@@ -13,9 +13,6 @@ module Faker
13
13
  }.freeze
14
14
 
15
15
  class << self
16
- # rubocop:disable Metrics/ParameterLists
17
- # rubocop:disable Style/AsciiComments
18
-
19
16
  ##
20
17
  # Produce a random time between two times.
21
18
  #
@@ -38,20 +35,13 @@ module Faker
38
35
  # Faker::Time.between(from: DateTime.now - 1, to: DateTime.now, format: :long) #=> "2018年10月16日(火) 10時48分27秒 -0500"
39
36
  #
40
37
  # @faker.version 1.5.0
41
- def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_format = NOT_GIVEN, from:, to:, format: nil)
42
- warn_for_deprecated_arguments do |keywords|
43
- keywords << :from if legacy_from != NOT_GIVEN
44
- keywords << :to if legacy_to != NOT_GIVEN
45
- keywords << :format if legacy_format != NOT_GIVEN
46
- end
47
-
38
+ def between(from:, to:, format: nil)
48
39
  from = get_time_object(from)
49
40
  to = get_time_object(to)
50
41
 
51
42
  time = Faker::Base.rand_in_range(from, to)
52
43
  time_with_format(time, format)
53
44
  end
54
- # rubocop:enable Style/AsciiComments
55
45
 
56
46
  ##
57
47
  # Produce a random time between two dates.
@@ -81,14 +71,7 @@ module Faker
81
71
  # #=> "Fri, 19 Oct 2018 15:17:46 -0500"
82
72
  #
83
73
  # @faker.version 1.0.0
84
- def between_dates(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_period = NOT_GIVEN, legacy_format = NOT_GIVEN, from:, to:, period: :all, format: nil)
85
- warn_for_deprecated_arguments do |keywords|
86
- keywords << :from if legacy_from != NOT_GIVEN
87
- keywords << :to if legacy_to != NOT_GIVEN
88
- keywords << :period if legacy_period != NOT_GIVEN
89
- keywords << :format if legacy_format != NOT_GIVEN
90
- end
91
-
74
+ def between_dates(from:, to:, period: :all, format: nil)
92
75
  date = Faker::Date.between(from: from, to: to)
93
76
  time = date_with_random_time(date, period)
94
77
  time_with_format(time, format)
@@ -109,13 +92,7 @@ module Faker
109
92
  # #=> "October 21, 2018 20:47"
110
93
  #
111
94
  # @faker.version 1.5.0
112
- def forward(legacy_days = NOT_GIVEN, legacy_period = NOT_GIVEN, legacy_format = NOT_GIVEN, days: 365, period: :all, format: nil)
113
- warn_for_deprecated_arguments do |keywords|
114
- keywords << :days if legacy_days != NOT_GIVEN
115
- keywords << :period if legacy_period != NOT_GIVEN
116
- keywords << :format if legacy_format != NOT_GIVEN
117
- end
118
-
95
+ def forward(days: 365, period: :all, format: nil)
119
96
  time_with_format(date_with_random_time(Faker::Date.forward(days: days), period), format)
120
97
  end
121
98
 
@@ -134,16 +111,9 @@ module Faker
134
111
  # #=> "14 Oct 07:44"
135
112
  #
136
113
  # @faker.version 1.5.0
137
- def backward(legacy_days = NOT_GIVEN, legacy_period = NOT_GIVEN, legacy_format = NOT_GIVEN, days: 365, period: :all, format: nil)
138
- warn_for_deprecated_arguments do |keywords|
139
- keywords << :days if legacy_days != NOT_GIVEN
140
- keywords << :period if legacy_period != NOT_GIVEN
141
- keywords << :format if legacy_format != NOT_GIVEN
142
- end
143
-
114
+ def backward(days: 365, period: :all, format: nil)
144
115
  time_with_format(date_with_random_time(Faker::Date.backward(days: days), period), format)
145
116
  end
146
- # rubocop:enable Metrics/ParameterLists
147
117
 
148
118
  private
149
119
 
@@ -16,14 +16,9 @@ module Faker
16
16
  # Faker::Twitter.user(include_email: true) # Simulate an authenticated user with the email permission
17
17
  #
18
18
  # @faker.version 1.7.3
19
- def user(legacy_include_status = NOT_GIVEN, legacy_include_email = NOT_GIVEN, include_status: true, include_email: false)
20
- warn_for_deprecated_arguments do |keywords|
21
- keywords << :include_status if legacy_include_status != NOT_GIVEN
22
- keywords << :include_email if legacy_include_email != NOT_GIVEN
23
- end
24
-
19
+ def user(include_status: true, include_email: false)
25
20
  user_id = id
26
- background_image_url = Faker::LoremPixel.image(size: '600x400') # TODO: Make the dimensions change
21
+ background_image_url = Faker::LoremFlickr.image(size: '600x400')
27
22
  profile_image_url = Faker::Avatar.image(slug: user_id, size: '48x48')
28
23
  user = {
29
24
  id: user_id,
@@ -51,7 +46,7 @@ module Faker
51
46
  profile_background_image_url_https: background_image_url,
52
47
  profile_background_image_url: background_image_url.sub('https://', 'http://'),
53
48
  profile_background_tile: Faker::Boolean.boolean(true_ratio: 0.1),
54
- profile_banner_url: Faker::LoremPixel.image(size: '1500x500'),
49
+ profile_banner_url: Faker::LoremFlickr.image(size: '1500x500'),
55
50
  profile_image_url_https: profile_image_url,
56
51
  profile_image_url: profile_image_url.sub('https://', 'http://'),
57
52
  profile_link_color: Faker::Color.hex_color,
@@ -68,7 +63,7 @@ module Faker
68
63
  verified: Faker::Boolean.boolean(true_ratio: 0.1)
69
64
  }
70
65
  user[:status] = Faker::Twitter.status(include_user: false) if include_status
71
- user[:email] = Faker::Internet.safe_email if include_email
66
+ user[:email] = Faker::Internet.email if include_email
72
67
  user
73
68
  end
74
69
 
@@ -85,12 +80,7 @@ module Faker
85
80
  # Faker::Twitter.status(include_photo: true) # Includes entities for an attached image
86
81
  #
87
82
  # @faker.version 1.7.3
88
- def status(legacy_include_user = NOT_GIVEN, legacy_include_photo = NOT_GIVEN, include_user: true, include_photo: false)
89
- warn_for_deprecated_arguments do |keywords|
90
- keywords << :include_user if legacy_include_user != NOT_GIVEN
91
- keywords << :include_photo if legacy_include_photo != NOT_GIVEN
92
- end
93
-
83
+ def status(include_user: true, include_photo: false)
94
84
  status_id = id
95
85
  status = {
96
86
  id: status_id,
@@ -161,11 +151,7 @@ module Faker
161
151
  }
162
152
  end
163
153
 
164
- def status_entities(legacy_include_photo = NOT_GIVEN, include_photo: false)
165
- warn_for_deprecated_arguments do |keywords|
166
- keywords << :include_photo if legacy_include_photo != NOT_GIVEN
167
- end
168
-
154
+ def status_entities(include_photo: false)
169
155
  entities = {
170
156
  hashtags: [],
171
157
  symbols: [],
@@ -177,9 +163,7 @@ module Faker
177
163
  end
178
164
 
179
165
  def photo_entity
180
- # TODO: Dynamic image sizes
181
- # TODO: Return accurate indices
182
- media_url = Faker::LoremPixel.image(size: '1064x600')
166
+ media_url = Faker::LoremFlickr.image(size: '1064x600')
183
167
  media_id = id
184
168
  {
185
169
  id: media_id,