faker 2.7.0 → 2.10.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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +175 -10
  3. data/README.md +1 -1
  4. data/lib/faker.rb +3 -5
  5. data/lib/faker/default/address.rb +215 -0
  6. data/lib/faker/default/ancient.rb +36 -0
  7. data/lib/faker/default/bank.rb +14 -8
  8. data/lib/faker/default/beer.rb +72 -0
  9. data/lib/faker/default/bossa_nova.rb +18 -0
  10. data/lib/faker/default/business.rb +27 -0
  11. data/lib/faker/default/chuck_norris.rb +11 -1
  12. data/lib/faker/default/coffee.rb +45 -0
  13. data/lib/faker/default/coin.rb +18 -0
  14. data/lib/faker/default/color.rb +48 -1
  15. data/lib/faker/default/crypto.rb +27 -0
  16. data/lib/faker/default/currency.rb +27 -0
  17. data/lib/faker/default/demographic.rb +57 -0
  18. data/lib/faker/default/educator.rb +60 -6
  19. data/lib/faker/default/esport.rb +45 -0
  20. data/lib/faker/default/fillmurray.rb +23 -1
  21. data/lib/faker/default/food.rb +65 -1
  22. data/lib/faker/default/gender.rb +13 -0
  23. data/lib/faker/default/internet.rb +17 -7
  24. data/lib/faker/default/job.rb +36 -0
  25. data/lib/faker/default/kpop.rb +54 -0
  26. data/lib/faker/default/relationship.rb +45 -0
  27. data/lib/faker/default/space.rb +127 -0
  28. data/lib/faker/default/team.rb +45 -0
  29. data/lib/faker/default/world_cup.rb +2 -2
  30. data/lib/faker/music/music.rb +90 -4
  31. data/lib/faker/music/opera.rb +36 -0
  32. data/lib/faker/version.rb +1 -1
  33. data/lib/helpers/unique_generator.rb +4 -0
  34. data/lib/locales/bg.yml +2 -2
  35. data/lib/locales/ca.yml +0 -8
  36. data/lib/locales/da-DK.yml +3 -3
  37. data/lib/locales/en-NZ.yml +130 -8
  38. data/lib/locales/en/address.yml +4 -0
  39. data/lib/locales/en/educator.yml +69 -6
  40. data/lib/locales/en/gender.yml +1 -0
  41. data/lib/locales/en/overwatch.yml +2617 -32
  42. data/lib/locales/en/phone_number.yml +1 -1
  43. data/lib/locales/en/stripe.yml +3 -3
  44. data/lib/locales/fa.yml +2 -0
  45. data/lib/locales/ja.yml +2 -2
  46. data/lib/locales/pt-BR.yml +23 -2
  47. metadata +12 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cacd4170df63c267efee25b7e575509b1ff16528a143a916e90c6381bd48a8b
4
- data.tar.gz: 7165d20574c9994f703d6c5b473b42125c27421754c7e387e3d34d5c174307e7
3
+ metadata.gz: f748d0be9910a52b4c0f7ca9731c0d604a92d00a73a4ce8a47610cde547d7027
4
+ data.tar.gz: 4c02b2ab5e03424e9a7271aae8b5cc45358c2e9e1ac79ef9a43b3c6c97bd2151
5
5
  SHA512:
