faker 2.10.0 → 2.13.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.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +265 -0
  3. data/README.md +14 -2
  4. data/lib/faker.rb +20 -10
  5. data/lib/faker/default/address.rb +31 -1
  6. data/lib/faker/default/bank.rb +79 -0
  7. data/lib/faker/default/blood.rb +48 -0
  8. data/lib/faker/default/business.rb +1 -1
  9. data/lib/faker/default/cannabis.rb +80 -0
  10. data/lib/faker/default/chile_rut.rb +44 -1
  11. data/lib/faker/default/commerce.rb +73 -10
  12. data/lib/faker/default/company.rb +276 -7
  13. data/lib/faker/default/compass.rb +135 -0
  14. data/lib/faker/default/computer.rb +63 -0
  15. data/lib/faker/default/construction.rb +54 -0
  16. data/lib/faker/default/cosmere.rb +90 -0
  17. data/lib/faker/default/crypto_coin.rb +45 -0
  18. data/lib/faker/default/date.rb +16 -12
  19. data/lib/faker/default/dc_comics.rb +45 -0
  20. data/lib/faker/default/driving_licence.rb +42 -0
  21. data/lib/faker/default/file.rb +51 -2
  22. data/lib/faker/default/finance.rb +24 -0
  23. data/lib/faker/default/funny_name.rb +45 -0
  24. data/lib/faker/default/gender.rb +1 -1
  25. data/lib/faker/default/hipster.rb +94 -0
  26. data/lib/faker/default/id_number.rb +86 -0
  27. data/lib/faker/default/internet.rb +64 -7
  28. data/lib/faker/default/internet_http.rb +48 -0
  29. data/lib/faker/default/invoice.rb +32 -5
  30. data/lib/faker/default/json.rb +55 -0
  31. data/lib/faker/default/lorem.rb +1 -1
  32. data/lib/faker/default/lorem_flickr.rb +65 -0
  33. data/lib/faker/default/lorem_pixel.rb +22 -0
  34. data/lib/faker/default/markdown.rb +89 -0
  35. data/lib/faker/default/measurement.rb +90 -0
  36. data/lib/faker/default/name.rb +98 -0
  37. data/lib/faker/default/nhs.rb +19 -0
  38. data/lib/faker/default/number.rb +5 -7
  39. data/lib/faker/default/omniauth.rb +105 -52
  40. data/lib/faker/default/phone_number.rb +88 -5
  41. data/lib/faker/default/placeholdit.rb +21 -0
  42. data/lib/faker/default/slack_emoji.rb +81 -0
  43. data/lib/faker/default/south_africa.rb +90 -0
  44. data/lib/faker/default/string.rb +19 -3
  45. data/lib/faker/default/stripe.rb +61 -0
  46. data/lib/faker/default/twitter.rb +35 -0
  47. data/lib/faker/default/types.rb +80 -0
  48. data/lib/faker/default/university.rb +45 -0
  49. data/lib/faker/default/vehicle.rb +184 -4
  50. data/lib/faker/default/verb.rb +45 -0
  51. data/lib/faker/default/world_cup.rb +4 -4
  52. data/lib/faker/games/control.rb +113 -0
  53. data/lib/faker/games/dnd.rb +61 -0
  54. data/lib/faker/games/heroes_of_the_storm.rb +16 -5
  55. data/lib/faker/games/minecraft.rb +48 -0
  56. data/lib/faker/games/warhammer_fantasy.rb +74 -0
  57. data/lib/faker/movies/departed.rb +49 -0
  58. data/lib/faker/movies/movie.rb +13 -0
  59. data/lib/faker/music/pearl_jam.rb +50 -0
  60. data/lib/faker/music/phish.rb +27 -1
  61. data/lib/faker/music/prince.rb +64 -0
  62. data/lib/faker/music/rush.rb +37 -0
  63. data/lib/faker/music/show.rb +49 -0
  64. data/lib/faker/quotes/chiquito.rb +80 -0
  65. data/lib/faker/quotes/quote.rb +54 -1
  66. data/lib/faker/quotes/rajnikanth.rb +26 -0
  67. data/lib/faker/quotes/shakespeare.rb +36 -0
  68. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +13 -0
  69. data/lib/faker/tv_shows/big_bang_theory.rb +37 -0
  70. data/lib/faker/tv_shows/dr_who.rb +1 -1
  71. data/lib/faker/tv_shows/futurama.rb +65 -0
  72. data/lib/faker/tv_shows/simpsons.rb +14 -0
  73. data/lib/faker/tv_shows/suits.rb +37 -0
  74. data/lib/faker/version.rb +1 -1
  75. data/lib/helpers/base58.rb +1 -1
  76. data/lib/helpers/char.rb +22 -27
  77. data/lib/helpers/unique_generator.rb +4 -0
  78. data/lib/locales/bg.yml +2 -2
  79. data/lib/locales/ca.yml +0 -8
  80. data/lib/locales/da-DK.yml +3 -3
  81. data/lib/locales/de-CH.yml +1693 -0
  82. data/lib/locales/en-AU.yml +44 -10
  83. data/lib/locales/en-CA.yml +2 -0
  84. data/lib/locales/en-GB.yml +1 -1
  85. data/lib/locales/en-NEP.yml +1 -1
  86. data/lib/locales/en-NZ.yml +2 -0
  87. data/lib/locales/en-US.yml +29 -3
  88. data/lib/locales/en-ZA.yml +1 -1
  89. data/lib/locales/en/address.yml +2 -0
  90. data/lib/locales/en/aqua_teen_hunger_force.yml +33 -1
  91. data/lib/locales/en/bank.yml +1 -1
  92. data/lib/locales/en/big_bang_theory.yml +38 -0
  93. data/lib/locales/en/blood.yml +13 -0
  94. data/lib/locales/en/chiquito.yml +64 -0
  95. data/lib/locales/en/color.yml +1 -1
  96. data/lib/locales/en/computer.yml +36 -0
  97. data/lib/locales/en/control.yml +247 -0
  98. data/lib/locales/en/departed.yml +50 -0
  99. data/lib/locales/en/dnd.yml +54 -0
  100. data/lib/locales/en/futurama.yml +344 -0
  101. data/lib/locales/en/heroes_of_the_storm.yml +2 -2
  102. data/lib/locales/en/house.yml +1 -1
  103. data/lib/locales/en/minecraft.yml +390 -0
  104. data/lib/locales/en/movie.yml +192 -1
  105. data/lib/locales/en/name.yml +4 -3
  106. data/lib/locales/en/one_piece.yml +2 -2
  107. data/lib/locales/en/pearl_jam.yml +213 -0
  108. data/lib/locales/en/phish.yml +392 -1
  109. data/lib/locales/en/prince.yml +227 -0
  110. data/lib/locales/en/rajnikanth.yml +77 -0
  111. data/lib/locales/en/rush.yml +32 -0
  112. data/lib/locales/en/shakespeare.yml +3 -3
  113. data/lib/locales/en/show.yml +597 -0
  114. data/lib/locales/en/simpsons.yml +668 -0
  115. data/lib/locales/en/star_wars.yml +568 -220
  116. data/lib/locales/en/stripe.yml +3 -3
  117. data/lib/locales/en/suits.yml +45 -0
  118. data/lib/locales/en/warhammer_fantasy.yml +582 -0
  119. data/lib/locales/es-MX.yml +3 -0
  120. data/lib/locales/fr-CA.yml +7 -4
  121. data/lib/locales/fr-CH.yml +1 -1
  122. data/lib/locales/fr.yml +5 -4
  123. data/lib/locales/hy.yml +1 -6
  124. data/lib/locales/id.yml +2 -1
  125. data/lib/locales/ja.yml +1 -1
  126. data/lib/locales/ko.yml +82 -0
  127. data/lib/locales/pt-BR.yml +1 -0
  128. data/lib/locales/pt.yml +2 -2
  129. data/lib/locales/uk.yml +5 -5
  130. data/lib/locales/zh-CN.yml +1 -1
  131. data/lib/locales/zh-TW.yml +1 -1
  132. metadata +52 -19
