faker 2.2.1 → 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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -0
  3. data/lib/faker.rb +34 -0
  4. data/lib/faker/blockchain/tezos.rb +6 -6
  5. data/lib/faker/books/dune.rb +4 -6
  6. data/lib/faker/books/lovecraft.rb +17 -33
  7. data/lib/faker/default/address.rb +10 -15
  8. data/lib/faker/default/alphanumeric.rb +6 -12
  9. data/lib/faker/default/app.rb +4 -11
  10. data/lib/faker/default/avatar.rb +6 -19
  11. data/lib/faker/default/bank.rb +4 -6
  12. data/lib/faker/default/boolean.rb +2 -3
  13. data/lib/faker/default/chile_rut.rb +6 -14
  14. data/lib/faker/default/code.rb +7 -13
  15. data/lib/faker/default/commerce.rb +8 -17
  16. data/lib/faker/default/company.rb +4 -6
  17. data/lib/faker/default/crypto_coin.rb +6 -9
  18. data/lib/faker/default/date.rb +17 -28
  19. data/lib/faker/default/demographic.rb +2 -3
  20. data/lib/faker/default/driving_licence.rb +5 -15
  21. data/lib/faker/default/file.rb +9 -26
  22. data/lib/faker/default/fillmurray.rb +4 -11
  23. data/lib/faker/default/finance.rb +2 -3
  24. data/lib/faker/default/hipster.rb +21 -54
  25. data/lib/faker/default/id_number.rb +5 -7
  26. data/lib/faker/default/internet.rb +30 -65
  27. data/lib/faker/default/invoice.rb +7 -13
  28. data/lib/faker/default/json.rb +9 -16
  29. data/lib/faker/default/lorem.rb +30 -70
  30. data/lib/faker/default/lorem_flickr.rb +17 -48
  31. data/lib/faker/default/lorem_pixel.rb +7 -23
  32. data/lib/faker/default/markdown.rb +3 -7
  33. data/lib/faker/default/measurement.rb +16 -24
  34. data/lib/faker/default/name.rb +2 -3
  35. data/lib/faker/default/nhs.rb +2 -3
  36. data/lib/faker/default/number.rb +25 -50
  37. data/lib/faker/default/omniauth.rb +25 -63
  38. data/lib/faker/default/phone_number.rb +2 -3
  39. data/lib/faker/default/placeholdit.rb +6 -19
  40. data/lib/faker/default/relationship.rb +2 -3
  41. data/lib/faker/default/source.rb +8 -12
  42. data/lib/faker/default/string.rb +2 -3
  43. data/lib/faker/default/stripe.rb +8 -12
  44. data/lib/faker/default/time.rb +17 -48
  45. data/lib/faker/default/twitter.rb +23 -32
  46. data/lib/faker/default/types.rb +12 -23
  47. data/lib/faker/default/vehicle.rb +8 -14
  48. data/lib/faker/default/world_cup.rb +5 -10
  49. data/lib/faker/games/dota.rb +2 -3
  50. data/lib/faker/movies/star_wars.rb +3 -6
  51. data/lib/faker/version.rb +1 -1
  52. data/lib/locales/en/science.yml +1 -1
  53. metadata +13 -13
@@ -19,29 +19,13 @@ module Faker
19
19
 
20
20
  # rubocop:disable Metrics/ParameterLists
