faker 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29798f78b1587b989eb395b41be5d0851b1e8ce2ee6488d1a4291dcaca7e8713
4
- data.tar.gz: 67694fb9ec2495bd11a85278962b5941326e24891fce2f9f9fb5a9baa4efa424
3
+ metadata.gz: 76e19dcb7a0fa3703ab5ad3864a973a9bb4ce8d18ca75947ebc8300a3f29fbcb
4
+ data.tar.gz: 7a171e80faa3db8686d8e0f9e2d4e21f77322268161aebfbae5b58b14139a795
5
5
  SHA512:
6
- metadata.gz: 2e968a3d663d459014b85287e0e2867cbcd8198acf82efe1e342af18990aadf090ba60c3771af8d79587a2ee95e16638922993f061f1f8437e45464f5bfd7a60
7
- data.tar.gz: 2a66801d474d23dfae78a6fb4c0b74b3a59f2af066b679d31ef6ad9862037151c85a429beda138d771d76d5ae3e7aa111b27ccd85e0a0fb4984c7b304fe8fe22
6
+ metadata.gz: 8f161b394abfccf7ca9122d8bc6d8957f63f8c0f9c5d3772c31ed898dfc50fb50b13b0da01289a67ff89904ec3cf4a16e514b568a9ef69a07f48e27e4e1e7da5
7
+ data.tar.gz: 00f2bcd1ae3821b113e1b375a1ceb0baa5657aad695f9f7fb7569f4bc74a65cacec2096535664a73f6a0840554613e7e11111dcce6d50fcc126e6c46199b930b
@@ -1,8 +1,36 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.8.1](https://github.com/faker-ruby/faker/tree/v2.8.1) (2019-12-06)
4
+
5
+ ## Bug/Fixes
6
+
7
+ - [PR #1846](https://github.com/faker-ruby/faker/pull/1846) Fix internet custom domain with suffix [@ngouy](https://github.com/ngouy)
8
+
9
+ ## Documentation
10
+
11
+ - [PR #1852](https://github.com/faker-ruby/faker/pull/1852) Add YARD docs for Faker::Business. [@connorshea](https://github.com/connorshea)
12
+ - [PR #1851](https://github.com/faker-ruby/faker/pull/1851) Add YARD docs for Faker::Crypto. [@connorshea](https://github.com/connorshea)
13
+ - [PR #1850](https://github.com/faker-ruby/faker/pull/1850) Add YARD docs for Faker::Kpop. [@connorshea](https://github.com/connorshea)
14
+ - [PR #1849](https://github.com/faker-ruby/faker/pull/1849) Add YARD docs for Faker::BossaNova. [@connorshea](https://github.com/connorshea)
15
+ - [PR #1848](https://github.com/faker-ruby/faker/pull/1848) Add YARD Docs for Faker::Demographic. [@connorshea](https://github.com/connorshea)
16
+ - [PR #1844](https://github.com/faker-ruby/faker/pull/1844) Fix yard doc in contribution [@vikas95prasad](https://github.com/vikas95prasad)
17
+ - [PR #1802](https://github.com/faker-ruby/faker/pull/1802) Add YARD doc for Faker::Food [@sap1enza](https://github.com/sap1enza)
18
+ - [PR #1766](https://github.com/faker-ruby/faker/pull/1766) Add YARD docs for Faker::Address [@connorshea](https://github.com/connorshea)
19
+
20
+ ## Refactoring
21
+
22
+ - [PR #1847](https://github.com/faker-ruby/faker/pull/1847) Makes minor refactors on Internet.domain_name method [@tiagofsilva](https://github.com/tiagofsilva)
23
+ - [PR #1772](https://github.com/faker-ruby/faker/pull/1848) Refactor Faker::Educator and add docs [@connorshea](https://github.com/connorshea)
24
+
25
+ ## Update local dependencies
26
+
27
+ - Update rubocop requirement from = 0.76.0 to = 0.77.0 (#1843)
28
+
29
+ ------------------------------------------------------------------------------
30
+
3
31
  ## [v2.8.0](https://github.com/faker-ruby/faker/tree/v2.8.0) (2019-12-01)
4
32
 
5
- ## Bugfixes
33
+ ## Bug/Fixes
6
34
 
7
35
  - [PR #1563](https://github.com/faker-ruby/faker/pull/1563)
8
36
  Fix generating routing number [@psienko](https://github.com/psienko)
@@ -5,6 +5,19 @@ module Faker
5
5
  flexible :address
6
6
 
7
7
  class << self
8
+ ##
9
+ # Produces the name of a city.
10
+ #
11
+ # @param options [Hash]
12
+ # @option with_state [Boolean] Whether to include the state name in the output.
13
+ # @return [String]
14
+ #
15
+ # @example
16
+ # Faker::Address.city #=> "Imogeneborough"
17
+ # Faker::Address.city(options: { with_state: true })
18
+ # #=> "Northfort, California"
19
+ #
20
+ # @faker.version 0.3.0
8
21
  def city(legacy_options = NOT_GIVEN, options: {})
9
22
  warn_for_deprecated_arguments do |keywords|
10
23
  keywords << :options if legacy_options != NOT_GIVEN
@@ -13,10 +26,29 @@ module Faker
13
26
  parse(options[:with_state] ? 'address.city_with_state' : 'address.city')
14
27
  end
15
28
 
29
+ ##
30
+ # Produces a street name.
31
+ #
32
+ # @return [String]
33
+ #
34
+ # @example
35
+ # Faker::Address.street_name #=> "Larkin Fork"
36
+ #
37
+ # @faker.version 0.3.0
16
38
  def street_name
17
39
  parse('address.street_name')
18
40
  end
19
41
 
42
+ ##
43
+ # Produces a street address.
44
+ #
45
+ # @param include_secondary [Boolean] Whether or not to include the secondary address.
46
+ # @return [String]
47
+ #
48
+ # @example
49
+ # Faker::Address.street_address #=> "282 Kevin Brook"
50
+ #
51
+ # @faker.version 0.3.0
20
52
  def street_address(legacy_include_secondary = NOT_GIVEN, include_secondary: false)
21
53
  warn_for_deprecated_arguments do |keywords|
22
54
  keywords << :include_secondary if legacy_include_secondary != NOT_GIVEN
@@ -25,18 +57,57 @@ module Faker
25
57
  numerify(parse('address.street_address') + (include_secondary ? ' ' + secondary_address : ''))
26
58
  end
27
59
 
60
+ ##
61
+ # Produces a secondary address.
62
+ #
63
+ # @return [String]
64
+ #
65
+ # @example
66
+ # Faker::Address.secondary_address #=> "Apt. 672"
67
+ #
68
+ # @faker.version 0.3.0
28
69
  def secondary_address
29
70
  bothify(fetch('address.secondary_address'))
30
71
  end
31
72
 
73
+ ##
74
+ # Produces a building number.
75
+ #
76
+ # @return [String]
77
+ #
78
+ # @example
79
+ # Faker::Address.building_number #=> "7304"
80
+ #
81
+ # @faker.version 0.3.0
32
82
  def building_number
33
83
  bothify(fetch('address.building_number'))
34
84
  end
35
85
 
86
+ ##
87
+ # Produces the name of a community.
88
+ #
89
+ # @return [String]
90
+ #
91
+ # @example
92
+ # Faker::Address.community #=> "University Crossing"
93
+ #
94
+ # @faker.version 1.8.0
36
95
  def community
37
96
  parse('address.community')
38
97
  end
39
98
 
99
+ ##
100
+ # Produces a Zip Code.
101
+ #
102
+ # @param state_abbreviation [String] an abbreviation for a state where the zip code should be located.
103
+ # @return [String]
104
+ #
105
+ # @example
106
+ # Faker::Address.zip_code #=> "58517"
107
+ # Faker::Address.zip_code #=> "23285-4905"
108
+ # Faker::Address.zip_code(state_abbreviation: 'CO') #=> "80011"
109
+ #
110
+ # @faker.version 0.3.0
40
111
  def zip_code(legacy_state_abbreviation = NOT_GIVEN, state_abbreviation: '')
41
112
  warn_for_deprecated_arguments do |keywords|
42
113
  keywords << :state_abbreviation if legacy_state_abbreviation != NOT_GIVEN
@@ -52,6 +123,15 @@ module Faker
52
123
  bothify(fetch('address.postcode_by_state.' + state_abbreviation))
53
124
  end
54
125
 
126
+ ##
127
+ # Produces the name of a time zone.
128
+ #
129
+ # @return [String]
130
+ #
131
+ # @example
132
+ # Faker::Address.time_zone #=> "Asia/Yakutsk"
133
+ #
134
+ # @faker.version 1.2.0
55
135
  def time_zone
56
136
  fetch('address.time_zone')
57
137
  end
@@ -59,30 +139,96 @@ module Faker
59
139
  alias zip zip_code
60
140
  alias postcode zip_code
61
141
 
142
+ ##
143
+ # Produces a street suffix.
144
+ #
145
+ # @return [String]
146
+ #
147
+ # @example
148
+ # Faker::Address.street_suffix #=> "Street"
149
+ #
150
+ # @faker.version 0.3.0
62
151
  def street_suffix
63
152
  fetch('address.street_suffix')
64
153
  end
65
154
 
155
+ ##
156
+ # Produces a city suffix.
157
+ #
158
+ # @return [String]
159
+ #
160
+ # @example
161
+ # Faker::Address.city_suffix #=> "fort"
162
+ #
163
+ # @faker.version 0.3.0
66
164
  def city_suffix
67
165
  fetch('address.city_suffix')
68
166
  end
69
167
 
168
+ ##
169
+ # Produces a city prefix.
170
+ #
171
+ # @return [String]
172
+ #
173
+ # @example
174
+ # Faker::Address.city_prefix #=> "Lake"
175
+ #
176
+ # @faker.version 0.3.0
70
177
  def city_prefix
71
178
  fetch('address.city_prefix')
72
179
  end
73
180
 
181
+ ##
182
+ # Produces a state abbreviation.
183
+ #
184
+ # @return [String]
185
+ #
186
+ # @example
187
+ # Faker::Address.state_abbr #=> "AP"
188
+ #
189
+ # @faker.version 0.3.0
74
190
  def state_abbr
75
191
  fetch('address.state_abbr')
76
192
  end
77
193
 
194
+ ##
195
+ # Produces the name of a state.
196
+ #
197
+ # @return [String]
198
+ #
199
+ # @example
200
+ # Faker::Address.state #=> "California"
201
+ #
202
+ # @faker.version 0.3.0
78
203
  def state
79
204
  fetch('address.state')
80
205
  end
81
206
 
207
+ ##
208
+ # Produces the name of a country.
209
+ #
210
+ # @return [String]
211
+ #
212
+ # @example
213
+ # Faker::Address.country #=> "French Guiana"
214
+ #
215
+ # @faker.version 0.3.0
82
216
  def country
83
217
  fetch('address.country')
84
218
  end
85
219
 
220
+ ##
221
+ # Produces a country by ISO country code. See the
222
+ # [List of ISO 3166 country codes](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
223
+ # on Wikipedia for a full list.
224
+ #
225
+ # @param code [String] An ISO country code.
226
+ # @return [String]
227
+ #
228
+ # @example
229
+ # Faker::Address.country_by_code(code: 'NL') #=> "Netherlands"
230
+ #
231
+ # @faker.version 1.9.2
86
232
  def country_by_code(legacy_code = NOT_GIVEN, code: 'US')
87
233
  warn_for_deprecated_arguments do |keywords|
88
234
  keywords << :code if legacy_code != NOT_GIVEN
@@ -91,6 +237,16 @@ module Faker
91
237
  fetch('address.country_by_code.' + code)
92
238
  end
93
239
 
240
+ ##
241
+ # Produces an ISO 3166 country code when given a country name.
242
+ #
243
+ # @param name [String] Country name in snake_case format.
244
+ # @return [String]
245
+ #
246
+ # @example
247
+ # Faker::Address.country_name_to_code(name: 'united_states') #=> "US"
248
+ #
249
+ # @faker.version 1.9.2
94
250
  def country_name_to_code(legacy_name = NOT_GIVEN, name: 'united_states')
95
251
  warn_for_deprecated_arguments do |keywords|
96
252
  keywords << :name if legacy_name != NOT_GIVEN
@@ -99,22 +255,68 @@ module Faker
99
255
  fetch('address.country_by_name.' + name)
100
256
  end
101
257
 
258
+ ##
259
+ # Produces an ISO 3166 country code.
260
+ #
261
+ # @return [String]
262
+ #
263
+ # @example
264
+ # Faker::Address.country_code #=> "IT"
265
+ #
266
+ # @faker.version 1.4.0
102
267
  def country_code
103
268
  fetch('address.country_code')
104
269
  end
105
270
 
271
+ ##
272
+ # Produces a long (alpha-3) ISO 3166 country code.
273
+ #
274
+ # @return [String]
275
+ #
276
+ # @example
277
+ # Faker::Address.country_code_long #=> "ITA"
278
+ #
279
+ # @faker.version 0.3.0
106
280
  def country_code_long
107
281
  fetch('address.country_code_long')
108
282
  end
109
283
 
284
+ ##
285
+ # Produces a latitude.
286
+ #
287
+ # @return [Float]
288
+ #
289
+ # @example
290
+ # Faker::Address.latitude #=> -58.17256227443719
291
+ #
292
+ # @faker.version 1.0.0
110
293
  def latitude
111
294
  ((rand * 180) - 90).to_f
112
295
  end
113
296
 
297
+ ##
298
+ # Produces a longitude.
299
+ #
300
+ # @return [Float]
301
+ #
302
+ # @example
303
+ # Faker::Address.longitude #=> -156.65548382095133
304
+ #
305
+ # @faker.version 1.0.0
114
306
  def longitude
115
307
  ((rand * 360) - 180).to_f
116
308
  end
117
309
 
310
+ ##
311
+ # Produces a full address.
312
+ #
313
+ # @return [String]
314
+ #
315
+ # @example
316
+ # Faker::Address.full_address
317
+ # #=> "282 Kevin Brook, Imogeneborough, CA 58517"
318
+ #
319
+ # @faker.version 0.3.0
118
320
  def full_address
119
321
  parse('address.full_address')
120
322
  end
@@ -3,18 +3,54 @@
3
3
  module Faker
4
4
  class Ancient < Base
5
5
  class << self
6
+ ##
7
+ # Produces a god from ancient mythology.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::Ancient.god #=> "Zeus"
13
+ #
14
+ # @faker.version 1.7.0
6
15
  def god
7
16
  fetch('ancient.god')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a primordial from ancient mythology.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::Ancient.primordial #=> "Gaia"
26
+ #
27
+ # @faker.version 1.7.0
10
28
  def primordial
11
29
  fetch('ancient.primordial')
12
30
  end
13
31
 
32
+ ##
33
+ # Produces a titan from ancient mythology.
34
+ #
35
+ # @return [String]
36
+ #
37
+ # @example
38
+ # Faker::Ancient.titan #=> "Atlas"
39
+ #
40
+ # @faker.version 1.7.0
14
41
  def titan
15
42
  fetch('ancient.titan')
16
43
  end
17
44
 
45
+ ##
46
+ # Produces a hero from ancient mythology.
47
+ #
48
+ # @return [String]
49
+ #
50
+ # @example
51
+ # Faker::Ancient.hero #=> "Achilles"
52
+ #
53
+ # @faker.version 1.7.0
18
54
  def hero
19
55
  fetch('ancient.hero')
20
56
  end
@@ -3,10 +3,28 @@
3
3
  module Faker
4
4
  class BossaNova < Base
5
5
  class << self
6
+ ##
7
+ # Produces the name of a bossa nova artist.
8
+ #
9
+ # @return [String]
10
+ #
11
+ # @example
12
+ # Faker::BossaNova.artist #=> "Tom Jobin"
13
+ #
14
+ # @faker.version 1.8.3
6
15
  def artist
7
16
  fetch('bossa_nova.artists')
8
17
  end
9
18
 
19
+ ##
20
+ # Produces a bossa nova song.
21
+ #
22
+ # @return [String]
23
+ #
24
+ # @example
25
+ # Faker::BossaNova.song #=> "Chega de Saudade"
26
+ #
27
+ # @faker.version 1.8.3
10
28
  def song
11
29
  fetch('bossa_nova.songs')
12
30
  end
@@ -7,14 +7,41 @@ module Faker
7
7
  flexible :business
8
8
 
9
9
  class << self
10
+ ##
11
+ # Produces a credit card number.
12
+ #
13
+ # @return [String]
14
+ #
15
+ # @example
16
+ # Faker::Business.credit_card_number #=> "1228-1221-1221-1431"
17
+ #
18
+ # @faker.version 1.2.0
10
19
  def credit_card_number
11
20
  fetch('business.credit_card_numbers')
12
21
  end
13
22
 
23
+ ##
24
+ # Produces a credit card expiration date.
25
+ #
26
+ # @return [Date]
27
+ #
28
+ # @example
29
+ # Faker::Business.credit_card_number #=> <Date: 2015-11-11 ((2457338j,0s,0n),+0s,2299161j)>
30
+ #
31
+ # @faker.version 1.2.0
14
32
  def credit_card_expiry_date
15
33
  ::Date.today + (365 * rand(1..4))
16
34
  end
17
35
 
36
+ ##
37
+ # Produces a type of credit card.
38
+ #
39
+ # @return [String]
40
+ #
41
+ # @example
42
+ # Faker::Business.credit_card_type #=> "visa"
43
+ #
44
+ # @faker.version 1.2.0
18
45
  def credit_card_type
19
46
  fetch('business.credit_card_types')
20
47
  end