@@ -6,6 +6,19 @@ module Faker
6
6
  ALL = 'all'
7
7
  NONE = 'none'
8
8
 
9
+ ##
10
+ # Produces a random height measurement.
11
+ #
12
+ # @param amount [Integer] Speficies the random height value.
13
+ # @return [String]
14
+ #
15
+ # @example
16
+ # Faker::Measurement.height #=> "6 inches"
17
+ # Faker::Measurement.height(amount: 1.4) #=> "1.4 inches"
18
+ # Faker::Measurement.height(amount: "none") #=> "inch"
19
+ # Faker::Measurement.height(amount: "all") #=> "inches"
20
+ #
21
+ # @faker.version 1.7.3
9
22
  def height(legacy_amount = NOT_GIVEN, amount: rand(10))
10
23
  warn_for_deprecated_arguments do |keywords|
11
24
  keywords << :amount if legacy_amount != NOT_GIVEN
@@ -14,6 +27,17 @@ module Faker
14
27
  define_measurement_locale(amount, 'height')
15
28
  end
16
29
 
30
+ ##
31
+ # Produces a random length measurement.
32
+ #
33
+ # @param amount [Integer] Speficies the random length value.
34
+ # @return [String]
35
+ #
36
+ # @example
37
+ # Faker::Measurement.length #=> "1 yard"
38
+ # Faker::Measurement.length(amount: 1.4) #=> "1.4 yards"
39
+ #
40
+ # @faker.version 1.7.3
17
41
  def length(legacy_amount = NOT_GIVEN, amount: rand(10))