21
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
- if legacy_size != NOT_GIVEN
23
- warn_with_uplevel 'Passing `size` with the 1st argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(size: ...)` instead.', uplevel: 1
24
- size = legacy_size
25
- end
26
- if legacy_is_gray != NOT_GIVEN
27
- warn_with_uplevel 'Passing `is_gray` with the 2nd argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(is_gray: ...)` instead.', uplevel: 1
28
- is_gray = legacy_is_gray
29
- end
30
- if legacy_category != NOT_GIVEN
31
- warn_with_uplevel 'Passing `category` with the 3rd argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(category: ...)` instead.', uplevel: 1
32
- category = legacy_category
33
- end
34
- if legacy_number != NOT_GIVEN
35
- warn_with_uplevel 'Passing `number` with the 4th argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(number: ...)` instead.', uplevel: 1
36
- number = legacy_number
37
- end
38
- if legacy_text != NOT_GIVEN
39
- warn_with_uplevel 'Passing `text` with the 5th argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(text: ...)` instead.', uplevel: 1
40
- text = legacy_text
41
- end
42
- if legacy_secure != NOT_GIVEN
43
- warn_with_uplevel 'Passing `secure` with the 6th argument of `LoremPixel.image` is deprecated. Use keyword argument like `LoremPixel.image(secure: ...)` instead.', uplevel: 1
44
- secure = legacy_secure
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
45
29
  end
46
30
 
47
31
  raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /^[0-9]+x[0-9]+$/
@@ -60,13 +60,9 @@ module Faker
60
60
  end
61
61
 
62
62
  def sandwich(legacy_sentences = NOT_GIVEN, legacy_repeat = NOT_GIVEN, sentences: 3, repeat: 1)
63
- if legacy_sentences != NOT_GIVEN
64
- warn_with_uplevel 'Passing `sentences` with the 1st argument of `Markdown.sandwich` is deprecated. Use keyword argument like `Markdown.sandwich(sentences: ...)` instead.', uplevel: 1
65
- sentences = legacy_sentences
66
- end
67
- if legacy_repeat != NOT_GIVEN
68
- warn_with_uplevel 'Passing `repeat` with the 2nd argument of `Markdown.sandwich` is deprecated. Use keyword argument like `Markdown.sandwich(repeat: ...)` instead.', uplevel: 1
69
- repeat = legacy_repeat
63
+ warn_for_deprecated_arguments do |keywords|
64
+ keywords << :sentences if legacy_sentences != NOT_GIVEN
65
+ keywords << :repeat if legacy_repeat != NOT_GIVEN
70
66
  end
71
67
 
72
68
  text_block = []
@@ -7,72 +7,64 @@ module Faker
7
7
  NONE = 'none'
8
8
 
9
9
  def height(legacy_amount = NOT_GIVEN, amount: rand(10))
10
- if legacy_amount != NOT_GIVEN
11
- warn_with_uplevel 'Passing `amount` with the 1st argument of `Measurement.height` is deprecated. Use keyword argument like `Measurement.height(amount: ...)` instead.', uplevel: 1
12
- amount = legacy_amount
10
+ warn_for_deprecated_arguments do |keywords|
11
+ keywords << :amount if legacy_amount != NOT_GIVEN
13
12
  end
14
13
 
15
14
  define_measurement_locale(amount, 'height')
16
15
  end
17
16
 
18
17
  def length(legacy_amount = NOT_GIVEN, amount: rand(10))
19
- if legacy_amount != NOT_GIVEN
20
- warn_with_uplevel 'Passing `amount` with the 1st argument of `Measurement.length` is deprecated. Use keyword argument like `Measurement.length(amount: ...)` instead.', uplevel: 1
21
- amount = legacy_amount
18
+ warn_for_deprecated_arguments do |keywords|
19
+ keywords << :amount if legacy_amount != NOT_GIVEN
22
20
  end
23
21
 
24
22
  define_measurement_locale(amount, 'length')
25
23
  end
26
24
 
27
25
  def volume(legacy_amount = NOT_GIVEN, amount: rand(10))
28
- if legacy_amount != NOT_GIVEN
29
- warn_with_uplevel 'Passing `amount` with the 1st argument of `Measurement.volume` is deprecated. Use keyword argument like `Measurement.volume(amount: ...)` instead.', uplevel: 1
30
- amount = legacy_amount
26
+ warn_for_deprecated_arguments do |keywords|
27
+ keywords << :amount if legacy_amount != NOT_GIVEN
31
28
  end
32
29
 
33
30
  define_measurement_locale(amount, 'volume')
34
31
  end
35
32
 
