faker 2.20.0 → 3.2.1
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 +346 -7
- data/History.md +1 -1
- data/README.md +193 -107
- data/lib/faker/blockchain/aeternity.rb +1 -1
- data/lib/faker/blockchain/ethereum.rb +1 -1
- data/lib/faker/blockchain/tezos.rb +1 -1
- data/lib/faker/books/dune.rb +2 -10
- data/lib/faker/books/lovecraft.rb +7 -38
- data/lib/faker/default/address.rb +5 -25
- data/lib/faker/default/alphanumeric.rb +2 -8
- data/lib/faker/default/app.rb +1 -10
- data/lib/faker/default/avatar.rb +1 -12
- data/lib/faker/default/bank.rb +9 -17
- data/lib/faker/default/boolean.rb +1 -4
- data/lib/faker/default/chile_rut.rb +25 -25
- data/lib/faker/default/code.rb +68 -39
- data/lib/faker/default/color.rb +77 -6
- data/lib/faker/default/commerce.rb +3 -17
- data/lib/faker/default/company.rb +50 -19
- data/lib/faker/default/crypto_coin.rb +3 -15
- data/lib/faker/default/date.rb +65 -42
- data/lib/faker/default/demographic.rb +1 -5
- data/lib/faker/default/driving_licence.rb +20 -19
- data/lib/faker/default/drone.rb +1 -1
- data/lib/faker/default/file.rb +5 -24
- data/lib/faker/default/finance.rb +17 -7
- data/lib/faker/default/food.rb +14 -1
- data/lib/faker/default/hipster.rb +6 -45
- data/lib/faker/default/html.rb +230 -0
- data/lib/faker/default/id_number.rb +125 -14
- data/lib/faker/default/internet.rb +116 -111
- data/lib/faker/default/invoice.rb +4 -17
- data/lib/faker/default/json.rb +2 -20
- data/lib/faker/default/lorem.rb +25 -74
- data/lib/faker/default/lorem_flickr.rb +4 -32
- data/lib/faker/default/markdown.rb +6 -11
- data/lib/faker/default/marketing.rb +1 -1
- data/lib/faker/default/measurement.rb +16 -48
- data/lib/faker/default/name.rb +1 -5
- data/lib/faker/default/nhs.rb +2 -6
- data/lib/faker/default/number.rb +10 -55
- data/lib/faker/default/omniauth.rb +6 -40
- data/lib/faker/default/phone_number.rb +2 -6
- data/lib/faker/default/placeholdit.rb +1 -12
- data/lib/faker/default/relationship.rb +1 -5
- data/lib/faker/default/release notes.md +59 -0
- data/lib/faker/default/source.rb +3 -16
- data/lib/faker/default/string.rb +1 -5
- data/lib/faker/default/stripe.rb +4 -20
- data/lib/faker/default/time.rb +4 -32
- data/lib/faker/default/twitter.rb +7 -23
- data/lib/faker/default/types.rb +7 -28
- data/lib/faker/default/vehicle.rb +40 -51
- data/lib/faker/default/vulnerability_identifier.rb +23 -0
- data/lib/faker/default/world_cup.rb +2 -11
- data/lib/faker/games/clash_of_clans.rb +1 -1
- data/lib/faker/games/dnd.rb +49 -7
- data/lib/faker/games/dota.rb +1 -5
- data/lib/faker/games/final_fantasy_xiv.rb +73 -0
- data/lib/faker/games/minecraft.rb +1 -1
- data/lib/faker/games/myst.rb +1 -1
- data/lib/faker/games/tarkov.rb +205 -0
- data/lib/faker/japanese_media/cowboy_bebop.rb +61 -0
- data/lib/faker/japanese_media/kamen_rider.rb +2 -2
- data/lib/faker/japanese_media/one_piece.rb +1 -1
- data/lib/faker/movies/avatar.rb +49 -0
- data/lib/faker/movies/hackers.rb +48 -0
- data/lib/faker/movies/star_wars.rb +1 -5
- data/lib/faker/movies/tron.rb +161 -0
- data/lib/faker/quotes/quote.rb +13 -0
- data/lib/faker/sports/chess.rb +90 -0
- data/lib/faker/sports/mountaineering.rb +22 -0
- data/lib/faker/sports/sport.rb +116 -0
- data/lib/faker/travel/airport.rb +43 -0
- data/lib/faker/travel/train_station.rb +54 -0
- data/lib/faker/tv_shows/archer.rb +51 -0
- data/lib/faker/tv_shows/south_park.rb +15 -0
- data/lib/faker/tv_shows/spongebob.rb +50 -0
- data/lib/faker/version.rb +1 -1
- data/lib/faker.rb +26 -67
- data/lib/helpers/base58.rb +1 -1
- data/lib/helpers/positional_generator.rb +480 -0
- data/lib/helpers/unique_generator.rb +13 -11
- data/lib/locales/README.md +18 -2
- data/lib/locales/ar.yml +1 -0
- data/lib/locales/bg.yml +1 -1
- data/lib/locales/da-DK.yml +1 -1
- data/lib/locales/de-AT.yml +1 -2
- data/lib/locales/de-CH.yml +4336 -12
- data/lib/locales/de.yml +1 -1
- data/lib/locales/en/airport.yml +381 -0
- data/lib/locales/en/archer.yml +75 -0
- data/lib/locales/en/australia.yml +3 -4
- data/lib/locales/en/avatar.yml +31 -0
- data/lib/locales/en/chess.yml +103 -0
- data/lib/locales/en/company.yml +1 -0
- data/lib/locales/en/computer.yml +23 -4
- data/lib/locales/en/cowboy_bebop.yml +163 -0
- data/lib/locales/en/dnd.yml +186 -1
- data/lib/locales/en/dota.yml +113 -0
- data/lib/locales/en/file.yml +9 -1
- data/lib/locales/en/final_fantasy_xiv.yml +754 -0
- data/lib/locales/en/finance.yml +3 -1
- data/lib/locales/en/food.yml +12 -0
- data/lib/locales/en/game.yml +0 -1
- data/lib/locales/en/hackers.yml +53 -0
- data/lib/locales/en/heroes.yml +2 -2
- data/lib/locales/en/internet.yml +32 -0
- data/lib/locales/en/minecraft.yml +4 -4
- data/lib/locales/en/mitch_hedberg.yml +46 -0
- data/lib/locales/en/mountaineering.yml +14 -0
- data/lib/locales/en/movie.yml +2 -1
- data/lib/locales/en/naruto.yml +2 -3
- data/lib/locales/en/one_piece.yml +1 -1
- data/lib/locales/en/opera.yml +2 -2
- data/lib/locales/en/overwatch.yml +5 -7
- data/lib/locales/en/source.yml +5 -0
- data/lib/locales/en/south_park.yml +360 -2
- data/lib/locales/en/spongebob.yml +489 -0
- data/lib/locales/en/sport.yml +130 -0
- data/lib/locales/en/star_wars.yml +1 -1
- data/lib/locales/en/tarkov.yml +593 -0
- data/lib/locales/en/train_station.yml +280 -0
- data/lib/locales/en/tron.yml +227 -0
- data/lib/locales/en/vehicle.yml +2809 -75
- data/lib/locales/en-AU.yml +2 -2
- data/lib/locales/en-CA.yml +2 -1
- data/lib/locales/en-GB.yml +2 -1
- data/lib/locales/en-MS.yml +1 -0
- data/lib/locales/en-NG.yml +1 -0
- data/lib/locales/en-NZ.yml +1 -0
- data/lib/locales/en-PAK.yml +1 -0
- data/lib/locales/en-SG.yml +1 -0
- data/lib/locales/en-UG.yml +1 -0
- data/lib/locales/en-US.yml +1 -1
- data/lib/locales/en-ZA.yml +1 -1
- data/lib/locales/en-au-ocker.yml +2 -0
- data/lib/locales/es-AR.yml +3 -2
- data/lib/locales/es-MX.yml +1 -1
- data/lib/locales/es.yml +2 -2
- data/lib/locales/fi-FI.yml +3 -1
- data/lib/locales/fr/address.yml +0 -1
- data/lib/locales/fr/adjective.yml +266 -0
- data/lib/locales/fr/ancient.yml +141 -0
- data/lib/locales/fr/name.yml +2 -1
- data/lib/locales/fr-CA.yml +1 -1
- data/lib/locales/fr-CH.yml +1 -1
- data/lib/locales/hy.yml +2 -1
- data/lib/locales/it.yml +1 -0
- data/lib/locales/ja/adjective.yml +148 -0
- data/lib/locales/ja/dog.yml +1 -0
- data/lib/locales/ja/emotion.yml +51 -0
- data/lib/locales/ja/naruto.yml +230 -0
- data/lib/locales/ja/relationship.yml +10 -0
- data/lib/locales/ja/sport.yml +130 -0
- data/lib/locales/ja/super_mario.yml +1 -1
- data/lib/locales/ko.yml +1 -0
- data/lib/locales/lt.yml +0 -1
- data/lib/locales/mi-NZ.yml +2 -0
- data/lib/locales/nb-NO.yml +1 -0
- data/lib/locales/nl.yml +1 -0
- data/lib/locales/pl.yml +2 -2
- data/lib/locales/pt-BR.yml +1 -0
- data/lib/locales/pt.yml +1 -1
- data/lib/locales/ru.yml +1 -0
- data/lib/locales/sk.yml +1 -0
- data/lib/locales/sv.yml +1 -0
- data/lib/locales/th.yml +76 -76
- data/lib/locales/tr.yml +1 -0
- data/lib/locales/uk.yml +3 -0
- data/lib/locales/vi.yml +1 -0
- data/lib/locales/zh-CN.yml +1 -0
- data/lib/locales/zh-TW.yml +1 -0
- metadata +46 -127
- data/lib/faker/default/fillmurray.rb +0 -45
- data/lib/faker/default/lorem_pixel.rb +0 -70
- /data/lib/faker/default/{faker_adjective.rb → adjective.rb} +0 -0
|
@@ -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.
|
|
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(
|
|
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',
|
|
@@ -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(
|
|
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(
|
|
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(
|
|
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(
|
|
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.
|
|
@@ -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]
|
|
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(
|
|
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(
|
|
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(
|
|
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,59 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
## What's Changed
|
|
4
|
+
* Add Final Fantasy XIV by @old-dead-account in https://github.com/faker-ruby/faker/pull/2742
|
|
5
|
+
* Update rubocop requirement from = 1.50.1 to = 1.50.2 by @dependabot in https://github.com/faker-ruby/faker/pull/2752
|
|
6
|
+
* Update South Park by @IvanReyesO7 in https://github.com/faker-ruby/faker/pull/2744
|
|
7
|
+
* add tests for password and fix an edge case by @DeepakRaj228 in https://github.com/faker-ruby/faker/pull/2741
|
|
8
|
+
* Speed up Internet::Password generation using constants by @MicBruz in https://github.com/faker-ruby/faker/pull/2725
|
|
9
|
+
* Add the Ukrainian country calling code by @kyrylo in https://github.com/faker-ruby/faker/pull/2758
|
|
10
|
+
* Update test-unit requirement from = 3.5.7 to = 3.5.8 by @dependabot in https://github.com/faker-ruby/faker/pull/2760
|
|
11
|
+
* Bump i18n from 1.12.0 to 1.13.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2756
|
|
12
|
+
* Update rubocop-minitest requirement from = 0.30.0 to = 0.31.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2759
|
|
13
|
+
* Remove broken chars from minecraft.yml by @ujihisa in https://github.com/faker-ruby/faker/pull/2765
|
|
14
|
+
* Update test-unit requirement from = 3.5.8 to = 3.5.9 by @dependabot in https://github.com/faker-ruby/faker/pull/2766
|
|
15
|
+
* Add `exclude_words` filter to `Faker::Lorem.word` generator by @geophilusd in https://github.com/faker-ruby/faker/pull/2761
|
|
16
|
+
* Improve de-CH locale with new formats and content by @stefnnn in https://github.com/faker-ruby/faker/pull/2768
|
|
17
|
+
* Add Japanese translations for Sports category. by @yamat47 in https://github.com/faker-ruby/faker/pull/2770
|
|
18
|
+
* Fix flaky specs for `name` and `id` by @ruban-thilak in https://github.com/faker-ruby/faker/pull/2782
|
|
19
|
+
* Add type support for Faker::Types.rb_array by @ruban-thilak in https://github.com/faker-ruby/faker/pull/2771
|
|
20
|
+
* Added Archer into tv category. by @lepari23 in https://github.com/faker-ruby/faker/pull/2750
|
|
21
|
+
* Add train station generator by @AngusDSR in https://github.com/faker-ruby/faker/pull/2755
|
|
22
|
+
* Fixes `Faker::Music::Opera.saint_saens` issue by @devashishTaneja in https://github.com/faker-ruby/faker/pull/2792
|
|
23
|
+
* Add custom start date for `Faker::Date.forward` by @luciagirasoles in https://github.com/faker-ruby/faker/pull/2791
|
|
24
|
+
* Fix flaky specs for dota `test_player` by @ruban-thilak in https://github.com/faker-ruby/faker/pull/2798
|
|
25
|
+
* Update minitest requirement from = 5.18.0 to = 5.18.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2781
|
|
26
|
+
* Update test-unit requirement from = 3.5.9 to = 3.6.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2788
|
|
27
|
+
* Introduce PositionalGenerator by @mike-burns in https://github.com/faker-ruby/faker/pull/2710
|
|
28
|
+
* Bump rubocop 1.54.2 + offenses fixes by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2801
|
|
29
|
+
* Add prefixes to french name locale (`Faker::Name.name`) by @thdaraujo in https://github.com/faker-ruby/faker/pull/2800
|
|
30
|
+
* Add `max_rut` option to `Faker::ChileRut.rut` by @hacktivista in https://github.com/faker-ruby/faker/pull/2778
|
|
31
|
+
* Fix locale setting by @mateusdeap in https://github.com/faker-ruby/faker/pull/2734
|
|
32
|
+
* Test default locale + and update README by @stefannibrasil in https://github.com/faker-ruby/faker/pull/2802
|
|
33
|
+
* Bump minitest from 5.18.1 to 5.19.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2804
|
|
34
|
+
* Bump rubocop from 1.54.2 to 1.55.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2803
|
|
35
|
+
* Bump rubocop from 1.55.0 to 1.55.1 by @dependabot in https://github.com/faker-ruby/faker/pull/2805
|
|
36
|
+
* Add Faker::Date.day_of_week_between by @aramvisser in https://github.com/faker-ruby/faker/pull/2713
|
|
37
|
+
* Html generator for Faker by @ruban-thilak in https://github.com/faker-ruby/faker/pull/2769
|
|
38
|
+
* Bump rubocop from 1.55.1 to 1.56.0 by @dependabot in https://github.com/faker-ruby/faker/pull/2807
|
|
39
|
+
|
|
40
|
+
## New Contributors
|
|
41
|
+
* @old-dead-account made their first contribution in https://github.com/faker-ruby/faker/pull/2742
|
|
42
|
+
* @IvanReyesO7 made their first contribution in https://github.com/faker-ruby/faker/pull/2744
|
|
43
|
+
* @DeepakRaj228 made their first contribution in https://github.com/faker-ruby/faker/pull/2741
|
|
44
|
+
* @MicBruz made their first contribution in https://github.com/faker-ruby/faker/pull/2725
|
|
45
|
+
* @kyrylo made their first contribution in https://github.com/faker-ruby/faker/pull/2758
|
|
46
|
+
* @ujihisa made their first contribution in https://github.com/faker-ruby/faker/pull/2765
|
|
47
|
+
* @geophilusd made their first contribution in https://github.com/faker-ruby/faker/pull/2761
|
|
48
|
+
* @stefnnn made their first contribution in https://github.com/faker-ruby/faker/pull/2768
|
|
49
|
+
* @yamat47 made their first contribution in https://github.com/faker-ruby/faker/pull/2770
|
|
50
|
+
* @ruban-thilak made their first contribution in https://github.com/faker-ruby/faker/pull/2782
|
|
51
|
+
* @lepari23 made their first contribution in https://github.com/faker-ruby/faker/pull/2750
|
|
52
|
+
* @AngusDSR made their first contribution in https://github.com/faker-ruby/faker/pull/2755
|
|
53
|
+
* @devashishTaneja made their first contribution in https://github.com/faker-ruby/faker/pull/2792
|
|
54
|
+
* @mike-burns made their first contribution in https://github.com/faker-ruby/faker/pull/2710
|
|
55
|
+
* @hacktivista made their first contribution in https://github.com/faker-ruby/faker/pull/2778
|
|
56
|
+
* @mateusdeap made their first contribution in https://github.com/faker-ruby/faker/pull/2734
|
|
57
|
+
* @aramvisser made their first contribution in https://github.com/faker-ruby/faker/pull/2713
|
|
58
|
+
|
|
59
|
+
**Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.2.0...v3.2.1
|
data/lib/faker/default/source.rb
CHANGED
|
@@ -17,11 +17,7 @@ module Faker
|
|
|
17
17
|
# #=> "alert('Hello World!');"
|
|
18
18
|
#
|
|
19
19
|
# @faker.version 1.9.0
|
|
20
|
-
def hello_world(
|
|
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(
|
|
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(
|
|
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
|
data/lib/faker/default/string.rb
CHANGED
|
@@ -17,11 +17,7 @@ module Faker
|
|
|
17
17
|
# Faker::String.random(length: [1, (2..5), [3, 6], nil]) #=> "葓L#ћ"
|
|
18
18
|
#
|
|
19
19
|
# @faker.version 1.9.0
|
|
20
|
-
def random(
|
|
21
|
-
warn_for_deprecated_arguments do |keywords|
|
|
22
|
-
keywords << :length if legacy_length != NOT_GIVEN
|
|
23
|
-
end
|
|
24
|
-
|
|
20
|
+
def random(length: 32)
|
|
25
21
|
utf8string select_a length
|
|
26
22
|
end
|
|
27
23
|
|
data/lib/faker/default/stripe.rb
CHANGED
|
@@ -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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
data/lib/faker/default/time.rb
CHANGED
|
@@ -13,8 +13,6 @@ module Faker
|
|
|
13
13
|
}.freeze
|
|
14
14
|
|
|
15
15
|
class << self
|
|
16
|
-
# rubocop:disable Metrics/ParameterLists
|
|
17
|
-
|
|
18
16
|
##
|
|
19
17
|
# Produce a random time between two times.
|
|
20
18
|
#
|
|
@@ -37,13 +35,7 @@ module Faker
|
|
|
37
35
|
# Faker::Time.between(from: DateTime.now - 1, to: DateTime.now, format: :long) #=> "2018年10月16日(火) 10時48分27秒 -0500"
|
|
38
36
|
#
|
|
39
37
|
# @faker.version 1.5.0
|
|
40
|
-
def between(
|
|
41
|
-
warn_for_deprecated_arguments do |keywords|
|
|
42
|
-
keywords << :from if legacy_from != NOT_GIVEN
|
|
43
|
-
keywords << :to if legacy_to != NOT_GIVEN
|
|
44
|
-
keywords << :format if legacy_format != NOT_GIVEN
|
|
45
|
-
end
|
|
46
|
-
|
|
38
|
+
def between(from:, to:, format: nil)
|
|
47
39
|
from = get_time_object(from)
|
|
48
40
|
to = get_time_object(to)
|
|
49
41
|
|
|
@@ -79,14 +71,7 @@ module Faker
|
|
|
79
71
|
# #=> "Fri, 19 Oct 2018 15:17:46 -0500"
|
|
80
72
|
#
|
|
81
73
|
# @faker.version 1.0.0
|
|
82
|
-
def between_dates(
|
|
83
|
-
warn_for_deprecated_arguments do |keywords|
|
|
84
|
-
keywords << :from if legacy_from != NOT_GIVEN
|
|
85
|
-
keywords << :to if legacy_to != NOT_GIVEN
|
|
86
|
-
keywords << :period if legacy_period != NOT_GIVEN
|
|
87
|
-
keywords << :format if legacy_format != NOT_GIVEN
|
|
88
|
-
end
|
|
89
|
-
|
|
74
|
+
def between_dates(from:, to:, period: :all, format: nil)
|
|
90
75
|
date = Faker::Date.between(from: from, to: to)
|
|
91
76
|
time = date_with_random_time(date, period)
|
|
92
77
|
time_with_format(time, format)
|
|
@@ -107,13 +92,7 @@ module Faker
|
|
|
107
92
|
# #=> "October 21, 2018 20:47"
|
|
108
93
|
#
|
|
109
94
|
# @faker.version 1.5.0
|
|
110
|
-
def forward(
|
|
111
|
-
warn_for_deprecated_arguments do |keywords|
|
|
112
|
-
keywords << :days if legacy_days != NOT_GIVEN
|
|
113
|
-
keywords << :period if legacy_period != NOT_GIVEN
|
|
114
|
-
keywords << :format if legacy_format != NOT_GIVEN
|
|
115
|
-
end
|
|
116
|
-
|
|
95
|
+
def forward(days: 365, period: :all, format: nil)
|
|
117
96
|
time_with_format(date_with_random_time(Faker::Date.forward(days: days), period), format)
|
|
118
97
|
end
|
|
119
98
|
|
|
@@ -132,16 +111,9 @@ module Faker
|
|
|
132
111
|
# #=> "14 Oct 07:44"
|
|
133
112
|
#
|
|
134
113
|
# @faker.version 1.5.0
|
|
135
|
-
def backward(
|
|
136
|
-
warn_for_deprecated_arguments do |keywords|
|
|
137
|
-
keywords << :days if legacy_days != NOT_GIVEN
|
|
138
|
-
keywords << :period if legacy_period != NOT_GIVEN
|
|
139
|
-
keywords << :format if legacy_format != NOT_GIVEN
|
|
140
|
-
end
|
|
141
|
-
|
|
114
|
+
def backward(days: 365, period: :all, format: nil)
|
|
142
115
|
time_with_format(date_with_random_time(Faker::Date.backward(days: days), period), format)
|
|
143
116
|
end
|
|
144
|
-
# rubocop:enable Metrics/ParameterLists
|
|
145
117
|
|
|
146
118
|
private
|
|
147
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(
|
|
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::
|
|
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::
|
|
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.
|
|
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(
|
|
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(
|
|
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
|
-
|
|
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,
|
data/lib/faker/default/types.rb
CHANGED
|
@@ -16,11 +16,7 @@ module Faker
|
|
|
16
16
|
# Faker::Types.rb_string #=> "foobar"
|
|
17
17
|
#
|
|
18
18
|
# @faker.version 1.8.6
|
|
19
|
-
def rb_string(
|
|
20
|
-
warn_for_deprecated_arguments do |keywords|
|
|
21
|
-
keywords << :words if legacy_words != NOT_GIVEN
|
|
22
|
-
end
|
|
23
|
-
|
|
19
|
+
def rb_string(words: 1)
|
|
24
20
|
resolved_num = resolve(words)
|
|
25
21
|
word_list =
|
|
26
22
|
translate('faker.lorem.words')
|
|
@@ -51,12 +47,7 @@ module Faker
|
|
|
51
47
|
# Faker::Types.rb_integer #=> 1
|
|
52
48
|
#
|
|
53
49
|
# @faker.version 1.8.6
|
|
54
|
-
def rb_integer(
|
|
55
|
-
warn_for_deprecated_arguments do |keywords|
|
|
56
|
-
keywords << :from if legacy_from != NOT_GIVEN
|
|
57
|
-
keywords << :to if legacy_to != NOT_GIVEN
|
|
58
|
-
end
|
|
59
|
-
|
|
50
|
+
def rb_integer(from: 0, to: 100)
|
|
60
51
|
rand(from..to).to_i
|
|
61
52
|
end
|
|
62
53
|
|
|
@@ -72,12 +63,7 @@ module Faker
|
|
|
72
63
|
# Faker::Types.rb_hash(number: 2) #=> {name: "bob", last: "marley"}
|
|
73
64
|
#
|
|
74
65
|
# @faker.version 1.8.6
|
|
75
|
-
def rb_hash(
|
|
76
|
-
warn_for_deprecated_arguments do |keywords|
|
|
77
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
|
78
|
-
keywords << :type if legacy_type != NOT_GIVEN
|
|
79
|
-
end
|
|
80
|
-
|
|
66
|
+
def rb_hash(number: 1, type: -> { random_type })
|
|
81
67
|
{}.tap do |hsh|
|
|
82
68
|
Lorem.words(number: number * 2).uniq.first(number).each do |s|
|
|
83
69
|
value = type.is_a?(Proc) ? type.call : type
|
|
@@ -98,11 +84,7 @@ module Faker
|
|
|
98
84
|
# Faker::Types.complex_rb_hash(number: 2) #=> {user: {first: "bob", last: "marley"}, son: ["damien", "marley"]}
|
|
99
85
|
#
|
|
100
86
|
# @faker.version 1.8.6
|
|
101
|
-
def complex_rb_hash(
|
|
102
|
-
warn_for_deprecated_arguments do |keywords|
|
|
103
|
-
keywords << :number if legacy_number != NOT_GIVEN
|
|
104
|
-
end
|
|
105
|
-
|
|
87
|
+
def complex_rb_hash(number: 1)
|
|
106
88
|
rb_hash(number: number, type: -> { random_complex_type })
|
|
107
89
|
end
|
|
108
90
|
|
|
@@ -115,16 +97,13 @@ module Faker
|
|
|
115
97
|
# @example
|
|
116
98
|
# Faker::Types.rb_array #=> ["a"]
|
|
117
99
|
# Faker::Types.rb_array(len: 4) #=> ["a", 1, 2, "bob"]
|
|
100
|
+
# Faker::Types.rb_array(len: 2, type: -> { Faker::Types.rb_string }) #=> ["cat", "foo"]
|
|
118
101
|
#
|
|
119
102
|
# @faker.version 1.8.6
|
|
120
|
-
def rb_array(
|
|
121
|
-
warn_for_deprecated_arguments do |keywords|
|
|
122
|
-
keywords << :len if legacy_len != NOT_GIVEN
|
|
123
|
-
end
|
|
124
|
-
|
|
103
|
+
def rb_array(len: 1, type: -> { random_type })
|
|
125
104
|
[].tap do |ar|
|
|
126
105
|
len.times do
|
|
127
|
-
ar.push
|
|
106
|
+
ar.push type.is_a?(Proc) ? type.call : type
|
|
128
107
|
end
|
|
129
108
|
end
|
|
130
109
|
end
|