18
42
  warn_for_deprecated_arguments do |keywords|
19
43
  keywords << :amount if legacy_amount != NOT_GIVEN
@@ -22,6 +46,17 @@ module Faker
22
46
  define_measurement_locale(amount, 'length')
23
47
  end
24
48
 
49
+ ##
50
+ # Produces a random volume measurement.
51
+ #
52
+ # @param amount [Integer] Speficies the random volume value.
53
+ # @return [String]
54
+ #
55
+ # @example
56
+ # Faker::Measurement.volume #=> "10 cups"
57
+ # Faker::Measurement.volume(amount: 1.4) #=> "1.4 cups"
58
+ #
59
+ # @faker.version 1.7.3
25
60
  def volume(legacy_amount = NOT_GIVEN, amount: rand(10))
26
61
  warn_for_deprecated_arguments do |keywords|
27
62
  keywords << :amount if legacy_amount != NOT_GIVEN
@@ -30,6 +65,17 @@ module Faker
30
65
  define_measurement_locale(amount, 'volume')
31
66
  end
32
67
 
68
+ ##
69
+ # Produces a random weight measurement.
70
+ #
71
+ # @param amount [Integer] Speficies the random weight value.
72
+ # @return [String]
73
+ #
74
+ # @example
75
+ # Faker::Measurement.weight #=> "3 pounds"
76
+ # Faker::Measurement.weight(amount: 1.4) #=> "1.4 pounds"
77
+ #
78
+ # @faker.version 1.7.3
33
79
  def weight(legacy_amount = NOT_GIVEN, amount: rand(10))
34
80
  warn_for_deprecated_arguments do |keywords|
35
81
  keywords << :amount if legacy_amount != NOT_GIVEN
@@ -38,6 +84,17 @@ module Faker
38
84
  define_measurement_locale(amount, 'weight')
39
85
  end
40
86
 
87
+ ##
88
+ # Produces a random metric height measurement.
89
+ #
90
+ # @param amount [Integer] Speficies the random height value.
91
+ # @return [String]
92
+ #
93
+ # @example
94
+ # Faker::Measurement.metric_height #=> "2 meters"
95
+ # Faker::Measurement.metric_height(amount: 1.4) #=> "1.4 meters"
96
+ #
97
+ # @faker.version 1.7.3
41
98
  def metric_height(legacy_amount = NOT_GIVEN, amount: rand(10))
42
99
  warn_for_deprecated_arguments do |keywords|
43
100
  keywords << :amount if legacy_amount != NOT_GIVEN
@@ -46,6 +103,17 @@ module Faker
46
103
  define_measurement_locale(amount, 'metric_height')
47
104
  end
48
105
 