36
33
  def weight(legacy_amount = NOT_GIVEN, amount: rand(10))
37
- if legacy_amount != NOT_GIVEN
38
- warn_with_uplevel 'Passing `amount` with the 1st argument of `Measurement.weight` is deprecated. Use keyword argument like `Measurement.weight(amount: ...)` instead.', uplevel: 1
39
- amount = legacy_amount
34
+ warn_for_deprecated_arguments do |keywords|
35
+ keywords << :amount if legacy_amount != NOT_GIVEN
40
36
  end
41
37
 
42
38
  define_measurement_locale(amount, 'weight')
43
39
  end
44
40
 
45
41
  def metric_height(legacy_amount = NOT_GIVEN, amount: rand(10))
46
- if legacy_amount != NOT_GIVEN
47
- warn_with_uplevel 'Passing `amount` with the 1st argument of `Measurement.metric_height` is deprecated. Use keyword argument like `Measurement.metric_height(amount: ...)` instead.', uplevel: 1
48
- amount = legacy_amount
42
+ warn_for_deprecated_arguments do |keywords|
43
+ keywords << :amount if legacy_amount != NOT_GIVEN
49
44
  end
50
45
 
51
46
  define_measurement_locale(amount, 'metric_height')
52
47
  end
53
48
 
54
49
  def metric_length(legacy_amount = NOT_GIVEN, amount: rand(10))
55
- if legacy_amount != NOT_GIVEN
56
- warn_with_uplevel 'Passing `amount` with the 1st argument of `Measurement.metric_length` is deprecated. Use keyword argument like `Measurement.metric_length(amount: ...)` instead.', uplevel: 1
57
- amount = legacy_amount
50
+ warn_for_deprecated_arguments do |keywords|
51
+ keywords << :amount if legacy_amount != NOT_GIVEN
58
52
  end
59
53
 
60
54
  define_measurement_locale(amount, 'metric_length')
61
55
  end
62
56
 
63
57
  def metric_volume(legacy_amount = NOT_GIVEN, amount: rand(10))
64
- if legacy_amount != NOT_GIVEN
65
- warn_with_uplevel 'Passing `amount` with the 1st argument of `Measurement.metric_volume` is deprecated. Use keyword argument like `Measurement.metric_volume(amount: ...)` instead.', uplevel: 1
66
- amount = legacy_amount
58
+ warn_for_deprecated_arguments do |keywords|
59
+ keywords << :amount if legacy_amount != NOT_GIVEN
67
60
  end
68
61
 
69
62
  define_measurement_locale(amount, 'metric_volume')
70
63
  end
71
64
 
72
65
  def metric_weight(legacy_amount = NOT_GIVEN, amount: rand(10))
73
- if legacy_amount != NOT_GIVEN
74
- warn_with_uplevel 'Passing `amount` with the 1st argument of `Measurement.metric_weight` is deprecated. Use keyword argument like `Measurement.metric_weight(amount: ...)` instead.', uplevel: 1
75
- amount = legacy_amount
66
+ warn_for_deprecated_arguments do |keywords|
67
+ keywords << :amount if legacy_amount != NOT_GIVEN
76
68
  end
77
69
 
78
70
  define_measurement_locale(amount, 'metric_weight')
@@ -47,9 +47,8 @@ module Faker
47
47
  end
48
48
 
49
49
  def initials(legacy_number = NOT_GIVEN, number: 3)
50
- if legacy_number != NOT_GIVEN
51
- warn_with_uplevel 'Passing `number` with the 1st argument of `Name.initials` is deprecated. Use keyword argument like `Name.initials(number: ...)` instead.', uplevel: 1
52
- number = legacy_number
50
+ warn_for_deprecated_arguments do |keywords|
51
+ keywords << :number if legacy_number != NOT_GIVEN
53
52
  end
54
53
 
55
54
  (0...number).map { rand(65..90).chr }.join
@@ -16,9 +16,8 @@ module Faker
16
16
  end
17
17
 
18
18
  def check_digit(legacy_number = NOT_GIVEN, number: 0)