6
- metadata.gz: 5fc24fc4438f8737f09597f0f8b7be162f5d609c3e8b7799423eae173635d0762688f51e4790e915913e6e263ba9dbb45f6f02829f4ff5cf1fab724e4118acbd
7
- data.tar.gz: ca6e471b882bca1b98ab777d6dfdf8798f4cb061d4c98781a8e93869d979ba8eefdf98541387fa309d745cd67fcb5a91b7adc8a23f647da3c8a705291b5f1989
6
+ metadata.gz: 5e7fd5141e00c96959a05b874f1a972a29772803eb76fec01c78b368755bbe688cd9995276e3145dbd943b723d58eec4234a87152c898aedd5c634b26af9a7c0
7
+ data.tar.gz: af823f7fafa1f532c97d99afbc934b922727f64ee9094fe1c97309c82faa63be66501b91716f3340a7aa32b7378a685d78f65847b9d4b3a1dbe008f21b40f0f8
@@ -1,5 +1,170 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.10.1](https://github.com/faker-ruby/faker/tree/v2.10.1) (2020-01-13)
4
+
5
+ This version:
6
+ - fixes locales
7
+ - updates local dependencies
8
+ - fixes warnings
9
+
10
+ ## Bug/Fixes
11
+
12
+ - [PR #1868](https://github.com/faker-ruby/faker/pull/1868) Fix a deprecation warning in unique_generator.rb related to the kwarg [@connorshea](https://github.com/connorshea)
13
+
14
+ ## Update Locales
15
+
16
+ - [PR #1800](https://github.com/faker-ruby/faker/pull/1800) Update diners_club and jcb test cards since they were updated in String [@santib](https://github.com/santib)
17
+ - [PR #1879](https://github.com/faker-ruby/faker/pull/1879) Field changes in da-DK locale [@psibi](https://github.com/psibi)
18
+ - [PR #1878](https://github.com/faker-ruby/faker/pull/1878) Fix name related files in ca locale [@psibi](https://github.com/psibi)
19
+ - [PR #1877](https://github.com/faker-ruby/faker/pull/1877) Fix the path names for bg.yml [@psibi](https://github.com/psibi)
20
+
21
+ ## Update local dependencies
22
+
23
+ Allow all versions of i18n from 1.6 up to 2 (#1894) [@orien](https://github.com/orien)
24
+ Update minitest requirement from = 5.13.0 to = 5.14.0 (#1904)
25
+ Bump i18n from 1.8.1 to 1.8.2 (#1905)
26
+ Bump i18n from 1.8.0 to 1.8.1 (#1895)
27
+ Update i18n requirement from >= 1.6, < 1.8 to >= 1.6, < 1.9 (#1893)
28
+ Update yard requirement from = 0.9.23 to = 0.9.24 (#1892)
29
+ Update rubocop requirement from = 0.78.0 to = 0.79.0 (#1890)
30
+ Update yard requirement from = 0.9.22 to = 0.9.23 (#1889)
31
+ Update yard requirement from = 0.9.20 to = 0.9.22 (#1882)
32
+
33
+ ------------------------------------------------------------------------------
34
+
35
+ ## [v2.10.0](https://github.com/faker-ruby/faker/tree/v2.10.0) (2019-12-28)
36
+
37
+ This version:
38
+ - adds `Faker::Address.mail_box`
39
+ - adds YARD docs
40
+ - fix Ruby 2.7 warnings
41
+ - adds other minor changes
42
+
43
+ ## Bug/Fixes
44
+
45
+ - [PR #1876](https://github.com/faker-ruby/faker/pull/1876) Fix Ruby 2.7 deprecation warnings for the translate method. [@connorshea](https://github.com/connorshea)
46
+ - [PR #1867](https://github.com/faker-ruby/faker/pull/1867) Fix tests failing on Ruby 2.7 [@connorshea](https://github.com/connorshea)
47
+
48
+ ## Chores
49
+
50
+ - [PR #1866](https://github.com/faker-ruby/faker/pull/1866) Upgrade the Gemfile.lock to Bundler 2. [@connorshea](https://github.com/connorshea)
51
+
52
+ ## Documentation
53
+
54
+ - [PR #1873](https://github.com/faker-ruby/faker/pull/1873) Add YARD docs for `Faker::Music{,::Opera}` [@jas14](https://github.com/jas14)
55
+ - [PR #1862](https://github.com/faker-ruby/faker/pull/1862) Update phone number documentation [@aVigorousDev](https://github.com/aVigorousDev)
56
+
57
+ ## Feature Request
58
+
59
+ - [PR #1875](https://github.com/faker-ruby/faker/pull/1875) Add Ruby 2.7 to the CI test matrix. [@connorshea](https://github.com/connorshea)
60
+ - [PR #1568](https://github.com/faker-ruby/faker/pull/1568) Add `Faker::Address.mail_box` and some NZ locale updates [@mermop](https://github.com/mermop)
61
+
62
+ ## Refactoring
63
+
64
+ - [PR #1874](https://github.com/faker-ruby/faker/pull/1874) Extract constants in `Faker::Music` [@jas14](https://github.com/jas14)
65
+
66
+ ## Update local dependencies
67
+
68
+ Update rubocop requirement from = 0.77.0 to = 0.78.0 (#1869)
69
+
70
+ ------------------------------------------------------------------------------
71
+
72
+ ## [v2.9.0](https://github.com/faker-ruby/faker/tree/v2.9.0) (2019-12-16)
73
+
74
+ This version:
75
+ - adds `Faker::Gender.short_binary_type`
76
+ - adds a few YARD docs
77
+ - fix Faker::Educator issues
78
+ - update locales
79
+
80
+ ## Bug/Fixes
81
+
82
+ - [PR #1860](https://github.com/faker-ruby/faker/pull/1860) Fix Educator methods returning bad data. [@connorshea](https://github.com/connorshea)
83
+
84
+ ## Documentation
85
+
86
+ - [PR #1859](https://github.com/faker-ruby/faker/pull/1859) YYYY-MM-DD in CHANGELOG [@jas14](https://github.com/jas14)
87
+ - [PR #1797](https://github.com/faker-ruby/faker/pull/1797) add YARD doc for Faker::Job [@ashishra0](https://github.com/ashishra0)
88
+ - [PR #1790](https://github.com/faker-ruby/faker/pull/1790) add Faker::Beer YARD docs [@ashishra0](https://github.com/ashishra0)
89
+
90
+ ## Feature Request
91
+
92
+ - [PR #1863](https://github.com/faker-ruby/faker/pull/1863) Add Faker::Gender.short_binary_type [@bruno-b-martins](https://github.com/bruno-b-martins)
93
+
94
+ ## Update locales
95
+
96
+ - [PR #1864](https://github.com/faker-ruby/faker/pull/1864) adding `male` & `female` first names for persian [@alphamarket](https://github.com/alphamarket)
97
+
98
+ ------------------------------------------------------------------------------
99
+
100
+ ## [v2.8.1](https://github.com/faker-ruby/faker/tree/v2.8.1) (2019-12-06)
101
+
102
+ ## Bug/Fixes
103
+
104
+ - [PR #1846](https://github.com/faker-ruby/faker/pull/1846) Fix internet custom domain with suffix [@ngouy](https://github.com/ngouy)
105
+
106
+ ## Documentation
107
+
108
+ - [PR #1852](https://github.com/faker-ruby/faker/pull/1852) Add YARD docs for Faker::Business. [@connorshea](https://github.com/connorshea)
109
+ - [PR #1851](https://github.com/faker-ruby/faker/pull/1851) Add YARD docs for Faker::Crypto. [@connorshea](https://github.com/connorshea)
110
+ - [PR #1850](https://github.com/faker-ruby/faker/pull/1850) Add YARD docs for Faker::Kpop. [@connorshea](https://github.com/connorshea)
111
+ - [PR #1849](https://github.com/faker-ruby/faker/pull/1849) Add YARD docs for Faker::BossaNova. [@connorshea](https://github.com/connorshea)
112
+ - [PR #1848](https://github.com/faker-ruby/faker/pull/1848) Add YARD Docs for Faker::Demographic. [@connorshea](https://github.com/connorshea)
113
+ - [PR #1844](https://github.com/faker-ruby/faker/pull/1844) Fix yard doc in contribution [@vikas95prasad](https://github.com/vikas95prasad)
114
+ - [PR #1802](https://github.com/faker-ruby/faker/pull/1802) Add YARD doc for Faker::Food [@sap1enza](https://github.com/sap1enza)
115
+ - [PR #1766](https://github.com/faker-ruby/faker/pull/1766) Add YARD docs for Faker::Address [@connorshea](https://github.com/connorshea)
116
+
117
+ ## Refactoring
118
+
119
+ - [PR #1847](https://github.com/faker-ruby/faker/pull/1847) Makes minor refactors on Internet.domain_name method [@tiagofsilva](https://github.com/tiagofsilva)
120
+ - [PR #1772](https://github.com/faker-ruby/faker/pull/1848) Refactor Faker::Educator and add docs [@connorshea](https://github.com/connorshea)
121
+
122
+ ## Update local dependencies
123
+
124
+ - Update rubocop requirement from = 0.76.0 to = 0.77.0 (#1843)
125
+
126
+ ------------------------------------------------------------------------------
127
+
128
+ ## [v2.8.0](https://github.com/faker-ruby/faker/tree/v2.8.0) (2019-12-01)
129
+
130
+ ## Bug/Fixes
131
+
132
+ - [PR #1563](https://github.com/faker-ruby/faker/pull/1563)
133
+ Fix generating routing number [@psienko](https://github.com/psienko)
134
+
135
+ ## Chores
136
+
137
+ - [PR #1835](https://github.com/faker-ruby/faker/pull/1835)
138
+ Remove duplicate method description [@pacso](https://github.com/pacso)
139
+
140
+ ## Documentation
141
+
142
+ - [PR #1837](https://github.com/faker-ruby/faker/pull/1837)
143
+ docs: Internet #email, #domain do not control TLD [@olleolleolle](https://github.com/olleolleolle)
144
+ - [PR #1833](https://github.com/faker-ruby/faker/pull/1833) Explain safe_email method [@swrobel](https://github.com/swrobel)
145
+ - [PR #1810](https://github.com/faker-ruby/faker/pull/1810) Add yard docs for Faker::Coffee methods [@LuanGB](https://github.com/LuanGB)
146
+ - [PR #1803](https://github.com/faker-ruby/faker/pull/1803)
147
+ add YARD doc for Faker::Coin [@sap1enza](https://github.com/sap1enza) [@connorshea](https://github.com/connorshea)
148
+ - [PR #1799](https://github.com/faker-ruby/faker/pull/1799) Remove 'See below examples' for consistency [@DevUsmanGhani](https://github.com/DevUsmanGhani)
149
+ - [PR #1793](https://github.com/faker-ruby/faker/pull/1793) add Faker::Relationship YARD docs [@DevUsmanGhani](https://github.com/DevUsmanGhani)
150
+
151
+ ## Feature Request
152
+
153
+ - [PR #1808](https://github.com/faker-ruby/faker/pull/1808) Adds domain option for Internet email and domain_name methods [@tiagofsilva](https://github.com/tiagofsilva)
154
+
155
+ ## Update locales
156
+
157
+ - [PR #1841](https://github.com/faker-ruby/faker/pull/1841)
158
+ Fix strange result from `Lorem.word` in ja locale [@yujideveloper](https://github.com/yujideveloper)
159
+ - [PR #1839](https://github.com/faker-ruby/faker/pull/1839)
160
+ added new heroes, new maps and almost all of the quotes [@TCsTheMechanic](https://github.com/TCsTheMechanic)
161
+
162
+ ## Update local dependencies
163
+
164
+ - [PR #1831](https://github.com/faker-ruby/faker/pull/1831) Update rake requirement from = 13.0.0 to = 13.0.1 [@DevUsmanGhani](https://github.com/DevUsmanGhani)
165
+
166
+ ------------------------------------------------------------------------------
167
+
3
168
  ## [v2.7.0](https://github.com/faker-ruby/faker/tree/v2.7.0) (2019-11-01)
4
169
 
5
170
  This version:
@@ -57,7 +222,7 @@ The following development dependencies were updated:
57
222
 
58
223
  ------------------------------------------------------------------------------
59
224
 
60
- ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-30-09)
225
+ ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-09-30)
61
226
 
62
227
  This version introduces:
63
228
  - locales for Thai language - the mother language in Thailand
@@ -91,7 +256,7 @@ The following development dependencies were updated:
91
256
 
92
257
  ------------------------------------------------------------------------------
93
258
 
94
- ## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-19-09)
259
+ ## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-09-19)
95
260
 
96
261
  ## Documentation
97
262
 
@@ -116,7 +281,7 @@ The following development dependencies were updated:
116
281
 
117
282
  ------------------------------------------------------------------------------
118
283
 
119
- ## [v2.3.0](https://github.com/faker-ruby/faker/tree/v2.3.0) (2019-12-09)
284
+ ## [v2.3.0](https://github.com/faker-ruby/faker/tree/v2.3.0) (2019-09-12)
120
285
 
121
286
  ## Documentation
122
287
 
@@ -135,7 +300,7 @@ The following development dependencies were updated:
135
300
 
136
301
  ------------------------------------------------------------------------------
137
302
 
138
- ## [v2.2.2](https://github.com/faker-ruby/faker/tree/v2.2.2) (2019-05-09)
303
+ ## [v2.2.2](https://github.com/faker-ruby/faker/tree/v2.2.2) (2019-09-05)
139
304
 
140
305
  ## Bug/Fixes
141
306
 
@@ -159,7 +324,7 @@ The following development dependencies were updated:
159
324
 
160
325
  ------------------------------------------------------------------------------
161
326
 
162
- ## [v2.2.1](https://github.com/faker-ruby/faker/tree/v2.2.1) (2019-30-08)
327
+ ## [v2.2.1](https://github.com/faker-ruby/faker/tree/v2.2.1) (2019-08-30)
163
328
 
164
329
  ## Bug/Fixes
165
330
 
@@ -169,7 +334,7 @@ The following development dependencies were updated:
169
334
 
170
335
  Fixing number with one digit caused the test_insignificant_zero to fail. As it seemed that the behavior tested by test_insignificant_zero was already covered by test_number and test_decimal, we removed it to prevent duplication.
171
336
 
172
- ## [v2.2.0](https://github.com/faker-ruby/faker/tree/v2.2.0) (2019-25-08)
337
+ ## [v2.2.0](https://github.com/faker-ruby/faker/tree/v2.2.0) (2019-08-25)
173
338
 
174
339
  ## Deprecate
175
340
 
@@ -193,7 +358,7 @@ Add deprecation warning for positional arguments to notify users that are coming
193
358
 
194
359
  ------------------------------------------------------------------------------
195
360
 
196
- ## [v2.1.2](https://github.com/faker-ruby/faker/tree/v2.1.2) (2019-10-08)
361
+ ## [v2.1.2](https://github.com/faker-ruby/faker/tree/v2.1.2) (2019-08-10)
197
362
 
198
363
  ## Enhancements
199
364
 
@@ -203,7 +368,7 @@ Add deprecation warning for positional arguments to notify users that are coming
203
368
 
204
369
  We had to use `bundled with 1.7.3` to avoid some issues.
205
370
 
206
- ## [v2.1.1](https://github.com/faker-ruby/faker/tree/2.1.1) (2019-10-08)
371
+ ## [v2.1.1](https://github.com/faker-ruby/faker/tree/2.1.1) (2019-08-10)
207
372
 
208
373
  ## Bug/Fixes
209
374
 
@@ -221,7 +386,7 @@ Rollback Faker::Time changes because we should expect the date format from activ
221
386
 
222
387
  ------------------------------------------------------------------------------
223
388
 
224
- ## [v2.1.0](https://github.com/faker-ruby/faker/tree/v2.1.0) (2019-31-07)
389
+ ## [v2.1.0](https://github.com/faker-ruby/faker/tree/v2.1.0) (2019-07-31)
225
390
 
226
391
  ## Bug/Fixes
227
392
  - [PR #1675](https://github.com/faker-ruby/faker/pull/1675) Fix off-by-one error when formatting month names [@jutonz](https://github.com/jutonz)
@@ -230,7 +395,7 @@ This change required a quick release because it's a breaking issue. Every place
230
395
 
231
396
  ------------------------------------------------------------------------------
232
397
 
233
- ## [v2.0](https://github.com/faker-ruby/faker/tree/v2.0) (2019-31-07)
398
+ ## [v2.0](https://github.com/faker-ruby/faker/tree/v2.0) (2019-07-31)
234
399
 
235
400
  ## Important Note:
236
401
 
data/README.md CHANGED
@@ -43,7 +43,7 @@ development.
43
43
 
44
44
  ### NOTE
45
45
  * While Faker generates data at random, returned values are not guaranteed to be unique by default.
46
- You must explicity specify when you require unique values, see [details](#ensuring-unique-values).
46
+ You must explicitly specify when you require unique values, see [details](#ensuring-unique-values).
47
47
  Values also can be deterministic if you use the deterministic feature, see [details](#deterministic-random)
48
48
  * This is the `master` branch of Faker and may contain changes that are not yet released.
49
49
  Please refer the README of your version for the available methods.
@@ -151,20 +151,18 @@ module Faker
151
151
 
152
152
  # Call I18n.translate with our configured locale if no
153
153
  # locale is specified
154
- def translate(*args)
155
- opts = args.last.is_a?(Hash) ? args.pop : {}
154
+ def translate(*args, **opts)
156
155
  opts[:locale] ||= Faker::Config.locale
157
156
  opts[:raise] = true
158
- I18n.translate(*args.push(opts))
157
+ I18n.translate(*args, **opts)
159
158
  rescue I18n::MissingTranslationData
160
- opts = args.last.is_a?(Hash) ? args.pop : {}
161
159
  opts[:locale] = :en
162
160
 
163
161
  # Super-simple fallback -- fallback to en if the
164
162
  # translation was missing. If the translation isn't
165
163
  # in en either, then it will raise again.
166
164
  disable_enforce_available_locales do
167
- I18n.translate(*args.push(opts))
165
+ I18n.translate(*args, **opts)
168
166
  end
169
167
  end
170
168
 
@@ -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,70 @@ 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
+ #
101
+ # Produces a mail box number.
102
+ # @return [String]
103
+ #
104
+ # @example
105
+ # Faker::Address.mail_box #=> "PO Box 123"
106
+ #
107
+ # @faker.version 2.9.1
108
+ def mail_box
109
+ bothify(fetch('address.mail_box'))
110
+ end
111
+
112
+ ##
113
+ # Produces a Zip Code.
114
+ #
115
+ # @param state_abbreviation [String] an abbreviation for a state where the zip code should be located.
116
+ # @return [String]
117
+ #
118
+ # @example
119
+ # Faker::Address.zip_code #=> "58517"
120
+ # Faker::Address.zip_code #=> "23285-4905"
121
+ # Faker::Address.zip_code(state_abbreviation: 'CO') #=> "80011"
122
+ #
123
+ # @faker.version 0.3.0
40
124
  def zip_code(legacy_state_abbreviation = NOT_GIVEN, state_abbreviation: '')
41
125
  warn_for_deprecated_arguments do |keywords|
42
126
  keywords << :state_abbreviation if legacy_state_abbreviation != NOT_GIVEN
@@ -52,6 +136,15 @@ module Faker
52
136
  bothify(fetch('address.postcode_by_state.' + state_abbreviation))
53
137
  end
54
138
 
139
+ ##
140
+ # Produces the name of a time zone.
141
+ #
142
+ # @return [String]
143
+ #
144
+ # @example
145
+ # Faker::Address.time_zone #=> "Asia/Yakutsk"
146
+ #
147
+ # @faker.version 1.2.0
55
148
  def time_zone
56
149
  fetch('address.time_zone')
57
150
  end
@@ -59,30 +152,96 @@ module Faker
59
152
  alias zip zip_code
60
153
  alias postcode zip_code
61
154
 
155
+ ##
156
+ # Produces a street suffix.
157
+ #
158
+ # @return [String]
159
+ #
160
+ # @example
161
+ # Faker::Address.street_suffix #=> "Street"
162
+ #
163
+ # @faker.version 0.3.0
62
164
  def street_suffix
63
165
  fetch('address.street_suffix')
64
166
  end
65
167
 
168
+ ##
169
+ # Produces a city suffix.
170
+ #
171
+ # @return [String]
172
+ #
173
+ # @example
174
+ # Faker::Address.city_suffix #=> "fort"
175
+ #
176
+ # @faker.version 0.3.0
66
177
  def city_suffix
67
178
  fetch('address.city_suffix')
68
179
  end
69
180
 
181
+ ##
182
+ # Produces a city prefix.
183
+ #
184
+ # @return [String]
185
+ #
186
+ # @example
187
+ # Faker::Address.city_prefix #=> "Lake"
188
+ #
189
+ # @faker.version 0.3.0
70
190
  def city_prefix
71
191
  fetch('address.city_prefix')
72
192
  end
73
193
 
194
+ ##
195
+ # Produces a state abbreviation.
196
+ #
197
+ # @return [String]
198
+ #
199
+ # @example
200
+ # Faker::Address.state_abbr #=> "AP"
201
+ #
202
+ # @faker.version 0.3.0
74
203
  def state_abbr
75
204
  fetch('address.state_abbr')
76
205
  end
77
206
 
207
+ ##
208
+ # Produces the name of a state.
209
+ #
210
+ # @return [String]
211
+ #
212
+ # @example
213
+ # Faker::Address.state #=> "California"
214
+ #
215
+ # @faker.version 0.3.0
78
216
  def state
79
217
  fetch('address.state')
80
218
  end
81
219
 
220
+ ##
221
+ # Produces the name of a country.
222
+ #
223
+ # @return [String]
224
+ #
225
+ # @example
226
+ # Faker::Address.country #=> "French Guiana"
227
+ #
228
+ # @faker.version 0.3.0
82
229
  def country
83
230
  fetch('address.country')
84
231
  end
85
232
 
233
+ ##
234
+ # Produces a country by ISO country code. See the
235
+ # [List of ISO 3166 country codes](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
236
+ # on Wikipedia for a full list.
237
+ #
238
+ # @param code [String] An ISO country code.
239
+ # @return [String]
240
+ #
241
+ # @example
242
+ # Faker::Address.country_by_code(code: 'NL') #=> "Netherlands"
243
+ #
244
+ # @faker.version 1.9.2
86
245
  def country_by_code(legacy_code = NOT_GIVEN, code: 'US')
87
246
  warn_for_deprecated_arguments do |keywords|
88
247
  keywords << :code if legacy_code != NOT_GIVEN
@@ -91,6 +250,16 @@ module Faker
91
250
  fetch('address.country_by_code.' + code)
92
251
  end
93
252
 
253
+ ##
254
+ # Produces an ISO 3166 country code when given a country name.
255
+ #
256
+ # @param name [String] Country name in snake_case format.
257
+ # @return [String]
258
+ #
259
+ # @example
260
+ # Faker::Address.country_name_to_code(name: 'united_states') #=> "US"
261
+ #
262
+ # @faker.version 1.9.2
94
263
  def country_name_to_code(legacy_name = NOT_GIVEN, name: 'united_states')
95
264
  warn_for_deprecated_arguments do |keywords|
96
265
  keywords << :name if legacy_name != NOT_GIVEN
@@ -99,22 +268,68 @@ module Faker
99
268
  fetch('address.country_by_name.' + name)
100
269
  end
101
270
 
271
+ ##
272
+ # Produces an ISO 3166 country code.
273
+ #
274
+ # @return [String]
275
+ #
276
+ # @example
277
+ # Faker::Address.country_code #=> "IT"
278
+ #
279
+ # @faker.version 1.4.0
102
280
  def country_code
103
281
  fetch('address.country_code')
104
282
  end
105
283
 
284
+ ##
285
+ # Produces a long (alpha-3) ISO 3166 country code.
286
+ #
287
+ # @return [String]
288
+ #
289
+ # @example
290
+ # Faker::Address.country_code_long #=> "ITA"
291
+ #
292
+ # @faker.version 0.3.0
106
293
  def country_code_long
107
294
  fetch('address.country_code_long')
108
295
  end
109
296
 
297
+ ##
298
+ # Produces a latitude.
299
+ #
300
+ # @return [Float]
301
+ #
302
+ # @example
303
+ # Faker::Address.latitude #=> -58.17256227443719
304
+ #
305
+ # @faker.version 1.0.0
110
306
  def latitude
111
307
  ((rand * 180) - 90).to_f
112
308
  end
113
309
 
310
+ ##
311
+ # Produces a longitude.
312
+ #
313
+ # @return [Float]
314
+ #
315
+ # @example
316
+ # Faker::Address.longitude #=> -156.65548382095133
317
+ #
318
+ # @faker.version 1.0.0
114
319
  def longitude
115
320
  ((rand * 360) - 180).to_f
116
321
  end
117
322
 
323
+ ##
324
+ # Produces a full address.
325
+ #
326
+ # @return [String]
327
+ #
328
+ # @example
329
+ # Faker::Address.full_address
330
+ # #=> "282 Kevin Brook, Imogeneborough, CA 58517"
331
+ #
332
+ # @faker.version 0.3.0
118
333
  def full_address
119
334
  parse('address.full_address')
120
335
  end