106
+ ##
107
+ # Produces a random metric length measurement.
108
+ #
109
+ # @param amount [Integer] Speficies the random length value.
110
+ # @return [String]
111
+ #
112
+ # @example
113
+ # Faker::Measurement.metric_length #=> "0 decimeters"
114
+ # Faker::Measurement.metric_length(amount: 1.4) #=> "1.4 decimeters"
115
+ #
116
+ # @faker.version 1.7.3
49
117
  def metric_length(legacy_amount = NOT_GIVEN, amount: rand(10))
50
118
  warn_for_deprecated_arguments do |keywords|
51
119
  keywords << :amount if legacy_amount != NOT_GIVEN
@@ -54,6 +122,17 @@ module Faker
54
122
  define_measurement_locale(amount, 'metric_length')
55
123
  end
56
124
 
125
+ ##
126
+ # Produces a random metric volume measurement.
127
+ #
128
+ # @param amount [Integer] Speficies the random volume value.
129
+ # @return [String]
130
+ #
131
+ # @example
132
+ # Faker::Measurement.metric_volume #=> "1 liter"
133
+ # Faker::Measurement.metric_volume(amount: 1.4) #=> "1.4 liters"
134
+ #
135
+ # @faker.version 1.7.3
57
136
  def metric_volume(legacy_amount = NOT_GIVEN, amount: rand(10))
58
137
  warn_for_deprecated_arguments do |keywords|
59
138
  keywords << :amount if legacy_amount != NOT_GIVEN
@@ -62,6 +141,17 @@ module Faker
62
141
  define_measurement_locale(amount, 'metric_volume')
63
142
  end
64
143
 
144
+ ##
145
+ # Produces a random metric weight measurement.
146
+ #
147
+ # @param amount [Integer] Speficies the random weight value.
148
+ # @return [String]
149
+ #
150
+ # @example
151
+ # Faker::Measurement.metric_weight #=> "8 grams"
152
+ # Faker::Measurement.metric_weight(amount: 1.4) #=> "1.4 grams"
153
+ #
154
+ # @faker.version 1.7.3
65
155
  def metric_weight(legacy_amount = NOT_GIVEN, amount: rand(10))
66
156
  warn_for_deprecated_arguments do |keywords|
67
157
  keywords << :amount if legacy_amount != NOT_GIVEN
@@ -5,14 +5,41 @@ module Faker
5
5
  flexible :name
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces a random name.
10
+ #
11
+ # @return [String]
12
+ #
13
+ # @example
14
+ # Faker::Name.name #=> "Tyshawn Johns Sr."
15
+ #
16
+ # @faker.version 0.9.0
8
17
  def name
9
18
  parse('name.name')
10
19
  end
11
20
 
21
+ ##
22
+ # Produces a random name with middle name.
23
+ #
24
+ # @return [String]
25
+ #
26
+ # @example
27
+ # Faker::Name.name_with_middle #=> "Aditya Elton Douglas"
28
+ #
29
+ # @faker.version 1.6.4
12
30
  def name_with_middle
13
31
  parse('name.name_with_middle')
14
32
  end
15
33
 
34
+ ##
35
+ # Produces a random first name.
36
+ #
37
+ # @return [String]
38
+ #
39
+ # @example
40
+ # Faker::Name.first_name #=> "Kaci"
41
+ #
42
+ # @faker.version 0.9.0
16
43
  def first_name
17
44
  if parse('name.first_name').empty?
18
45
  fetch('name.first_name')
@@ -21,31 +48,102 @@ module Faker
21
48
  end
22
49
  end
23
50
 
51
+ ##
52
+ # Produces a random male first name.
53
+ #
54
+ # @return [String]
55
+ #
56
+ # @example
57
+ # Faker::Name.male_first_name #=> "Edward"
58
+ #
59
+ # @faker.version 1.9.1
24
60
  def male_first_name
25
61
  fetch('name.male_first_name')
26
62
  end
27
63
  alias first_name_men male_first_name
28
64
  alias masculine_name male_first_name
29
65
 
66
+ ##
67
+ # Produces a random female first name.
68
+ #
69
+ # @return [String]
70
+ #
71
+ # @example
72
+ # Faker::Name.female_first_name #=> "Natasha"
73
+ #
74
+ # @faker.version 1.9.1
30
75
  def female_first_name
31
76
  fetch('name.female_first_name')
32
77
  end
