faker 2.1.0 → 2.2.2
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 +93 -3
- data/README.md +3 -3
- data/lib/faker.rb +56 -1
- data/lib/faker/blockchain/tezos.rb +6 -6
- data/lib/faker/books/dune.rb +10 -2
- data/lib/faker/books/lovecraft.rb +38 -7
- data/lib/faker/default/address.rb +25 -5
- data/lib/faker/default/alphanumeric.rb +39 -7
- data/lib/faker/default/app.rb +9 -1
- data/lib/faker/default/avatar.rb +11 -1
- data/lib/faker/default/bank.rb +10 -2
- data/lib/faker/default/boolean.rb +5 -1
- data/lib/faker/default/chile_rut.rb +12 -2
- data/lib/faker/default/code.rb +16 -3
- data/lib/faker/default/commerce.rb +17 -3
- data/lib/faker/default/company.rb +10 -2
- data/lib/faker/default/crypto_coin.rb +15 -3
- data/lib/faker/default/date.rb +37 -5
- data/lib/faker/default/demographic.rb +5 -1
- data/lib/faker/default/driving_licence.rb +10 -4
- data/lib/faker/default/file.rb +19 -2
- data/lib/faker/default/fillmurray.rb +9 -1
- data/lib/faker/default/finance.rb +5 -1
- data/lib/faker/default/hipster.rb +45 -6
- data/lib/faker/default/id_number.rb +48 -3
- data/lib/faker/default/internet.rb +89 -13
- data/lib/faker/default/invoice.rb +16 -3
- data/lib/faker/default/json.rb +19 -2
- data/lib/faker/default/lorem.rb +80 -10
- data/lib/faker/default/lorem_flickr.rb +38 -5
- data/lib/faker/default/lorem_pixel.rb +10 -1
- data/lib/faker/default/markdown.rb +6 -1
- data/lib/faker/default/measurement.rb +40 -8
- data/lib/faker/default/name.rb +5 -1
- data/lib/faker/default/nhs.rb +5 -1
- data/lib/faker/default/number.rb +56 -11
- data/lib/faker/default/omniauth.rb +50 -9
- data/lib/faker/default/phone_number.rb +5 -1
- data/lib/faker/default/placeholdit.rb +11 -1
- data/lib/faker/default/relationship.rb +5 -1
- data/lib/faker/default/source.rb +18 -3
- data/lib/faker/default/string.rb +5 -1
- data/lib/faker/default/stripe.rb +20 -4
- data/lib/faker/default/time.rb +37 -4
- data/lib/faker/default/twitter.rb +32 -18
- data/lib/faker/default/types.rb +27 -5
- data/lib/faker/default/vehicle.rb +17 -4
- data/lib/faker/default/world_cup.rb +11 -2
- data/lib/faker/games/dota.rb +5 -1
- data/lib/faker/movies/star_wars.rb +6 -4
- data/lib/faker/version.rb +1 -1
- data/lib/locales/en.yml +0 -49
- data/lib/locales/en/science.yml +1 -1
- metadata +18 -18
@@ -5,23 +5,56 @@ module Faker
|
|
5
5
|
class << self
|
6
6
|
SUPPORTED_COLORIZATIONS = %w[red green blue].freeze
|
7
7
|
|
8
|
-
|
8
|
+
# rubocop:disable Metrics/ParameterLists
|
9
|
+
def image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: [], match_all: false)
|
10
|
+
# rubocop:enable Metrics/ParameterLists
|
11
|
+
warn_for_deprecated_arguments do |keywords|
|
12
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
13
|
+
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
14
|
+
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
15
|
+
end
|
16
|
+
|
9
17
|
build_url(size, nil, search_terms, match_all)
|
10
18
|
end
|
11
19
|
|
12
|
-
|
20
|
+
# rubocop:disable Metrics/ParameterLists
|
21
|
+
def grayscale_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false)
|
22
|
+
# rubocop:enable Metrics/ParameterLists
|
23
|
+
warn_for_deprecated_arguments do |keywords|
|
24
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
25
|
+
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
26
|
+
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
27
|
+
end
|
28
|
+
|
13
29
|
raise ArgumentError, 'Search terms must be specified for grayscale images' unless search_terms.any?
|
14
30
|
|
15
31
|
build_url(size, 'g', search_terms, match_all)
|
16
32
|
end
|
17
33
|
|
18
|
-
|
34
|
+
# rubocop:disable Metrics/ParameterLists
|
35
|
+
def pixelated_image(legacy_size = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', search_terms: ['all'], match_all: false)
|
36
|
+
# rubocop:enable Metrics/ParameterLists
|
37
|
+
warn_for_deprecated_arguments do |keywords|
|
38
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
39
|
+
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
40
|
+
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
41
|
+
end
|
42
|
+
|
19
43
|
raise ArgumentError, 'Search terms must be specified for pixelated images' unless search_terms.any?
|
20
44
|
|
21
45
|
build_url(size, 'p', search_terms, match_all)
|
22
46
|
end
|
23
47
|
|
24
|
-
|
48
|
+
# rubocop:disable Metrics/ParameterLists
|
49
|
+
def colorized_image(legacy_size = NOT_GIVEN, legacy_color = NOT_GIVEN, legacy_search_terms = NOT_GIVEN, legacy_match_all = NOT_GIVEN, size: '300x300', color: 'red', search_terms: ['all'], match_all: false)
|
50
|
+
# rubocop:enable Metrics/ParameterLists
|
51
|
+
warn_for_deprecated_arguments do |keywords|
|
52
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
53
|
+
keywords << :color if legacy_color != NOT_GIVEN
|
54
|
+
keywords << :search_terms if legacy_search_terms != NOT_GIVEN
|
55
|
+
keywords << :match_all if legacy_match_all != NOT_GIVEN
|
56
|
+
end
|
57
|
+
|
25
58
|
raise ArgumentError, 'Search terms must be specified for colorized images' unless search_terms.any?
|
26
59
|
raise ArgumentError, "Supported colorizations are #{SUPPORTED_COLORIZATIONS.join(', ')}" unless SUPPORTED_COLORIZATIONS.include?(color)
|
27
60
|
|
@@ -33,7 +66,7 @@ module Faker
|
|
33
66
|
def build_url(size, format, search_terms, match_all)
|
34
67
|
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
|
35
68
|
|
36
|
-
url_parts = ['
|
69
|
+
url_parts = ['https://loremflickr.com']
|
37
70
|
url_parts << format
|
38
71
|
url_parts += size.split('x')
|
39
72
|
url_parts << search_terms.compact.join(',') if search_terms.any?
|
@@ -18,7 +18,16 @@ module Faker
|
|
18
18
|
transport].freeze
|
19
19
|
|
20
20
|
# rubocop:disable Metrics/ParameterLists
|
21
|
-
def image(size: '300x300', is_gray: false, category: nil, number: nil, text: nil, secure: true)
|
21
|
+
def image(legacy_size = NOT_GIVEN, legacy_is_gray = NOT_GIVEN, legacy_category = NOT_GIVEN, legacy_number = NOT_GIVEN, legacy_text = NOT_GIVEN, legacy_secure = NOT_GIVEN, size: '300x300', is_gray: false, category: nil, number: nil, text: nil, secure: true)
|
22
|
+
warn_for_deprecated_arguments do |keywords|
|
23
|
+
keywords << :size if legacy_size != NOT_GIVEN
|
24
|
+
keywords << :is_gray if legacy_is_gray != NOT_GIVEN
|
25
|
+
keywords << :category if legacy_category != NOT_GIVEN
|
26
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
27
|
+
keywords << :text if legacy_text != NOT_GIVEN
|
28
|
+
keywords << :secure if legacy_secure != NOT_GIVEN
|
29
|
+
end
|
30
|
+
|
22
31
|
raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
|
23
32
|
raise ArgumentError, "Supported categories are #{SUPPORTED_CATEGORIES.join(', ')}" unless category.nil? || SUPPORTED_CATEGORIES.include?(category)
|
24
33
|
raise ArgumentError, 'Category required when number is passed' if !number.nil? && category.nil?
|
@@ -59,7 +59,12 @@ module Faker
|
|
59
59
|
send(method_list[rand(0..method_list.length - 1)])
|
60
60
|
end
|
61
61
|
|
62
|
-
def sandwich(sentences: 3, repeat: 1)
|
62
|
+
def sandwich(legacy_sentences = NOT_GIVEN, legacy_repeat = NOT_GIVEN, sentences: 3, repeat: 1)
|
63
|
+
warn_for_deprecated_arguments do |keywords|
|
64
|
+
keywords << :sentences if legacy_sentences != NOT_GIVEN
|
65
|
+
keywords << :repeat if legacy_repeat != NOT_GIVEN
|
66
|
+
end
|
67
|
+
|
63
68
|
text_block = []
|
64
69
|
text_block << headers
|
65
70
|
repeat.times do
|
@@ -6,35 +6,67 @@ module Faker
|
|
6
6
|
ALL = 'all'
|
7
7
|
NONE = 'none'
|
8
8
|
|
9
|
-
def height(amount: rand(10))
|
9
|
+
def height(legacy_amount = NOT_GIVEN, amount: rand(10))
|
10
|
+
warn_for_deprecated_arguments do |keywords|
|
11
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
12
|
+
end
|
13
|
+
|
10
14
|
define_measurement_locale(amount, 'height')
|
11
15
|
end
|
12
16
|
|
13
|
-
def length(amount: rand(10))
|
17
|
+
def length(legacy_amount = NOT_GIVEN, amount: rand(10))
|
18
|
+
warn_for_deprecated_arguments do |keywords|
|
19
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
20
|
+
end
|
21
|
+
|
14
22
|
define_measurement_locale(amount, 'length')
|
15
23
|
end
|
16
24
|
|
17
|
-
def volume(amount: rand(10))
|
25
|
+
def volume(legacy_amount = NOT_GIVEN, amount: rand(10))
|
26
|
+
warn_for_deprecated_arguments do |keywords|
|
27
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
28
|
+
end
|
29
|
+
|
18
30
|
define_measurement_locale(amount, 'volume')
|
19
31
|
end
|
20
32
|
|
21
|
-
def weight(amount: rand(10))
|
33
|
+
def weight(legacy_amount = NOT_GIVEN, amount: rand(10))
|
34
|
+
warn_for_deprecated_arguments do |keywords|
|
35
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
36
|
+
end
|
37
|
+
|
22
38
|
define_measurement_locale(amount, 'weight')
|
23
39
|
end
|
24
40
|
|
25
|
-
def metric_height(amount: rand(10))
|
41
|
+
def metric_height(legacy_amount = NOT_GIVEN, amount: rand(10))
|
42
|
+
warn_for_deprecated_arguments do |keywords|
|
43
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
44
|
+
end
|
45
|
+
|
26
46
|
define_measurement_locale(amount, 'metric_height')
|
27
47
|
end
|
28
48
|
|
29
|
-
def metric_length(amount: rand(10))
|
49
|
+
def metric_length(legacy_amount = NOT_GIVEN, amount: rand(10))
|
50
|
+
warn_for_deprecated_arguments do |keywords|
|
51
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
52
|
+
end
|
53
|
+
|
30
54
|
define_measurement_locale(amount, 'metric_length')
|
31
55
|
end
|
32
56
|
|
33
|
-
def metric_volume(amount: rand(10))
|
57
|
+
def metric_volume(legacy_amount = NOT_GIVEN, amount: rand(10))
|
58
|
+
warn_for_deprecated_arguments do |keywords|
|
59
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
60
|
+
end
|
61
|
+
|
34
62
|
define_measurement_locale(amount, 'metric_volume')
|
35
63
|
end
|
36
64
|
|
37
|
-
def metric_weight(amount: rand(10))
|
65
|
+
def metric_weight(legacy_amount = NOT_GIVEN, amount: rand(10))
|
66
|
+
warn_for_deprecated_arguments do |keywords|
|
67
|
+
keywords << :amount if legacy_amount != NOT_GIVEN
|
68
|
+
end
|
69
|
+
|
38
70
|
define_measurement_locale(amount, 'metric_weight')
|
39
71
|
end
|
40
72
|
|
data/lib/faker/default/name.rb
CHANGED
@@ -46,7 +46,11 @@ module Faker
|
|
46
46
|
fetch('name.suffix')
|
47
47
|
end
|
48
48
|
|
49
|
-
def initials(number: 3)
|
49
|
+
def initials(legacy_number = NOT_GIVEN, number: 3)
|
50
|
+
warn_for_deprecated_arguments do |keywords|
|
51
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
52
|
+
end
|
53
|
+
|
50
54
|
(0...number).map { rand(65..90).chr }.join
|
51
55
|
end
|
52
56
|
end
|
data/lib/faker/default/nhs.rb
CHANGED
@@ -15,7 +15,11 @@ module Faker
|
|
15
15
|
.join('')
|
16
16
|
end
|
17
17
|
|
18
|
-
def check_digit(number: 0)
|
18
|
+
def check_digit(legacy_number = NOT_GIVEN, number: 0)
|
19
|
+
warn_for_deprecated_arguments do |keywords|
|
20
|
+
keywords << :number if legacy_number != NOT_GIVEN
|
21
|
+
end
|
22
|
+
|
19
23
|
sum = 0
|
20
24
|
number.to_s.chars.each_with_index do |digit, idx|
|
21
25
|
position = idx + 1
|
data/lib/faker/default/number.rb
CHANGED
@@ -3,19 +3,31 @@
|
|
3
3
|
module Faker
|
4
4
|
class Number < Base
|
5
5
|
class << self
|
6
|
-
def number(digits: 10)
|
6
|
+
def number(legacy_digits = NOT_GIVEN, digits: 10)
|
7
|
+
warn_for_deprecated_arguments do |keywords|
|
8
|
+
keywords << :digits if legacy_digits != NOT_GIVEN
|
9
|
+
end
|
10
|
+
|
7
11
|
return if digits < 1
|
8
|
-
return 0 if digits == 1
|
12
|
+
return rand(0..9).round if digits == 1
|
9
13
|
|
10
14
|
# Ensure the first digit is not zero
|
11
15
|
([non_zero_digit] + generate(digits - 1)).join.to_i
|
12
16
|
end
|
13
17
|
|
14
|
-
def leading_zero_number(digits: 10)
|
18
|
+
def leading_zero_number(legacy_digits = NOT_GIVEN, digits: 10)
|
19
|
+
warn_for_deprecated_arguments do |keywords|
|
20
|
+
keywords << :digits if legacy_digits != NOT_GIVEN
|
21
|
+
end
|
22
|
+
|
15
23
|
'0' + (2..digits).collect { digit }.join
|
16
24
|
end
|
17
25
|
|
18
|
-
def decimal_part(digits: 10)
|
26
|
+
def decimal_part(legacy_digits = NOT_GIVEN, digits: 10)
|
27
|
+
warn_for_deprecated_arguments do |keywords|
|
28
|
+
keywords << :digits if legacy_digits != NOT_GIVEN
|
29
|
+
end
|
30
|
+
|
19
31
|
num = ''
|
20
32
|
if digits > 1
|
21
33
|
num = non_zero_digit
|
@@ -24,7 +36,12 @@ module Faker
|
|
24
36
|
leading_zero_number(digits: digits) + num.to_s
|
25
37
|
end
|
26
38
|
|
27
|
-
def decimal(l_digits: 5, r_digits: 2)
|
39
|
+
def decimal(legacy_l_digits = NOT_GIVEN, legacy_r_digits = NOT_GIVEN, l_digits: 5, r_digits: 2)
|
40
|
+
warn_for_deprecated_arguments do |keywords|
|
41
|
+
keywords << :l_digits if legacy_l_digits != NOT_GIVEN
|
42
|
+
keywords << :r_digits if legacy_r_digits != NOT_GIVEN
|
43
|
+
end
|
44
|
+
|
28
45
|
l_d = number(digits: l_digits)
|
29
46
|
r_d = if r_digits == 1
|
30
47
|
generate(r_digits)
|
@@ -44,34 +61,62 @@ module Faker
|
|
44
61
|
rand(10)
|
45
62
|
end
|
46
63
|
|
47
|
-
def hexadecimal(digits: 6)
|
64
|
+
def hexadecimal(legacy_digits = NOT_GIVEN, digits: 6)
|
65
|
+
warn_for_deprecated_arguments do |keywords|
|
66
|
+
keywords << :digits if legacy_digits != NOT_GIVEN
|
67
|
+
end
|
68
|
+
|
48
69
|
hex = ''
|
49
70
|
digits.times { hex += rand(15).to_s(16) }
|
50
71
|
hex
|
51
72
|
end
|
52
73
|
|
53
|
-
def normal(mean: 1, standard_deviation: 1)
|
74
|
+
def normal(legacy_mean = NOT_GIVEN, legacy_standard_deviation = NOT_GIVEN, mean: 1, standard_deviation: 1)
|
75
|
+
warn_for_deprecated_arguments do |keywords|
|
76
|
+
keywords << :mean if legacy_mean != NOT_GIVEN
|
77
|
+
keywords << :standard_deviation if legacy_standard_deviation != NOT_GIVEN
|
78
|
+
end
|
79
|
+
|
54
80
|
theta = 2 * Math::PI * rand
|
55
81
|
rho = Math.sqrt(-2 * Math.log(1 - rand))
|
56
82
|
scale = standard_deviation * rho
|
57
83
|
mean + scale * Math.cos(theta)
|
58
84
|
end
|
59
85
|
|
60
|
-
def between(from: 1.00, to: 5000.00)
|
86
|
+
def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
|
87
|
+
warn_for_deprecated_arguments do |keywords|
|
88
|
+
keywords << :from if legacy_from != NOT_GIVEN
|
89
|
+
keywords << :to if legacy_to != NOT_GIVEN
|
90
|
+
end
|
91
|
+
|
61
92
|
Faker::Base.rand_in_range(from, to)
|
62
93
|
end
|
63
94
|
|
64
|
-
def within(range: 1.00..5000.00)
|
95
|
+
def within(legacy_range = NOT_GIVEN, range: 1.00..5000.00)
|
96
|
+
warn_for_deprecated_arguments do |keywords|
|
97
|
+
keywords << :range if legacy_range != NOT_GIVEN
|
98
|
+
end
|
99
|
+
|
65
100
|
between(from: range.min, to: range.max)
|
66
101
|
end
|
67
102
|
|
68
|
-
def positive(from: 1.00, to: 5000.00)
|
103
|
+
def positive(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
|
104
|
+
warn_for_deprecated_arguments do |keywords|
|
105
|
+
keywords << :from if legacy_from != NOT_GIVEN
|
106
|
+
keywords << :to if legacy_to != NOT_GIVEN
|
107
|
+
end
|
108
|
+
|
69
109
|
random_number = between(from: from, to: to)
|
70
110
|
|
71
111
|
greater_than_zero(random_number)
|
72
112
|
end
|
73
113
|
|
74
|
-
def negative(from: -5000.00, to: -1.00)
|
114
|
+
def negative(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: -5000.00, to: -1.00)
|
115
|
+
warn_for_deprecated_arguments do |keywords|
|
116
|
+
keywords << :from if legacy_from != NOT_GIVEN
|
117
|
+
keywords << :to if legacy_to != NOT_GIVEN
|
118
|
+
end
|
119
|
+
|
75
120
|
random_number = between(from: from, to: to)
|
76
121
|
|
77
122
|
less_than_zero(random_number)
|
@@ -15,7 +15,15 @@ module Faker
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class << self
|
18
|
-
|
18
|
+
# rubocop:disable Metrics/ParameterLists
|
19
|
+
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)
|
20
|
+
# rubocop:enable Metrics/ParameterLists
|
21
|
+
warn_for_deprecated_arguments do |keywords|
|
22
|
+
keywords << :name if legacy_name != NOT_GIVEN
|
23
|
+
keywords << :email if legacy_email != NOT_GIVEN
|
24
|
+
keywords << :uid if legacy_uid != NOT_GIVEN
|
25
|
+
end
|
26
|
+
|
19
27
|
auth = Omniauth.new(name: name, email: email)
|
20
28
|
{
|
21
29
|
provider: 'google_oauth2',
|
@@ -27,7 +35,7 @@ module Faker
|
|
27
35
|
email: auth.email,
|
28
36
|
image: image
|
29
37
|
},
|
30
|
-
credentials:
|
38
|
+
credentials: {
|
31
39
|
token: Crypto.md5,
|
32
40
|
refresh_token: Crypto.md5,
|
33
41
|
expires_at: Time.forward.to_i,
|
@@ -35,7 +43,7 @@ module Faker
|
|
35
43
|
},
|
36
44
|
extra: {
|
37
45
|
raw_info: {
|
38
|
-
sub:
|
46
|
+
sub: uid,
|
39
47
|
email: auth.email,
|
40
48
|
email_verified: random_boolean.to_s,
|
41
49
|
name: auth.name,
|
@@ -64,7 +72,16 @@ module Faker
|
|
64
72
|
}
|
65
73
|
end
|
66
74
|
|
67
|
-
|
75
|
+
# rubocop:disable Metrics/ParameterLists
|
76
|
+
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)
|
77
|
+
# rubocop:enable Metrics/ParameterLists
|
78
|
+
warn_for_deprecated_arguments do |keywords|
|
79
|
+
keywords << :name if legacy_name != NOT_GIVEN
|
80
|
+
keywords << :email if legacy_email != NOT_GIVEN
|
81
|
+
keywords << :username if legacy_username != NOT_GIVEN
|
82
|
+
keywords << :uid if legacy_uid != NOT_GIVEN
|
83
|
+
end
|
84
|
+
|
68
85
|
auth = Omniauth.new(name: name, email: email)
|
69
86
|
username ||= "#{auth.first_name.downcase[0]}#{auth.last_name.downcase}"
|
70
87
|
{
|
@@ -106,7 +123,15 @@ module Faker
|
|
106
123
|
}
|
107
124
|
end
|
108
125
|
|
109
|
-
|
126
|
+
# rubocop:disable Metrics/ParameterLists
|
127
|
+
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)
|
128
|
+
# rubocop:enable Metrics/ParameterLists
|
129
|
+
warn_for_deprecated_arguments do |keywords|
|
130
|
+
keywords << :name if legacy_name != NOT_GIVEN
|
131
|
+
keywords << :nickname if legacy_nickname != NOT_GIVEN
|
132
|
+
keywords << :uid if legacy_uid != NOT_GIVEN
|
133
|
+
end
|
134
|
+
|
110
135
|
auth = Omniauth.new(name: name)
|
111
136
|
nickname ||= auth.name.downcase.delete(' ')
|
112
137
|
location = city_state
|
@@ -179,7 +204,15 @@ module Faker
|
|
179
204
|
}
|
180
205
|
end
|
181
206
|
|
182
|
-
|
207
|
+
# rubocop:disable Metrics/ParameterLists
|
208
|
+
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)
|
209
|
+
# rubocop:enable Metrics/ParameterLists
|
210
|
+
warn_for_deprecated_arguments do |keywords|
|
211
|
+
keywords << :name if legacy_name != NOT_GIVEN
|
212
|
+
keywords << :email if legacy_email != NOT_GIVEN
|
213
|
+
keywords << :uid if legacy_uid != NOT_GIVEN
|
214
|
+
end
|
215
|
+
|
183
216
|
auth = Omniauth.new(name: name, email: email)
|
184
217
|
first_name = auth.first_name.downcase
|
185
218
|
last_name = auth.last_name.downcase
|
@@ -242,7 +275,15 @@ module Faker
|
|
242
275
|
}
|
243
276
|
end
|
244
277
|
|
245
|
-
|
278
|
+
# rubocop:disable Metrics/ParameterLists
|
279
|
+
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)
|
280
|
+
# rubocop:enable Metrics/ParameterLists
|
281
|
+
warn_for_deprecated_arguments do |keywords|
|
282
|
+
keywords << :name if legacy_name != NOT_GIVEN
|
283
|
+
keywords << :email if legacy_email != NOT_GIVEN
|
284
|
+
keywords << :uid if legacy_uid != NOT_GIVEN
|
285
|
+
end
|
286
|
+
|
246
287
|
auth = Omniauth.new(name: name, email: email)
|
247
288
|
login = auth.name.downcase.tr(' ', '-')
|
248
289
|
html_url = "https://github.com/#{login}"
|
@@ -261,7 +302,7 @@ module Faker
|
|
261
302
|
},
|
262
303
|
credentials: {
|
263
304
|
token: Crypto.md5,
|
264
|
-
expires:
|
305
|
+
expires: false
|
265
306
|
},
|
266
307
|
extra: {
|
267
308
|
raw_info: {
|
@@ -281,7 +322,7 @@ module Faker
|
|
281
322
|
events_url: "#{api_url}/events{/privacy}",
|
282
323
|
received_events_url: "#{api_url}/received_events",
|
283
324
|
type: 'User',
|
284
|
-
site_admin:
|
325
|
+
site_admin: random_boolean,
|
285
326
|
name: auth.name,
|
286
327
|
company: nil,
|
287
328
|
blog: nil,
|
@@ -40,7 +40,11 @@ module Faker
|
|
40
40
|
# US and Canada only
|
41
41
|
# Can be used for both extensions and last four digits of phone number.
|
42
42
|
# Since extensions can be of variable length, this method taks a length parameter
|
43
|
-
def subscriber_number(length: 4)
|
43
|
+
def subscriber_number(legacy_length = NOT_GIVEN, length: 4)
|
44
|
+
warn_for_deprecated_arguments do |keywords|
|
45
|
+
keywords << :length if legacy_length != NOT_GIVEN
|
46
|
+
end
|
47
|
+
|
44
48
|
rand.to_s[2..(1 + length)]
|
45
49
|
end
|
46
50
|
|