19
- if legacy_number != NOT_GIVEN
20
- warn_with_uplevel 'Passing `number` with the 1st argument of `NationalHealthService.check_digit` is deprecated. Use keyword argument like `NationalHealthService.check_digit(number: ...)` instead.', uplevel: 1
21
- number = legacy_number
19
+ warn_for_deprecated_arguments do |keywords|
20
+ keywords << :number if legacy_number != NOT_GIVEN
22
21
  end
23
22
 
24
23
  sum = 0
@@ -4,9 +4,8 @@ module Faker
4
4
  class Number < Base
5
5
  class << self
6
6
  def number(legacy_digits = NOT_GIVEN, digits: 10)
7
- if legacy_digits != NOT_GIVEN
8
- warn_with_uplevel 'Passing `digits` with the 1st argument of `Number.number` is deprecated. Use keyword argument like `Number.number(digits: ...)` instead.', uplevel: 1
9
- digits = legacy_digits
7
+ warn_for_deprecated_arguments do |keywords|
8
+ keywords << :digits if legacy_digits != NOT_GIVEN
10
9
  end
11
10
 
12
11
  return if digits < 1
@@ -17,18 +16,16 @@ module Faker
17
16
  end
18
17
 
19
18
  def leading_zero_number(legacy_digits = NOT_GIVEN, digits: 10)
20
- if legacy_digits != NOT_GIVEN
21
- warn_with_uplevel 'Passing `digits` with the 1st argument of `Number.leading_zero_number` is deprecated. Use keyword argument like `Number.leading_zero_number(digits: ...)` instead.', uplevel: 1
22
- digits = legacy_digits
19
+ warn_for_deprecated_arguments do |keywords|
20
+ keywords << :digits if legacy_digits != NOT_GIVEN
23
21
  end
24
22
 
25
23
  '0' + (2..digits).collect { digit }.join
26
24
  end
27
25
 
28
26
  def decimal_part(legacy_digits = NOT_GIVEN, digits: 10)
29
- if legacy_digits != NOT_GIVEN
30
- warn_with_uplevel 'Passing `digits` with the 1st argument of `Number.decimal_part` is deprecated. Use keyword argument like `Number.decimal_part(digits: ...)` instead.', uplevel: 1
31
- digits = legacy_digits
27
+ warn_for_deprecated_arguments do |keywords|
28
+ keywords << :digits if legacy_digits != NOT_GIVEN
32
29
  end
33
30
 
34
31
  num = ''
@@ -40,13 +37,9 @@ module Faker
40
37
  end
41
38
 
42
39
  def decimal(legacy_l_digits = NOT_GIVEN, legacy_r_digits = NOT_GIVEN, l_digits: 5, r_digits: 2)
43
- if legacy_l_digits != NOT_GIVEN
44
- warn_with_uplevel 'Passing `l_digits` with the 1st argument of `Number.decimal` is deprecated. Use keyword argument like `Number.decimal(l_digits: ...)` instead.', uplevel: 1
45
- l_digits = legacy_l_digits
46
- end
47
- if legacy_r_digits != NOT_GIVEN
48
- warn_with_uplevel 'Passing `r_digits` with the 2nd argument of `Number.decimal` is deprecated. Use keyword argument like `Number.decimal(r_digits: ...)` instead.', uplevel: 1
49
- r_digits = legacy_r_digits
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
50
43
  end
51
44
 
52
45
  l_d = number(digits: l_digits)
@@ -69,9 +62,8 @@ module Faker
69
62
  end
70
63
 
71
64
  def hexadecimal(legacy_digits = NOT_GIVEN, digits: 6)
72
- if legacy_digits != NOT_GIVEN
73
- warn_with_uplevel 'Passing `digits` with the 1st argument of `Number.hexadecimal` is deprecated. Use keyword argument like `Number.hexadecimal(digits: ...)` instead.', uplevel: 1
74
- digits = legacy_digits
65
+ warn_for_deprecated_arguments do |keywords|
66
+ keywords << :digits if legacy_digits != NOT_GIVEN
75
67
  end