33
78
  alias first_name_women female_first_name
34
79
  alias feminine_name female_first_name
35
80
 
81
+ ##
82
+ # Produces a random gender neutral first name.
83
+ #
84
+ # @return [String]
85
+ #
86
+ # @example
87
+ # Faker::Name.neutral_first_name #=> "Casey"
88
+ #
89
+ # @faker.version 2.13.0
90
+ def neutral_first_name
91
+ fetch('name.neutral_first_name')
92
+ end
93
+ alias first_name_neutral neutral_first_name
94
+ alias gender_neutral_first_name neutral_first_name
95
+
96
+ ##
97
+ # Produces a random last name.
98
+ #
99
+ # @return [String]
100
+ #
101
+ # @example
102
+ # Faker::Name.last_name #=> "Ernser"
103
+ #
104
+ # @faker.version 0.9.0
36
105
  def last_name
37
106
  parse('name.last_name')
38
107
  end
39
108
  alias middle_name last_name
40
109
 
110
+ ##
111
+ # Produces a random name prefix.
112
+ #
113
+ # @return [String]
114
+ #
115
+ # @example
116
+ # Faker::Name.prefix #=> "Mr."
117
+ #
118
+ # @faker.version 0.9.0
41
119
  def prefix
42
120
  fetch('name.prefix')
43
121
  end
44
122
 
123
+ ##
124
+ # Produces a random name suffix.
125
+ #
126
+ # @return [String]
127
+ #
128
+ # @example
129
+ # Faker::Name.suffix #=> "IV"
130
+ #
131
+ # @faker.version 0.9.0
45
132
  def suffix
46
133
  fetch('name.suffix')
47
134
  end
48
135
 
136
+ ##
137
+ # Produces random initials.
138
+ #
139
+ # @param number [Integer] Number of digits that the generated initials should have.
140
+ # @return [String]
141
+ #
142
+ # @example
143
+ # Faker::Name.initials #=> "NJM"
144
+ # Faker::Name.initials(number: 2) #=> "NM"
145
+ #
146
+ # @faker.version 1.8.5
49
147
  def initials(legacy_number = NOT_GIVEN, number: 3)
50
148
  warn_for_deprecated_arguments do |keywords|
51
149
  keywords << :number if legacy_number != NOT_GIVEN
@@ -3,6 +3,15 @@
3
3
  module Faker
4
4
  class NationalHealthService < Base
5
5
  class << self
6
+ ##
7
+ # Produces a random British NHS number.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::NationalHealthService.british_number #=> "403 958 5577"
13
+ #
14
+ # @faker.version 1.9.2
6
15
  def british_number
7
16
  base_number = rand(400_000_001...499_999_999)
8
17
  # If the check digit is equivalent to 10, the number is invalid.
@@ -15,6 +24,16 @@ module Faker
15
24
  .join('')
16
25
  end
17
26
 
27
+ ##
28
+ # Produces a random British NHS number's check digit.
29
+ #
30
+ # @param number [Integer] Specifies the NHS number the check digit belongs to.
31
+ # @return [Integer]
32
+ #
33
+ # @example
34
+ # Faker::NationalHealthService.check_digit(number: 400_012_114) #=> 6
35
+ #
36
+ # @faker.version 1.9.2
18
37
  def check_digit(legacy_number = NOT_GIVEN, number: 0)
19
38
  warn_for_deprecated_arguments do |keywords|
20
39
  keywords << :number if legacy_number != NOT_GIVEN
@@ -85,13 +85,11 @@ module Faker
85
85
  end
86
86
 
87
87
  l_d = number(digits: l_digits)
88
- r_d = if r_digits == 1
89
- generate(r_digits)
90
- else
91
- # Ensure the last digit is not zero
92
- # so it does not get truncated on converting to float
93
- generate(r_digits - 1).join + non_zero_digit.to_s
94
- end
88
+
89
+ # Ensure the last digit is not zero
90
+ # so it does not get truncated on converting to float
91
+ r_d = generate(r_digits - 1).join + non_zero_digit.to_s
92
+
95
93
  "#{l_d}.#{r_d}".to_f
96
94
  end
97
95
 
@@ -15,6 +15,16 @@ module Faker
15
15
  end
