faker 3.6.0 → 3.8.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 +87 -0
- data/README.md +1 -2
- data/lib/faker/blockchain.rb +9 -0
- data/lib/faker/books.rb +9 -0
- data/lib/faker/creature.rb +9 -0
- data/lib/faker/default/driving_licence.rb +2 -2
- data/lib/faker/default/html.rb +3 -3
- data/lib/faker/default/id_number.rb +1 -1
- data/lib/faker/default/lorem.rb +2 -2
- data/lib/faker/default/markdown.rb +3 -3
- data/lib/faker/default/omniauth.rb +58 -58
- data/lib/faker/default/string.rb +1 -1
- data/lib/faker/default.rb +9 -0
- data/lib/faker/fantasy.rb +9 -0
- data/lib/faker/games.rb +9 -0
- data/lib/faker/{default/internet.rb → internet.rb} +7 -3
- data/lib/faker/japanese_media.rb +9 -0
- data/lib/faker/locations.rb +9 -0
- data/lib/faker/movies.rb +9 -0
- data/lib/faker/music/bossa_nova.rb +0 -2
- data/lib/faker/music/grateful_dead.rb +0 -2
- data/lib/faker/music/pearl_jam.rb +0 -2
- data/lib/faker/music/rush.rb +0 -2
- data/lib/faker/music/smashing_pumpkins.rb +0 -2
- data/lib/faker/{music/music.rb → music.rb} +4 -0
- data/lib/faker/quotes.rb +9 -0
- data/lib/faker/religion/bible.rb +1 -1
- data/lib/faker/religion.rb +9 -0
- data/lib/faker/sports.rb +9 -0
- data/lib/faker/travel.rb +9 -0
- data/lib/faker/tv_shows.rb +9 -0
- data/lib/faker/version.rb +1 -1
- data/lib/faker.rb +62 -9
- data/lib/helpers/positional_generator.rb +0 -2
- data/lib/helpers/unique_generator.rb +1 -1
- data/lib/locales/README.md +2 -2
- data/lib/locales/en/book.yml +0 -1
- data/lib/locales/en/football.yml +9 -0
- data/lib/locales/ja/address.yml +1 -120285
- metadata +25 -12
- data/lib/faker/default/religion.rb +0 -6
- /data/lib/faker/{books → default}/book.rb +0 -0
- /data/lib/faker/{games → default}/game.rb +0 -0
- /data/lib/faker/{movies → default}/movie.rb +0 -0
- /data/lib/faker/{quotes → default}/quote.rb +0 -0
- /data/lib/faker/{sports → default}/sport.rb +0 -0
- /data/lib/faker/{default/internet_http.rb → internet/http.rb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 38a9d198febc038719036f12b99ba3b7f72a88bcc63335ff7246823732880d95
|
|
4
|
+
data.tar.gz: 7a01cb7591744939b8704abdf2f40e953eddb01307faea36b6a8ca000db9454d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2305eff5122ee4e9754333e8c11488a6fd2c6efc6985e8cf05f80118c2ae079aab1c0e81eee20414a6fa2cc156bf2c0a8d542792ff96d18dfaafa06965aac3d
|
|
7
|
+
data.tar.gz: 7f07790d5f5b8e4b3815fa0a9c32d28098bcf7f46f2b8d3c87e60600e61f0435b3c7bcf3260fc7b377e7765b29cc254c867530c455ab657bb869a825bd82e393
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v3.8.0](https://github.com/faker-ruby/faker/tree/v3.8.0) (2026-04-16)
|
|
4
|
+
|
|
5
|
+
* Add Lazy loading config by @stefannibrasil and @thdaraujo in https://github.com/faker-ruby/faker/pull/3244
|
|
6
|
+
|
|
7
|
+
### Enabling lazy load
|
|
8
|
+
|
|
9
|
+
This version introduces lazy loading. It means users will only pay for what they use. Faker [loads 2x faster](https://github.com/faker-ruby/faker/blob/main/experiments/lazy_load.md) when it's enabled.
|
|
10
|
+
|
|
11
|
+
Lazy loading the generators is disabled by default. To enable it, choose one of the configuration options below:
|
|
12
|
+
|
|
13
|
+
#### 1 - Set lazy load as a Faker Config
|
|
14
|
+
|
|
15
|
+
`Faker::Config.lazy_loading = true`
|
|
16
|
+
|
|
17
|
+
#### 2 - Set lazy load as an environment variable
|
|
18
|
+
|
|
19
|
+
`FAKER_LAZY_LOAD = 1`
|
|
20
|
+
|
|
21
|
+
We hope you get to see the improvement by enabling it. Please file a bug report for any issues!
|
|
22
|
+
|
|
23
|
+
Thanks to @jeremyevans for the mentoring, and to @thdaraujo for pairing and code reviews.
|
|
24
|
+
|
|
25
|
+
**Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.7.1...v3.8.0
|
|
26
|
+
|
|
27
|
+
-----------------------
|
|
28
|
+
|
|
29
|
+
## [v3.7.1](https://github.com/faker-ruby/faker/tree/v3.7.1) (2026-04-14)
|
|
30
|
+
|
|
31
|
+
Thanks to all contributors!
|
|
32
|
+
|
|
33
|
+
### Drops support for Ruby 3.1
|
|
34
|
+
|
|
35
|
+
* Drop support for Ruby EOL 3.1 by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3240
|
|
36
|
+
|
|
37
|
+
### What's changed
|
|
38
|
+
|
|
39
|
+
* Remove json_schema and public-suffix versions constraint by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3224
|
|
40
|
+
* Added additional football teams by @John222 in https://github.com/faker-ruby/faker/pull/3231
|
|
41
|
+
* Remove duplicate 'Recalled to Life' book title by @gkrimer in https://github.com/faker-ruby/faker/pull/3238
|
|
42
|
+
|
|
43
|
+
### Update development dependencies
|
|
44
|
+
|
|
45
|
+
* Bump yard from 0.9.38 to 0.9.40 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3237
|
|
46
|
+
* Bump timecop from 0.9.10 to 0.9.11 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3236
|
|
47
|
+
* Bump rubocop from 1.85.1 to 1.86.1 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3235
|
|
48
|
+
|
|
49
|
+
### New Contributors
|
|
50
|
+
* @John222 made their first contribution in https://github.com/faker-ruby/faker/pull/3231
|
|
51
|
+
* @gkrimer made their first contribution in https://github.com/faker-ruby/faker/pull/3238
|
|
52
|
+
|
|
53
|
+
**Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.6.1...v3.7.1
|
|
54
|
+
|
|
55
|
+
--------------------------------
|
|
56
|
+
|
|
57
|
+
## [v3.6.1](https://github.com/faker-ruby/faker/tree/v3.6.1) (2026-03-04)
|
|
58
|
+
|
|
59
|
+
It's almost Spring time in the Northern hemisphere 🌸
|
|
60
|
+
|
|
61
|
+
### Security, performance improvements and bug fixes
|
|
62
|
+
|
|
63
|
+
* fix: polynomial regex on uncontrolled input by @thdaraujo in https://github.com/faker-ruby/faker/pull/3196
|
|
64
|
+
* perf: replaces list of postcodes in `ja/address.yml` with a 7-digit format by @thdaraujo in https://github.com/faker-ruby/faker/pull/3201
|
|
65
|
+
* Remove unnecessary whitespace from code blocks in READMEs by @ryotaro-shirai in https://github.com/faker-ruby/faker/pull/3209
|
|
66
|
+
* Document lazy load experiment results by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3205
|
|
67
|
+
* [skip ci] Add-backtick by @OzuAkira in https://github.com/faker-ruby/faker/pull/3210
|
|
68
|
+
* Zeitwerk experiment changes and results [skip ci] by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3213
|
|
69
|
+
* Remove duplicate reference link in README.md by @yutasb in https://github.com/faker-ruby/faker/pull/3217
|
|
70
|
+
|
|
71
|
+
### Update development dependencies
|
|
72
|
+
|
|
73
|
+
* Bump rubocop from 1.84.0 to 1.84.1 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3202
|
|
74
|
+
* Bump irb from 1.16.0 to 1.17.0 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3203
|
|
75
|
+
* Bump rubocop version and fix offenses by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3198
|
|
76
|
+
* Bump rdoc from 7.1.0 to 7.2.0 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3204
|
|
77
|
+
* Bump rubocop to 1.84.2 by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3215
|
|
78
|
+
* Bump rubocop-minitest from 0.38.2 to 0.39.1 by @dependabot[bot] in https://github.com/faker-ruby/faker/pull/3216
|
|
79
|
+
* Bump rubocop to v1.85.0 by @stefannibrasil in https://github.com/faker-ruby/faker/pull/3220
|
|
80
|
+
|
|
81
|
+
### New Contributors
|
|
82
|
+
* @ryotaro-shirai made their first contribution in https://github.com/faker-ruby/faker/pull/3209
|
|
83
|
+
* @OzuAkira made their first contribution in https://github.com/faker-ruby/faker/pull/3210
|
|
84
|
+
* @yutasb made their first contribution in https://github.com/faker-ruby/faker/pull/3217
|
|
85
|
+
|
|
86
|
+
**Full Changelog**: https://github.com/faker-ruby/faker/compare/v3.6.0...v3.6.1
|
|
87
|
+
|
|
88
|
+
---------------------------------
|
|
89
|
+
|
|
3
90
|
## [v3.6.0](https://github.com/faker-ruby/faker/tree/v3.6.0) (2026-01-21)
|
|
4
91
|
|
|
5
92
|
First release of the new year!
|
data/README.md
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
[github-actions]: https://github.com/faker-ruby/faker/actions
|
|
12
12
|
[downloads-total]: https://img.shields.io/gem/dt/faker.svg
|
|
13
13
|
[downloads-badge]: https://img.shields.io/gem/dtv/faker.svg
|
|
14
|
-
[downloads-badge]: https://img.shields.io/gem/dtv/faker.svg
|
|
15
14
|
|
|
16
15
|
## Quick links
|
|
17
16
|
|
|
@@ -157,7 +156,7 @@ To prevent Faker (version >= 2.22) from [generating duplicate values](https://gi
|
|
|
157
156
|
you might need to add the following to the `test_helper.rb` or `rails_helper.rb` file:
|
|
158
157
|
|
|
159
158
|
```ruby
|
|
160
|
-
|
|
159
|
+
Faker::Config.random = Random.new
|
|
161
160
|
```
|
|
162
161
|
|
|
163
162
|
## Generators
|
data/lib/faker/books.rb
ADDED
|
@@ -61,11 +61,11 @@ module Faker
|
|
|
61
61
|
# Faker::DrivingLicence.uk_driving_licence #=> "70702548"
|
|
62
62
|
#
|
|
63
63
|
# @faker.version 1.9.2
|
|
64
|
-
def uk_driving_licence(*
|
|
64
|
+
def uk_driving_licence(*)
|
|
65
65
|
if Faker::Config.random.rand < NI_CHANCE
|
|
66
66
|
northern_irish_driving_licence
|
|
67
67
|
else
|
|
68
|
-
british_driving_licence(*
|
|
68
|
+
british_driving_licence(*)
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
data/lib/faker/default/html.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Faker
|
|
|
14
14
|
# @faker.version 3.2.1
|
|
15
15
|
def heading
|
|
16
16
|
level = rand(1..6)
|
|
17
|
-
"<h#{level}>#{Lorem.word.capitalize}</h#{level}>"
|
|
17
|
+
"<h#{level}>#{Faker::Lorem.word.capitalize}</h#{level}>"
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
##
|
|
@@ -97,7 +97,7 @@ module Faker
|
|
|
97
97
|
#
|
|
98
98
|
# @faker.version 3.2.1
|
|
99
99
|
def code
|
|
100
|
-
"<code>#{Lorem.sentence(word_count: 1)}</code>"
|
|
100
|
+
"<code>#{Faker::Lorem.sentence(word_count: 1)}</code>"
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
##
|
|
@@ -165,7 +165,7 @@ module Faker
|
|
|
165
165
|
# Faker::HTML.element(tag: 'div', content: "This is a div with XSS attributes.", attributes: {class: 'xss', onclick: "alert('XSS')"}) #=> "<div class=\"xss\" onclick=\"alert('XSS')\">This is a div with XSS attributes.</div>"
|
|
166
166
|
#
|
|
167
167
|
# @faker.version 3.2.1
|
|
168
|
-
def element(tag: 'div', content: Lorem.sentence(word_count: 3), attributes: { class: Lorem.word, onclick: "#{Lorem.word}()" })
|
|
168
|
+
def element(tag: 'div', content: Faker::Lorem.sentence(word_count: 3), attributes: { class: Faker::Lorem.word, onclick: "#{Faker::Lorem.word}()" })
|
|
169
169
|
attribute_string = attributes.map { |key, value| "#{key}=\"#{value}\"" }.join(' ')
|
|
170
170
|
"<#{tag} #{attribute_string}>#{content}</#{tag}>"
|
|
171
171
|
end
|
data/lib/faker/default/lorem.rb
CHANGED
|
@@ -58,7 +58,7 @@ module Faker
|
|
|
58
58
|
#
|
|
59
59
|
# @faker.version 2.1.3
|
|
60
60
|
def character
|
|
61
|
-
sample(Types::CHARACTERS)
|
|
61
|
+
sample(Faker::Types::CHARACTERS)
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
##
|
|
@@ -78,7 +78,7 @@ module Faker
|
|
|
78
78
|
#
|
|
79
79
|
# @faker.version 2.1.3
|
|
80
80
|
def characters(number: 255, min_alpha: 0, min_numeric: 0)
|
|
81
|
-
Alphanumeric.alphanumeric(number: number, min_alpha: min_alpha, min_numeric: min_numeric)
|
|
81
|
+
Faker::Alphanumeric.alphanumeric(number: number, min_alpha: min_alpha, min_numeric: min_numeric)
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
##
|
|
@@ -13,7 +13,7 @@ module Faker
|
|
|
13
13
|
#
|
|
14
14
|
# @faker.version 1.8.0
|
|
15
15
|
def headers
|
|
16
|
-
"#{fetch('markdown.headers')} #{Lorem.word.capitalize}"
|
|
16
|
+
"#{fetch('markdown.headers')} #{Faker::Lorem.word.capitalize}"
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
##
|
|
@@ -95,7 +95,7 @@ module Faker
|
|
|
95
95
|
#
|
|
96
96
|
# @faker.version 1.8.0
|
|
97
97
|
def block_code
|
|
98
|
-
"```ruby\n#{Lorem.sentence(word_count: 1)}\n```"
|
|
98
|
+
"```ruby\n#{Faker::Lorem.sentence(word_count: 1)}\n```"
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
##
|
|
@@ -110,7 +110,7 @@ module Faker
|
|
|
110
110
|
def table
|
|
111
111
|
table = []
|
|
112
112
|
3.times do
|
|
113
|
-
table << "#{Lorem.word} | #{Lorem.word} | #{Lorem.word}"
|
|
113
|
+
table << "#{Faker::Lorem.word} | #{Faker::Lorem.word} | #{Faker::Lorem.word}"
|
|
114
114
|
end
|
|
115
115
|
table.insert(1, '---- | ---- | ----')
|
|
116
116
|
table.join("\n")
|
|
@@ -11,8 +11,8 @@ module Faker
|
|
|
11
11
|
def initialize(name: nil, email: nil)
|
|
12
12
|
super()
|
|
13
13
|
|
|
14
|
-
@name = name || "#{Name.first_name} #{Name.last_name}"
|
|
15
|
-
@email = email || Internet.email(name: self.name)
|
|
14
|
+
@name = name || "#{Faker::Name.first_name} #{Faker::Name.last_name}"
|
|
15
|
+
@email = email || Faker::Internet.email(name: self.name)
|
|
16
16
|
@first_name, @last_name = self.name.split
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -27,8 +27,8 @@ module Faker
|
|
|
27
27
|
# @return [Hash] An auth hash in the format provided by omniauth-google.
|
|
28
28
|
#
|
|
29
29
|
# @faker.version 1.8.0
|
|
30
|
-
def google(name: nil, email: nil, uid: Number.number(digits: 9).to_s)
|
|
31
|
-
auth =
|
|
30
|
+
def google(name: nil, email: nil, uid: Faker::Number.number(digits: 9).to_s)
|
|
31
|
+
auth = new(name: name, email: email)
|
|
32
32
|
{
|
|
33
33
|
provider: 'google_oauth2',
|
|
34
34
|
uid: uid,
|
|
@@ -40,9 +40,9 @@ module Faker
|
|
|
40
40
|
image: image
|
|
41
41
|
},
|
|
42
42
|
credentials: {
|
|
43
|
-
token: Crypto.md5,
|
|
44
|
-
refresh_token: Crypto.md5,
|
|
45
|
-
expires_at: Time.forward.to_i,
|
|
43
|
+
token: Faker::Crypto.md5,
|
|
44
|
+
refresh_token: Faker::Crypto.md5,
|
|
45
|
+
expires_at: Faker::Time.forward.to_i,
|
|
46
46
|
expires: true
|
|
47
47
|
},
|
|
48
48
|
extra: {
|
|
@@ -56,20 +56,20 @@ module Faker
|
|
|
56
56
|
profile: "https://plus.google.com/#{uid}",
|
|
57
57
|
picture: image,
|
|
58
58
|
gender: gender,
|
|
59
|
-
birthday: Date.backward(days: 36_400).strftime('%Y-%m-%d'),
|
|
59
|
+
birthday: Faker::Date.backward(days: 36_400).strftime('%Y-%m-%d'),
|
|
60
60
|
locale: 'en',
|
|
61
|
-
hd: "#{Company.name.downcase}.com"
|
|
61
|
+
hd: "#{Faker::Company.name.downcase}.com"
|
|
62
62
|
},
|
|
63
63
|
id_info: {
|
|
64
64
|
iss: 'accounts.google.com',
|
|
65
|
-
at_hash: Crypto.md5,
|
|
65
|
+
at_hash: Faker::Crypto.md5,
|
|
66
66
|
email_verified: true,
|
|
67
|
-
sub: Number.number(digits: 28).to_s,
|
|
67
|
+
sub: Faker::Number.number(digits: 28).to_s,
|
|
68
68
|
azp: 'APP_ID',
|
|
69
69
|
email: auth.email,
|
|
70
70
|
aud: 'APP_ID',
|
|
71
|
-
iat: Time.forward.to_i,
|
|
72
|
-
exp: Time.forward.to_i,
|
|
71
|
+
iat: Faker::Time.forward.to_i,
|
|
72
|
+
exp: Faker::Time.forward.to_i,
|
|
73
73
|
openid_id: "https://www.google.com/accounts/o8/id?id=#{uid}"
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -87,8 +87,8 @@ module Faker
|
|
|
87
87
|
# @return [Hash] An auth hash in the format provided by omniauth-facebook.
|
|
88
88
|
#
|
|
89
89
|
# @faker.version 1.8.0
|
|
90
|
-
def facebook(name: nil, email: nil, username: nil, uid: Number.number(digits: 7).to_s)
|
|
91
|
-
auth =
|
|
90
|
+
def facebook(name: nil, email: nil, username: nil, uid: Faker::Number.number(digits: 7).to_s)
|
|
91
|
+
auth = new(name: name, email: email)
|
|
92
92
|
username ||= "#{auth.first_name.downcase[0]}#{auth.last_name.downcase}"
|
|
93
93
|
{
|
|
94
94
|
provider: 'facebook',
|
|
@@ -102,7 +102,7 @@ module Faker
|
|
|
102
102
|
verified: random_boolean
|
|
103
103
|
},
|
|
104
104
|
credentials: {
|
|
105
|
-
token: Crypto.md5,
|
|
105
|
+
token: Faker::Crypto.md5,
|
|
106
106
|
expires_at: Time.forward.to_i,
|
|
107
107
|
expires: true
|
|
108
108
|
},
|
|
@@ -115,7 +115,7 @@ module Faker
|
|
|
115
115
|
link: "http://www.facebook.com/#{username}",
|
|
116
116
|
username: username,
|
|
117
117
|
location: {
|
|
118
|
-
id: Number.number(digits: 9).to_s,
|
|
118
|
+
id: Faker::Number.number(digits: 9).to_s,
|
|
119
119
|
name: city_state
|
|
120
120
|
},
|
|
121
121
|
gender: gender,
|
|
@@ -123,7 +123,7 @@ module Faker
|
|
|
123
123
|
timezone: timezone,
|
|
124
124
|
locale: 'en_US',
|
|
125
125
|
verified: random_boolean,
|
|
126
|
-
updated_time: Time.backward.iso8601
|
|
126
|
+
updated_time: Faker::Time.backward.iso8601
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -139,11 +139,11 @@ module Faker
|
|
|
139
139
|
# @return [Hash] An auth hash in the format provided by omniauth-twitter.
|
|
140
140
|
#
|
|
141
141
|
# @faker.version 1.8.0
|
|
142
|
-
def twitter(name: nil, nickname: nil, uid: Number.number(digits: 6).to_s)
|
|
143
|
-
auth =
|
|
142
|
+
def twitter(name: nil, nickname: nil, uid: Faker::Number.number(digits: 6).to_s)
|
|
143
|
+
auth = new(name: name)
|
|
144
144
|
nickname ||= auth.name.downcase.delete(' ')
|
|
145
145
|
location = city_state
|
|
146
|
-
description = Lorem.sentence
|
|
146
|
+
description = Faker::Lorem.sentence
|
|
147
147
|
{
|
|
148
148
|
provider: 'twitter',
|
|
149
149
|
uid: uid,
|
|
@@ -159,26 +159,26 @@ module Faker
|
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
credentials: {
|
|
162
|
-
token: Crypto.md5,
|
|
163
|
-
secret: Crypto.md5
|
|
162
|
+
token: Faker::Crypto.md5,
|
|
163
|
+
secret: Faker::Crypto.md5
|
|
164
164
|
},
|
|
165
165
|
extra: {
|
|
166
166
|
access_token: '',
|
|
167
167
|
raw_info: {
|
|
168
168
|
name: auth.name,
|
|
169
169
|
listed_count: random_number_from_range(1..10),
|
|
170
|
-
profile_sidebar_border_color: Color.hex_color,
|
|
170
|
+
profile_sidebar_border_color: Faker::Color.hex_color,
|
|
171
171
|
url: nil,
|
|
172
172
|
lang: 'en',
|
|
173
173
|
statuses_count: random_number_from_range(1..1000),
|
|
174
174
|
profile_image_url: image,
|
|
175
175
|
profile_background_image_url_https: image,
|
|
176
176
|
location: location,
|
|
177
|
-
time_zone: Address.city,
|
|
177
|
+
time_zone: Faker::Address.city,
|
|
178
178
|
follow_request_sent: random_boolean,
|
|
179
179
|
id: uid,
|
|
180
180
|
profile_background_tile: random_boolean,
|
|
181
|
-
profile_sidebar_fill_color: Color.hex_color,
|
|
181
|
+
profile_sidebar_fill_color: Faker::Color.hex_color,
|
|
182
182
|
followers_count: random_number_from_range(1..10_000),
|
|
183
183
|
default_profile_image: random_boolean,
|
|
184
184
|
screen_name: '',
|
|
@@ -186,7 +186,7 @@ module Faker
|
|
|
186
186
|
utc_offset: timezone,
|
|
187
187
|
verified: random_boolean,
|
|
188
188
|
favourites_count: random_number_from_range(1..10),
|
|
189
|
-
profile_background_color: Color.hex_color,
|
|
189
|
+
profile_background_color: Faker::Color.hex_color,
|
|
190
190
|
is_translator: random_boolean,
|
|
191
191
|
friends_count: random_number_from_range(1..10_000),
|
|
192
192
|
notifications: random_boolean,
|
|
@@ -194,8 +194,8 @@ module Faker
|
|
|
194
194
|
profile_background_image_url: image,
|
|
195
195
|
protected: random_boolean,
|
|
196
196
|
description: description,
|
|
197
|
-
profile_link_color: Color.hex_color,
|
|
198
|
-
created_at: Time.backward.strftime('%a %b %d %H:%M:%S %z %Y'),
|
|
197
|
+
profile_link_color: Faker::Color.hex_color,
|
|
198
|
+
created_at: Faker::Time.backward.strftime('%a %b %d %H:%M:%S %z %Y'),
|
|
199
199
|
id_str: uid,
|
|
200
200
|
profile_image_url_https: image,
|
|
201
201
|
default_profile: random_boolean,
|
|
@@ -222,15 +222,15 @@ module Faker
|
|
|
222
222
|
# @return [Hash] An auth hash in the format provided by omniauth-linkedin.
|
|
223
223
|
#
|
|
224
224
|
# @faker.version 1.8.0
|
|
225
|
-
def linkedin(name: nil, email: nil, uid: Number.number(digits: 6).to_s)
|
|
225
|
+
def linkedin(name: nil, email: nil, uid: Faker::Number.number(digits: 6).to_s)
|
|
226
226
|
auth = Omniauth.new(name: name, email: email)
|
|
227
227
|
first_name = auth.first_name.downcase
|
|
228
228
|
last_name = auth.last_name.downcase
|
|
229
229
|
location = city_state
|
|
230
|
-
description = Lorem.sentence
|
|
231
|
-
token = Crypto.md5
|
|
232
|
-
secret = Crypto.md5
|
|
233
|
-
industry = Commerce.department
|
|
230
|
+
description = Faker::Lorem.sentence
|
|
231
|
+
token = Faker::Crypto.md5
|
|
232
|
+
secret = Faker::Crypto.md5
|
|
233
|
+
industry = Faker::Commerce.department
|
|
234
234
|
url = "http://www.linkedin.com/in/#{first_name}#{last_name}"
|
|
235
235
|
{
|
|
236
236
|
provider: 'linkedin',
|
|
@@ -244,7 +244,7 @@ module Faker
|
|
|
244
244
|
location: location,
|
|
245
245
|
description: description,
|
|
246
246
|
image: image,
|
|
247
|
-
phone: PhoneNumber.phone_number,
|
|
247
|
+
phone: Faker::PhoneNumber.phone_number,
|
|
248
248
|
headline: description,
|
|
249
249
|
industry: industry,
|
|
250
250
|
urls: {
|
|
@@ -275,7 +275,7 @@ module Faker
|
|
|
275
275
|
industry: industry,
|
|
276
276
|
lastName: auth.last_name,
|
|
277
277
|
location: {
|
|
278
|
-
country: { code: Address.country_code.downcase },
|
|
278
|
+
country: { code: Faker::Address.country_code.downcase },
|
|
279
279
|
name: city_state.split(', ').first
|
|
280
280
|
},
|
|
281
281
|
pictureUrl: image,
|
|
@@ -295,8 +295,8 @@ module Faker
|
|
|
295
295
|
# @return [Hash] An auth hash in the format provided by omniauth-github.
|
|
296
296
|
#
|
|
297
297
|
# @faker.version 1.8.0
|
|
298
|
-
def github(name: nil, email: nil, uid: Number.number(digits: 8).to_s)
|
|
299
|
-
auth =
|
|
298
|
+
def github(name: nil, email: nil, uid: Faker::Number.number(digits: 8).to_s)
|
|
299
|
+
auth = new(name: name, email: email)
|
|
300
300
|
login = auth.name.downcase.tr(' ', '-')
|
|
301
301
|
html_url = "https://github.com/#{login}"
|
|
302
302
|
api_url = "https://api.github.com/users/#{login}"
|
|
@@ -346,8 +346,8 @@ module Faker
|
|
|
346
346
|
public_gists: random_number_from_range(1..1000),
|
|
347
347
|
followers: random_number_from_range(1..1000),
|
|
348
348
|
following: random_number_from_range(1..1000),
|
|
349
|
-
created_at: Time.backward(days: 36_400).iso8601,
|
|
350
|
-
updated_at: Time.backward(days: 2).iso8601
|
|
349
|
+
created_at: Faker::Time.backward(days: 36_400).iso8601,
|
|
350
|
+
updated_at: Faker::Time.backward(days: 2).iso8601
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
}
|
|
@@ -364,8 +364,8 @@ module Faker
|
|
|
364
364
|
#
|
|
365
365
|
# @faker.version 2.3.0
|
|
366
366
|
def apple(name: nil, email: nil, uid: nil)
|
|
367
|
-
uid ||= "#{Number.number(digits: 6)}.#{Number.hexadecimal(digits: 32)}.#{Number.number(digits: 4)}"
|
|
368
|
-
auth =
|
|
367
|
+
uid ||= "#{Faker::Number.number(digits: 6)}.#{Faker::Number.hexadecimal(digits: 32)}.#{Faker::Number.number(digits: 4)}"
|
|
368
|
+
auth = new(name: name, email: email)
|
|
369
369
|
{
|
|
370
370
|
provider: 'apple',
|
|
371
371
|
uid: uid,
|
|
@@ -376,20 +376,20 @@ module Faker
|
|
|
376
376
|
last_name: auth.last_name
|
|
377
377
|
},
|
|
378
378
|
credentials: {
|
|
379
|
-
token: Crypto.md5,
|
|
380
|
-
refresh_token: Crypto.md5,
|
|
381
|
-
expires_at: Time.forward.to_i,
|
|
379
|
+
token: Faker::Crypto.md5,
|
|
380
|
+
refresh_token: Faker::Crypto.md5,
|
|
381
|
+
expires_at: Faker::Time.forward.to_i,
|
|
382
382
|
expires: true
|
|
383
383
|
},
|
|
384
384
|
extra: {
|
|
385
385
|
raw_info: {
|
|
386
386
|
iss: 'https://appleid.apple.com',
|
|
387
387
|
aud: 'CLIENT_ID',
|
|
388
|
-
exp: Time.forward.to_i,
|
|
389
|
-
iat: Time.forward.to_i,
|
|
388
|
+
exp: Faker::Time.forward.to_i,
|
|
389
|
+
iat: Faker::Time.forward.to_i,
|
|
390
390
|
sub: uid,
|
|
391
|
-
at_hash: Crypto.md5,
|
|
392
|
-
auth_time: Time.forward.to_i,
|
|
391
|
+
at_hash: Faker::Crypto.md5,
|
|
392
|
+
auth_time: Faker::Time.forward.to_i,
|
|
393
393
|
email: auth.email,
|
|
394
394
|
email_verified: true
|
|
395
395
|
}
|
|
@@ -408,8 +408,8 @@ module Faker
|
|
|
408
408
|
#
|
|
409
409
|
# @faker.version next
|
|
410
410
|
def auth0(name: nil, email: nil, uid: nil)
|
|
411
|
-
uid ||= "auth0|#{Number.hexadecimal(digits: 24)}"
|
|
412
|
-
auth =
|
|
411
|
+
uid ||= "auth0|#{Faker::Number.hexadecimal(digits: 24)}"
|
|
412
|
+
auth = new(name: name, email: email)
|
|
413
413
|
{
|
|
414
414
|
provider: 'auth0',
|
|
415
415
|
uid: uid,
|
|
@@ -423,9 +423,9 @@ module Faker
|
|
|
423
423
|
expires_at: Time.forward.to_i,
|
|
424
424
|
expires: true,
|
|
425
425
|
token_type: 'Bearer',
|
|
426
|
-
id_token: Crypto.sha256,
|
|
427
|
-
token: Crypto.md5,
|
|
428
|
-
refresh_token: Crypto.md5
|
|
426
|
+
id_token: Faker::Crypto.sha256,
|
|
427
|
+
token: Faker::Crypto.md5,
|
|
428
|
+
refresh_token: Faker::Crypto.md5
|
|
429
429
|
},
|
|
430
430
|
extra: {
|
|
431
431
|
raw_info: {
|
|
@@ -434,8 +434,8 @@ module Faker
|
|
|
434
434
|
iss: 'https://auth0.com/',
|
|
435
435
|
sub: uid,
|
|
436
436
|
aud: 'Auth012345',
|
|
437
|
-
iat: Time.forward.to_i,
|
|
438
|
-
exp: Time.forward.to_i
|
|
437
|
+
iat: Faker::Time.forward.to_i,
|
|
438
|
+
exp: Faker::Time.forward.to_i
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
}
|
|
@@ -452,11 +452,11 @@ module Faker
|
|
|
452
452
|
end
|
|
453
453
|
|
|
454
454
|
def image
|
|
455
|
-
Placeholdit.image
|
|
455
|
+
Faker::Placeholdit.image
|
|
456
456
|
end
|
|
457
457
|
|
|
458
458
|
def city_state
|
|
459
|
-
"#{Address.city}, #{Address.state}"
|
|
459
|
+
"#{Faker::Address.city}, #{Faker::Address.state}"
|
|
460
460
|
end
|
|
461
461
|
|
|
462
462
|
def random_number_from_range(range)
|
data/lib/faker/default/string.rb
CHANGED
data/lib/faker/games.rb
ADDED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
module Faker
|
|
4
4
|
class Internet < Base
|
|
5
|
+
if Faker::Config.lazy_loading?
|
|
6
|
+
Faker.lazy_load(self)
|
|
7
|
+
end
|
|
8
|
+
|
|
5
9
|
# Private, Host, and Link-Local network address blocks as defined in https://en.wikipedia.org/wiki/IPv4#Special-use_addresses
|
|
6
10
|
PRIVATE_IPV4_ADDRESS_RANGES = [
|
|
7
11
|
[10..10, 0..255, 0..255, 1..255], # 10.0.0.0/8 - Used for local communications within a private network
|
|
@@ -93,8 +97,8 @@ module Faker
|
|
|
93
97
|
end
|
|
94
98
|
|
|
95
99
|
sample([
|
|
96
|
-
Char.prepare(Name.first_name),
|
|
97
|
-
[Name.first_name, Name.last_name].map do |name|
|
|
100
|
+
Char.prepare(Faker::Name.first_name),
|
|
101
|
+
[Faker::Name.first_name, Faker::Name.last_name].map do |name|
|
|
98
102
|
Char.prepare(name)
|
|
99
103
|
end.join(sample(separators))
|
|
100
104
|
])
|
|
@@ -235,7 +239,7 @@ module Faker
|
|
|
235
239
|
# @example
|
|
236
240
|
# Faker::Internet.domain_word #=> "senger"
|
|
237
241
|
def domain_word
|
|
238
|
-
with_locale(:en) { Char.prepare(Company.name.split.first) }
|
|
242
|
+
with_locale(:en) { Char.prepare(Faker::Company.name.split.first) }
|
|
239
243
|
end
|
|
240
244
|
|
|
241
245
|
## Returns the domain suffix e.g. com, org, co, biz, info etc.
|