76
68
 
77
69
  hex = ''
@@ -80,13 +72,9 @@ module Faker
80
72
  end
81
73
 
82
74
  def normal(legacy_mean = NOT_GIVEN, legacy_standard_deviation = NOT_GIVEN, mean: 1, standard_deviation: 1)
83
- if legacy_mean != NOT_GIVEN
84
- warn_with_uplevel 'Passing `mean` with the 1st argument of `Number.normal` is deprecated. Use keyword argument like `Number.normal(mean: ...)` instead.', uplevel: 1
85
- mean = legacy_mean
86
- end
87
- if legacy_standard_deviation != NOT_GIVEN
88
- warn_with_uplevel 'Passing `standard_deviation` with the 2nd argument of `Number.normal` is deprecated. Use keyword argument like `Number.normal(standard_deviation: ...)` instead.', uplevel: 1
89
- standard_deviation = legacy_standard_deviation
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
90
78
  end
91
79
 
92
80
  theta = 2 * Math::PI * rand
@@ -96,35 +84,26 @@ module Faker
96
84
  end
97
85
 
98
86
  def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
99
- if legacy_from != NOT_GIVEN
100
- warn_with_uplevel 'Passing `from` with the 1st argument of `Number.between` is deprecated. Use keyword argument like `Number.between(from: ...)` instead.', uplevel: 1
101
- from = legacy_from
102
- end
103
- if legacy_to != NOT_GIVEN
104
- warn_with_uplevel 'Passing `to` with the 2nd argument of `Number.between` is deprecated. Use keyword argument like `Number.between(to: ...)` instead.', uplevel: 1
105
- to = legacy_to
87
+ warn_for_deprecated_arguments do |keywords|
88
+ keywords << :from if legacy_from != NOT_GIVEN
89
+ keywords << :to if legacy_to != NOT_GIVEN
106
90
  end
107
91
 
108
92
  Faker::Base.rand_in_range(from, to)
109
93
  end
110
94
 
111
95
  def within(legacy_range = NOT_GIVEN, range: 1.00..5000.00)
112
- if legacy_range != NOT_GIVEN
113
- warn_with_uplevel 'Passing `range` with the 1st argument of `Number.within` is deprecated. Use keyword argument like `Number.within(range: ...)` instead.', uplevel: 1
114
- range = legacy_range
96
+ warn_for_deprecated_arguments do |keywords|
97
+ keywords << :range if legacy_range != NOT_GIVEN
115
98
  end
116
99
 
117
100
  between(from: range.min, to: range.max)
118
101
  end
119
102
 
120
103
  def positive(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 1.00, to: 5000.00)
121
- if legacy_from != NOT_GIVEN
122
- warn_with_uplevel 'Passing `from` with the 1st argument of `Number.positive` is deprecated. Use keyword argument like `Number.positive(from: ...)` instead.', uplevel: 1
123
- from = legacy_from
124
- end
125
- if legacy_to != NOT_GIVEN
126
- warn_with_uplevel 'Passing `to` with the 2nd argument of `Number.positive` is deprecated. Use keyword argument like `Number.positive(to: ...)` instead.', uplevel: 1
127
- to = legacy_to
104
+ warn_for_deprecated_arguments do |keywords|
105
+ keywords << :from if legacy_from != NOT_GIVEN
106
+ keywords << :to if legacy_to != NOT_GIVEN
128
107
  end
129
108
 
130
109
  random_number = between(from: from, to: to)
@@ -133,13 +112,9 @@ module Faker
133
112
  end
134
113
 
135
114
  def negative(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: -5000.00, to: -1.00)