16
16
 
17
17
  class << self
18
+ ##
19
+ # Generate a mock Omniauth response from Google.
20
+ #
21
+ # @param name [String] A specific name to return in the response.
22
+ # @param email [String] A specific email to return in the response.
23
+ # @param uid [String] A specific UID to return in the response.
24
+ #
25
+ # @return [Hash] An auth hash in the format provided by omniauth-google.
26
+ #
27
+ # @faker.version 1.8.0
18
28
  # rubocop:disable Metrics/ParameterLists
19
29
  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
30
  # rubocop:enable Metrics/ParameterLists
@@ -57,21 +67,32 @@ module Faker
57
67
  hd: "#{Company.name.downcase}.com"
58
68
  },
59
69
  id_info: {
60
- 'iss' => 'accounts.google.com',
61
- 'at_hash' => Crypto.md5,
62
- 'email_verified' => true,
63
- 'sub' => Number.number(digits: 28).to_s,
64
- 'azp' => 'APP_ID',
65
- 'email' => auth.email,
66
- 'aud' => 'APP_ID',
67
- 'iat' => Time.forward.to_i,
68
- 'exp' => Time.forward.to_i,
69
- 'openid_id' => "https://www.google.com/accounts/o8/id?id=#{uid}"
70
+ iss: 'accounts.google.com',
71
+ at_hash: Crypto.md5,
72
+ email_verified: true,
73
+ sub: Number.number(digits: 28).to_s,
74
+ azp: 'APP_ID',
75
+ email: auth.email,
76
+ aud: 'APP_ID',
77
+ iat: Time.forward.to_i,
78
+ exp: Time.forward.to_i,
79
+ openid_id: "https://www.google.com/accounts/o8/id?id=#{uid}"
70
80
  }
71
81
  }
72
82
  }
73
83
  end
74
84
 
85
+ ##
86
+ # Generate a mock Omniauth response from Facebook.
87
+ #
88
+ # @param name [String] A specific name to return in the response.
89
+ # @param email [String] A specific email to return in the response.
90
+ # @param username [String] A specific username to return in the response.
91
+ # @param uid [String] A specific UID to return in the response.
92
+ #
93
+ # @return [Hash] An auth hash in the format provided by omniauth-facebook.
94
+ #
95
+ # @faker.version 1.8.0
75
96
  # rubocop:disable Metrics/ParameterLists
76
97
  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
98
  # rubocop:enable Metrics/ParameterLists
@@ -123,6 +144,16 @@ module Faker
123
144
  }
124
145
  end
125
146
 
147
+ ##
148
+ # Generate a mock Omniauth response from Twitter.
149
+ #
150
+ # @param name [String] A specific name to return in the response.
151
+ # @param nickname [String] A specific nickname to return in the response.
152
+ # @param uid [String] A specific UID to return in the response.
153
+ #
154
+ # @return [Hash] An auth hash in the format provided by omniauth-twitter.
155
+ #
156
+ # @faker.version 1.8.0
126
157
  # rubocop:disable Metrics/ParameterLists
127
158
  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
159
  # rubocop:enable Metrics/ParameterLists
@@ -204,6 +235,16 @@ module Faker
204
235
  }
205
236
  end
206
237
 
238
+ ##
239
+ # Generate a mock Omniauth response from LinkedIn.
240
+ #
241
+ # @param name [String] A specific name to return in the response.
242
+ # @param email [String] A specific email to return in the response.
243
+ # @param uid [String] A specific UID to return in the response.
244
+ #
245
+ # @return [Hash] An auth hash in the format provided by omniauth-linkedin.
246
+ #
247
+ # @faker.version 1.8.0
207
248
  # rubocop:disable Metrics/ParameterLists
208
249
  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
250
  # rubocop:enable Metrics/ParameterLists
@@ -223,58 +264,68 @@ module Faker
223
264
  industry = Commerce.department
224
265
  url = "http://www.linkedin.com/in/#{first_name}#{last_name}"