136
- if legacy_from != NOT_GIVEN
137
- warn_with_uplevel 'Passing `from` with the 1st argument of `Number.negative` is deprecated. Use keyword argument like `Number.negative(from: ...)` instead.', uplevel: 1
138
- from = legacy_from
139
- end
140
- if legacy_to != NOT_GIVEN
141
- warn_with_uplevel 'Passing `to` with the 2nd argument of `Number.negative` is deprecated. Use keyword argument like `Number.negative(to: ...)` instead.', uplevel: 1
142
- to = legacy_to
115
+ warn_for_deprecated_arguments do |keywords|
116
+ keywords << :from if legacy_from != NOT_GIVEN
117
+ keywords << :to if legacy_to != NOT_GIVEN
143
118
  end
144
119
 
145
120
  random_number = between(from: from, to: to)
@@ -18,17 +18,10 @@ module Faker
18
18
  # rubocop:disable Metrics/ParameterLists
19
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
20
  # rubocop:enable Metrics/ParameterLists
21
- if legacy_name != NOT_GIVEN
22
- warn_with_uplevel 'Passing `name` with the 1st argument of `Omniauth.google` is deprecated. Use keyword argument like `Omniauth.google(name: ...)` instead.', uplevel: 1
23
- name = legacy_name
24
- end
25
- if legacy_email != NOT_GIVEN
26
- warn_with_uplevel 'Passing `email` with the 2nd argument of `Omniauth.google` is deprecated. Use keyword argument like `Omniauth.google(email: ...)` instead.', uplevel: 1
27
- email = legacy_email
28
- end
29
- if legacy_uid != NOT_GIVEN
30
- warn_with_uplevel 'Passing `uid` with the 3rd argument of `Omniauth.google` is deprecated. Use keyword argument like `Omniauth.google(uid: ...)` instead.', uplevel: 1
31
- uid = legacy_uid
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
32
25
  end
33
26
 
34
27
  auth = Omniauth.new(name: name, email: email)
@@ -42,7 +35,7 @@ module Faker
42
35
  email: auth.email,
43
36
  image: image
44
37
  },
45
- credentials: {
38
+ credentials: {
46
39
  token: Crypto.md5,
47
40
  refresh_token: Crypto.md5,
48
41
  expires_at: Time.forward.to_i,
@@ -50,7 +43,7 @@ module Faker
50
43
  },
51
44
  extra: {
52
45
  raw_info: {
53
- sub: uid,
46
+ sub: uid,
54
47
  email: auth.email,
55
48
  email_verified: random_boolean.to_s,
56
49
  name: auth.name,
@@ -82,21 +75,11 @@ module Faker
82
75
  # rubocop:disable Metrics/ParameterLists
83
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)
84
77
  # rubocop:enable Metrics/ParameterLists
85
- if legacy_name != NOT_GIVEN
86
- warn_with_uplevel 'Passing `name` with the 1st argument of `Omniauth.facebook` is deprecated. Use keyword argument like `Omniauth.facebook(name: ...)` instead.', uplevel: 1
87
- name = legacy_name
88
- end
89
- if legacy_email != NOT_GIVEN
90
- warn_with_uplevel 'Passing `email` with the 2nd argument of `Omniauth.facebook` is deprecated. Use keyword argument like `Omniauth.facebook(email: ...)` instead.', uplevel: 1
91
- email = legacy_email
92
- end
93
- if legacy_username != NOT_GIVEN
94
- warn_with_uplevel 'Passing `username` with the 3rd argument of `Omniauth.facebook` is deprecated. Use keyword argument like `Omniauth.facebook(username: ...)` instead.', uplevel: 1
95
- username = legacy_username
96
- end
97
- if legacy_uid != NOT_GIVEN
98
- warn_with_uplevel 'Passing `uid` with the 4th argument of `Omniauth.facebook` is deprecated. Use keyword argument like `Omniauth.facebook(uid: ...)` instead.', uplevel: 1
99
- uid = legacy_uid
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
100
83
  end
101
84
 
102
85
  auth = Omniauth.new(name: name, email: email)
@@ -143,17 +126,10 @@ module Faker
143
126
  # rubocop:disable Metrics/ParameterLists
144
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)
145
128
  # rubocop:enable Metrics/ParameterLists
146
- if legacy_name != NOT_GIVEN
147
- warn_with_uplevel 'Passing `name` with the 1st argument of `Omniauth.twitter` is deprecated. Use keyword argument like `Omniauth.twitter(name: ...)` instead.', uplevel: 1
148
- name = legacy_name
149
- end
150
- if legacy_nickname != NOT_GIVEN
151
- warn_with_uplevel 'Passing `nickname` with the 2nd argument of `Omniauth.twitter` is deprecated. Use keyword argument like `Omniauth.twitter(nickname: ...)` instead.', uplevel: 1
152
- nickname = legacy_nickname
153
- end
154
- if legacy_uid != NOT_GIVEN
155
- warn_with_uplevel 'Passing `uid` with the 3rd argument of `Omniauth.twitter` is deprecated. Use keyword argument like `Omniauth.twitter(uid: ...)` instead.', uplevel: 1
156
- uid = legacy_uid
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
157
133
  end
158
134
 
159
135
  auth = Omniauth.new(name: name)
@@ -231,17 +207,10 @@ module Faker
231
207
  # rubocop:disable Metrics/ParameterLists
232
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)
233
209
  # rubocop:enable Metrics/ParameterLists