225
266
  {
226
- 'provider' => 'linkedin',
227
- 'uid' => uid,
228
- 'info' => {
229
- 'name' => auth.name,
230
- 'email' => auth.email,
231
- 'nickname' => auth.name,
232
- 'first_name' => auth.first_name,
233
- 'last_name' => auth.last_name,
234
- 'location' => location,
235
- 'description' => description,
236
- 'image' => image,
237
- 'phone' => PhoneNumber.phone_number,
238
- 'headline' => description,
239
- 'industry' => industry,
240
- 'urls' => {
241
- 'public_profile' => url
267
+ provider: 'linkedin',
268
+ uid: uid,
269
+ info: {
270
+ name: auth.name,
271
+ email: auth.email,
272
+ nickname: auth.name,
273
+ first_name: auth.first_name,
274
+ last_name: auth.last_name,
275
+ location: location,
276
+ description: description,
277
+ image: image,
278
+ phone: PhoneNumber.phone_number,
279
+ headline: description,
280
+ industry: industry,
281
+ urls: {
282
+ public_profile: url
242
283
  }
243
284
  },
244
- 'credentials' => {
245
- 'token' => token,
246
- 'secret' => secret
285
+ credentials: {
286
+ token: token,
287
+ secret: secret
247
288
  },
248
- 'extra' => {
249
- 'access_token' => {
250
- 'token' => token,
251
- 'secret' => secret,
252
- 'consumer' => nil,
253
- 'params' => {
289
+ extra: {
290
+ access_token: {
291
+ token: token,
292
+ secret: secret,
293
+ consumer: nil,
294
+ params: {
254
295
  oauth_token: token,
255
296
  oauth_token_secret: secret,
256
297
  oauth_expires_in: Time.forward.to_i,
257
298
  oauth_authorization_expires_in: Time.forward.to_i
258
299
  },
259
- 'response' => nil
300
+ response: nil
260
301
  },
261
- 'raw_info' => {
262
- 'firstName' => auth.first_name,
263
- 'headline' => description,
264
- 'id' => uid,
265
- 'industry' => industry,
266
- 'lastName' => auth.last_name,
267
- 'location' => {
268
- 'country' => { 'code' => Address.country_code.downcase },
269
- 'name' => city_state.split(', ').first
302
+ raw_info: {
303
+ firstName: auth.first_name,
304
+ headline: description,
305
+ id: uid,
306
+ industry: industry,
307
+ lastName: auth.last_name,
308
+ location: {
309
+ country: { code: Address.country_code.downcase },
310
+ name: city_state.split(', ').first
270
311
  },
271
- 'pictureUrl' => image,
272
- 'publicProfileUrl' => url
312
+ pictureUrl: image,
313
+ publicProfileUrl: url
273
314
  }
274
315
  }
275
316
  }
276
317
  end
277
318
 
319
+ ##
320
+ # Generate a mock Omniauth response from Github.
321
+ #
322
+ # @param name [String] A specific name to return in the response.
323
+ # @param email [String] A specific email to return in the response.
324
+ # @param uid [String] A specific UID to return in the response.
325
+ #
326
+ # @return [Hash] An auth hash in the format provided by omniauth-github.
327
+ #
328
+ # @faker.version 1.8.0
278
329
  # rubocop:disable Metrics/ParameterLists
279
330
  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
331
  # rubocop:enable Metrics/ParameterLists
@@ -342,13 +393,15 @@ module Faker
342
393
  end
343
394
 
344
395
  ##
345
- # Generate a mock Omniauth response from Apple
396
+ # Generate a mock Omniauth response from Apple.
397
+ #
398
+ # @param name [String] A specific name to return in the response.
399
+ # @param email [String] A specific email to return in the response.
400
+ # @param uid [String] A specific UID to return in the response.
346
401
  #
347
- # @param name [String] A specific name to return in the response
348
- # @param email [String] A specific email to return in the response
349
- # @param uid [String] A specific UID to return in the response
402
+ # @return [Hash] An auth hash in the format provided by omniauth-apple.
350
403
  #
351
- # @return [Hash] An auth hash in the format provided by omniauth-apple
404
+ # @faker.version 2.3.0
352
405
  def apple(name: nil, email: nil, uid: nil)
353
406
  uid ||= "#{Number.number(digits: 6)}.#{Number.hexadecimal(digits: 32)}.#{Number.number(digits: 4)}"
354
407
  auth = Omniauth.new(name: name, email: email)