234
- if legacy_name != NOT_GIVEN
235
- warn_with_uplevel 'Passing `name` with the 1st argument of `Omniauth.linkedin` is deprecated. Use keyword argument like `Omniauth.linkedin(name: ...)` instead.', uplevel: 1
236
- name = legacy_name
237
- end
238
- if legacy_email != NOT_GIVEN
239
- warn_with_uplevel 'Passing `email` with the 2nd argument of `Omniauth.linkedin` is deprecated. Use keyword argument like `Omniauth.linkedin(email: ...)` instead.', uplevel: 1
240
- email = legacy_email
241
- end
242
- if legacy_uid != NOT_GIVEN
243
- warn_with_uplevel 'Passing `uid` with the 3rd argument of `Omniauth.linkedin` is deprecated. Use keyword argument like `Omniauth.linkedin(uid: ...)` instead.', uplevel: 1
244
- uid = legacy_uid
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
245
214
  end
246
215
 
247
216
  auth = Omniauth.new(name: name, email: email)
@@ -309,17 +278,10 @@ module Faker
309
278
  # rubocop:disable Metrics/ParameterLists
310
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)
311
280
  # rubocop:enable Metrics/ParameterLists
312
- if legacy_name != NOT_GIVEN
313
- warn_with_uplevel 'Passing `name` with the 1st argument of `Omniauth.github` is deprecated. Use keyword argument like `Omniauth.github(name: ...)` instead.', uplevel: 1
314
- name = legacy_name
315
- end
316
- if legacy_email != NOT_GIVEN
317
- warn_with_uplevel 'Passing `email` with the 2nd argument of `Omniauth.github` is deprecated. Use keyword argument like `Omniauth.github(email: ...)` instead.', uplevel: 1
318
- email = legacy_email
319
- end
320
- if legacy_uid != NOT_GIVEN
321
- warn_with_uplevel 'Passing `uid` with the 3rd argument of `Omniauth.github` is deprecated. Use keyword argument like `Omniauth.github(uid: ...)` instead.', uplevel: 1
322
- uid = legacy_uid
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
323
285
  end
324
286
 
325
287
  auth = Omniauth.new(name: name, email: email)
@@ -340,7 +302,7 @@ module Faker
340
302
  },
341
303
  credentials: {
342
304
  token: Crypto.md5,
343
- expires: false
305
+ expires: false
344
306
  },
345
307
  extra: {
346
308
  raw_info: {
@@ -360,7 +322,7 @@ module Faker
360
322
  events_url: "#{api_url}/events{/privacy}",
361
323
  received_events_url: "#{api_url}/received_events",
362
324
  type: 'User',
363
- site_admin: random_boolean,
325
+ site_admin: random_boolean,
364
326
  name: auth.name,
365
327
  company: nil,
366
328
  blog: nil,