faker 2.5.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +163 -10
  3. data/README.md +3 -0
  4. data/lib/faker/default/address.rb +202 -0
  5. data/lib/faker/default/ancient.rb +36 -0
  6. data/lib/faker/default/bank.rb +13 -7
  7. data/lib/faker/default/beer.rb +72 -0
  8. data/lib/faker/default/bossa_nova.rb +18 -0
  9. data/lib/faker/default/business.rb +27 -0
  10. data/lib/faker/default/chuck_norris.rb +11 -1
  11. data/lib/faker/default/coffee.rb +45 -0
  12. data/lib/faker/default/coin.rb +18 -0
  13. data/lib/faker/default/color.rb +48 -1
  14. data/lib/faker/default/crypto.rb +27 -0
  15. data/lib/faker/default/currency.rb +27 -0
  16. data/lib/faker/default/date.rb +24 -0
  17. data/lib/faker/default/demographic.rb +57 -0
  18. data/lib/faker/default/driving_licence.rb +2 -2
  19. data/lib/faker/default/educator.rb +60 -6
  20. data/lib/faker/default/esport.rb +45 -0
  21. data/lib/faker/default/fillmurray.rb +23 -1
  22. data/lib/faker/default/food.rb +65 -1
  23. data/lib/faker/default/gender.rb +13 -0
  24. data/lib/faker/default/id_number.rb +29 -0
  25. data/lib/faker/default/internet.rb +17 -7
  26. data/lib/faker/default/job.rb +36 -0
  27. data/lib/faker/default/kpop.rb +54 -0
  28. data/lib/faker/default/relationship.rb +45 -0
  29. data/lib/faker/default/space.rb +127 -0
  30. data/lib/faker/default/team.rb +45 -0
  31. data/lib/faker/default/world_cup.rb +50 -0
  32. data/lib/faker/version.rb +1 -1
  33. data/lib/locales/en-CA.yml +1 -0
  34. data/lib/locales/en/educator.yml +69 -6
  35. data/lib/locales/en/gender.yml +1 -0
  36. data/lib/locales/en/overwatch.yml +2617 -32
  37. data/lib/locales/en/super_smash_bros.yml +1 -0
  38. data/lib/locales/fa.yml +2 -0
  39. data/lib/locales/fr-CA.yml +1 -1
  40. data/lib/locales/ja.yml +6 -2
  41. data/lib/locales/pt-BR.yml +23 -2
  42. metadata +22 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f753c6745324477819be7fa8671395eaf8d64269de47b0aaa366ab3cb0b28655
4
- data.tar.gz: ccbb9fe077964f47444c76843548ff3c9272b321ec6e4c246ce66a2fe772bc7e
3
+ metadata.gz: fb9de0d85e1b327fa6244f79aebac217e98ebc8fa2e1c96b272052f4dae9d782
4
+ data.tar.gz: 5c7b79154bf09afb0219c2ba318a94ef3d4190945dff8dc2416f4f5f2a9eb6f6
5
5
  SHA512:
6
- metadata.gz: a74a4e4fe1fdcafd4a09f379d3fd9955bb09c1a3bcc1ed8d996aec2d7fd7ec8cdbeb898ce536f9778dfdc55779c0b715bff3a8edd11545c5690e2a1f1e79e3b7
7
- data.tar.gz: f6ede2e9b87b99c453b79dad0d2ee57b0b542a72ab8efb166a8a4aeb3c5d6308285c6d6984787542660cfb8a0d99cf5f9419a7cfc6768f74a933ea9c7d63725f
6
+ metadata.gz: 718fd8fc9fce389081c35e218be9cbff7525deb6b63dcfda5900ab29f594ee4e7e547207be787c2db54db9898f85af860800135ed8598fb249c29157ba4e4ce7
7
+ data.tar.gz: af919beb8a106738dfb753d79e689c12f0eea79c5942774f737e0a0d0f345f37c85d25e65a5071b803a2b11ecdb57e74854f3737dd2be50ca2ca3bcd0a7a03d0
@@ -1,6 +1,159 @@
1
1
  # Change Log
2
2
 
3
- ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-30-09)
3
+ ## [v2.9.0](https://github.com/faker-ruby/faker/tree/v2.9.0) (2019-12-16)
4
+
5
+ This version:
6
+ - adds `Faker::Gender.short_binary_type`
7
+ - adds a few YARD docs
8
+ - fix Faker::Educator issues
9
+ - update locales
10
+
11
+ ## Bug/Fixes
12
+
13
+ - [PR #1860](https://github.com/faker-ruby/faker/pull/1860) Fix Educator methods returning bad data. [@connorshea](https://github.com/connorshea)
14
+
15
+ ## Documentation
16
+
17
+ - [PR #1859](https://github.com/faker-ruby/faker/pull/1859) YYYY-MM-DD in CHANGELOG [@jas14](https://github.com/jas14)
18
+ - [PR #1797](https://github.com/faker-ruby/faker/pull/1797) add YARD doc for Faker::Job [@ashishra0](https://github.com/ashishra0)
19
+ - [PR #1790](https://github.com/faker-ruby/faker/pull/1790) add Faker::Beer YARD docs [@ashishra0](https://github.com/ashishra0)
20
+
21
+ ## Feature Request
22
+
23
+ - [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)
24
+
25
+ ## Update locales
26
+
27
+ - [PR #1864](https://github.com/faker-ruby/faker/pull/1864) adding `male` & `female` first names for persian [@alphamarket](https://github.com/alphamarket)
28
+
29
+ ------------------------------------------------------------------------------
30
+
31
+ ## [v2.8.1](https://github.com/faker-ruby/faker/tree/v2.8.1) (2019-12-06)
32
+
33
+ ## Bug/Fixes
34
+
35
+ - [PR #1846](https://github.com/faker-ruby/faker/pull/1846) Fix internet custom domain with suffix [@ngouy](https://github.com/ngouy)
36
+
37
+ ## Documentation
38
+
39
+ - [PR #1852](https://github.com/faker-ruby/faker/pull/1852) Add YARD docs for Faker::Business. [@connorshea](https://github.com/connorshea)
40
+ - [PR #1851](https://github.com/faker-ruby/faker/pull/1851) Add YARD docs for Faker::Crypto. [@connorshea](https://github.com/connorshea)
41
+ - [PR #1850](https://github.com/faker-ruby/faker/pull/1850) Add YARD docs for Faker::Kpop. [@connorshea](https://github.com/connorshea)
42
+ - [PR #1849](https://github.com/faker-ruby/faker/pull/1849) Add YARD docs for Faker::BossaNova. [@connorshea](https://github.com/connorshea)
43
+ - [PR #1848](https://github.com/faker-ruby/faker/pull/1848) Add YARD Docs for Faker::Demographic. [@connorshea](https://github.com/connorshea)
44
+ - [PR #1844](https://github.com/faker-ruby/faker/pull/1844) Fix yard doc in contribution [@vikas95prasad](https://github.com/vikas95prasad)
45
+ - [PR #1802](https://github.com/faker-ruby/faker/pull/1802) Add YARD doc for Faker::Food [@sap1enza](https://github.com/sap1enza)
46
+ - [PR #1766](https://github.com/faker-ruby/faker/pull/1766) Add YARD docs for Faker::Address [@connorshea](https://github.com/connorshea)
47
+
48
+ ## Refactoring
49
+
50
+ - [PR #1847](https://github.com/faker-ruby/faker/pull/1847) Makes minor refactors on Internet.domain_name method [@tiagofsilva](https://github.com/tiagofsilva)
51
+ - [PR #1772](https://github.com/faker-ruby/faker/pull/1848) Refactor Faker::Educator and add docs [@connorshea](https://github.com/connorshea)
52
+
53
+ ## Update local dependencies
54
+
55
+ - Update rubocop requirement from = 0.76.0 to = 0.77.0 (#1843)
56
+
57
+ ------------------------------------------------------------------------------
58
+
59
+ ## [v2.8.0](https://github.com/faker-ruby/faker/tree/v2.8.0) (2019-12-01)
60
+
61
+ ## Bug/Fixes
62
+
63
+ - [PR #1563](https://github.com/faker-ruby/faker/pull/1563)
64
+ Fix generating routing number [@psienko](https://github.com/psienko)
65
+
66
+ ## Chores
67
+
68
+ - [PR #1835](https://github.com/faker-ruby/faker/pull/1835)
69
+ Remove duplicate method description [@pacso](https://github.com/pacso)
70
+
71
+ ## Documentation
72
+
73
+ - [PR #1837](https://github.com/faker-ruby/faker/pull/1837)
74
+ docs: Internet #email, #domain do not control TLD [@olleolleolle](https://github.com/olleolleolle)
75
+ - [PR #1833](https://github.com/faker-ruby/faker/pull/1833) Explain safe_email method [@swrobel](https://github.com/swrobel)
76
+ - [PR #1810](https://github.com/faker-ruby/faker/pull/1810) Add yard docs for Faker::Coffee methods [@LuanGB](https://github.com/LuanGB)
77
+ - [PR #1803](https://github.com/faker-ruby/faker/pull/1803)
78
+ add YARD doc for Faker::Coin [@sap1enza](https://github.com/sap1enza) [@connorshea](https://github.com/connorshea)
79
+ - [PR #1799](https://github.com/faker-ruby/faker/pull/1799) Remove 'See below examples' for consistency [@DevUsmanGhani](https://github.com/DevUsmanGhani)
80
+ - [PR #1793](https://github.com/faker-ruby/faker/pull/1793) add Faker::Relationship YARD docs [@DevUsmanGhani](https://github.com/DevUsmanGhani)
81
+
82
+ ## Feature Request
83
+
84
+ - [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)
85
+
86
+ ## Update locales
87
+
88
+ - [PR #1841](https://github.com/faker-ruby/faker/pull/1841)
89
+ Fix strange result from `Lorem.word` in ja locale [@yujideveloper](https://github.com/yujideveloper)
90
+ - [PR #1839](https://github.com/faker-ruby/faker/pull/1839)
91
+ added new heroes, new maps and almost all of the quotes [@TCsTheMechanic](https://github.com/TCsTheMechanic)
92
+
93
+ ## Update local dependencies
94
+
95
+ - [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)
96
+
97
+ ------------------------------------------------------------------------------
98
+
99
+ ## [v2.7.0](https://github.com/faker-ruby/faker/tree/v2.7.0) (2019-11-01)
100
+
101
+ This version:
102
+ - adds `Faker::IDNumber.chilean_id`
103
+ - updates some translations/locales
104
+ - updates local dependencies
105
+ - adds SemVer badge
106
+
107
+ ## Documentation
108
+
109
+ - [PR #1814](https://github.com/faker-ruby/faker/pull/1814) Add Discord link [@vbrazo](https://github.com/vbrazo)
110
+ - [PR #1289](https://github.com/faker-ruby/faker/pull/1289) Add SemVer compatibility badge to README [@greysteil](https://github.com/greysteil)
111
+
112
+ ## Feature Request
113
+
114
+ - [PR #1819](https://github.com/faker-ruby/faker/pull/1819) Adding chilean_id in Faker::IDNumber [@cristofer](https://github.com/cristofer)
115
+
116
+ ## Update locales
117
+
118
+ - [PR #1824](https://github.com/faker-ruby/faker/pull/1824) Added Canadian Country Code [@clinch](https://github.com/clinch)
119
+ - [PR #1817](https://github.com/faker-ruby/faker/pull/1817) Add Japanese animal names [@shouichi](https://github.com/shouichi)
120
+ - [PR #1816](https://github.com/faker-ruby/faker/pull/1816) Add Japanese bank names [@shouichi](https://github.com/shouichi)
121
+ - [PR #1813](https://github.com/faker-ruby/faker/pull/1813) Translate Canadian provinces for fr-CA [@Bhacaz](https://github.com/Bhacaz)
122
+ - [PR #1806](https://github.com/faker-ruby/faker/pull/1806) Add Terry Bogard to Super Smash Bros. options [@clinch](https://github.com/clinch)
123
+
124
+ ## Update local dependencies
125
+
126
+ - Update rubocop requirement from = 0.75.0 to = 0.75.1 (#1811)
127
+ - Update rubocop requirement from = 0.75.1 to = 0.76.0 (#1822)
128
+ - Update minitest requirement from = 5.12.2 to = 5.13.0 (#1823)
129
+
130
+ ------------------------------------------------------------------------------
131
+
132
+ ## [v2.6.0](https://github.com/faker-ruby/faker/tree/v2.6.0) (2019-10-10)
133
+
134
+ This version:
135
+ - adds `Faker::Date.in_date_period`
136
+ - adds `Faker::WorldCup` YARD docs
137
+ - updates local dependencies
138
+
139
+ ## Documentation
140
+
141
+ - [PR #1789](https://github.com/faker-ruby/faker/pull/1789) Faker::WorldCup YARD docs [@ashishra0](https://github.com/ashishra0)
142
+
143
+ ## Feature Request
144
+
145
+ - [PR #1755](https://github.com/faker-ruby/faker/pull/1755) Add Faker::Date.in_date_period [@AmrAdelKhalil](https://github.com/AmrAdelKhalil)
146
+
147
+ ## Update local dependencies
148
+
149
+ The following development dependencies were updated:
150
+ - Update rake requirement from = 12.3.3 to = 13.0.0 (#1776)
151
+ - Update minitest requirement from = 5.12.0 to = 5.12.2 (#1775)
152
+ - Update test-unit requirement from = 3.3.3 to = 3.3.4 (#1774)
153
+
154
+ ------------------------------------------------------------------------------
155
+
156
+ ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-09-30)
4
157
 
5
158
  This version introduces:
6
159
  - locales for Thai language - the mother language in Thailand
@@ -34,7 +187,7 @@ The following development dependencies were updated:
34
187
 
35
188
  ------------------------------------------------------------------------------
36
189
 
37
- ## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-19-09)
190
+ ## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-09-19)
38
191
 
39
192
  ## Documentation
40
193
 
@@ -59,7 +212,7 @@ The following development dependencies were updated:
59
212
 
60
213
  ------------------------------------------------------------------------------
61
214
 
62
- ## [v2.3.0](https://github.com/faker-ruby/faker/tree/v2.3.0) (2019-12-09)
215
+ ## [v2.3.0](https://github.com/faker-ruby/faker/tree/v2.3.0) (2019-09-12)
63
216
 
64
217
  ## Documentation
65
218
 
@@ -78,7 +231,7 @@ The following development dependencies were updated:
78
231
 
79
232
  ------------------------------------------------------------------------------
80
233
 
81
- ## [v2.2.2](https://github.com/faker-ruby/faker/tree/v2.2.2) (2019-05-09)
234
+ ## [v2.2.2](https://github.com/faker-ruby/faker/tree/v2.2.2) (2019-09-05)
82
235
 
83
236
  ## Bug/Fixes
84
237
 
@@ -102,7 +255,7 @@ The following development dependencies were updated:
102
255
 
103
256
  ------------------------------------------------------------------------------
104
257
 
105
- ## [v2.2.1](https://github.com/faker-ruby/faker/tree/v2.2.1) (2019-30-08)
258
+ ## [v2.2.1](https://github.com/faker-ruby/faker/tree/v2.2.1) (2019-08-30)
106
259
 
107
260
  ## Bug/Fixes
108
261
 
@@ -112,7 +265,7 @@ The following development dependencies were updated:
112
265
 
113
266
  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.
114
267
 
115
- ## [v2.2.0](https://github.com/faker-ruby/faker/tree/v2.2.0) (2019-25-08)
268
+ ## [v2.2.0](https://github.com/faker-ruby/faker/tree/v2.2.0) (2019-08-25)
116
269
 
117
270
  ## Deprecate
118
271
 
@@ -136,7 +289,7 @@ Add deprecation warning for positional arguments to notify users that are coming
136
289
 
137
290
  ------------------------------------------------------------------------------
138
291
 
139
- ## [v2.1.2](https://github.com/faker-ruby/faker/tree/v2.1.2) (2019-10-08)
292
+ ## [v2.1.2](https://github.com/faker-ruby/faker/tree/v2.1.2) (2019-08-10)
140
293
 
141
294
  ## Enhancements
142
295
 
@@ -146,7 +299,7 @@ Add deprecation warning for positional arguments to notify users that are coming
146
299
 
147
300
  We had to use `bundled with 1.7.3` to avoid some issues.
148
301
 
149
- ## [v2.1.1](https://github.com/faker-ruby/faker/tree/2.1.1) (2019-10-08)
302
+ ## [v2.1.1](https://github.com/faker-ruby/faker/tree/2.1.1) (2019-08-10)
150
303
 
151
304
  ## Bug/Fixes
152
305
 
@@ -164,7 +317,7 @@ Rollback Faker::Time changes because we should expect the date format from activ
164
317
 
165
318
  ------------------------------------------------------------------------------
166
319
 
167
- ## [v2.1.0](https://github.com/faker-ruby/faker/tree/v2.1.0) (2019-31-07)
320
+ ## [v2.1.0](https://github.com/faker-ruby/faker/tree/v2.1.0) (2019-07-31)
168
321
 
169
322
  ## Bug/Fixes
170
323
  - [PR #1675](https://github.com/faker-ruby/faker/pull/1675) Fix off-by-one error when formatting month names [@jutonz](https://github.com/jutonz)
@@ -173,7 +326,7 @@ This change required a quick release because it's a breaking issue. Every place
173
326
 
174
327
  ------------------------------------------------------------------------------
175
328
 
176
- ## [v2.0](https://github.com/faker-ruby/faker/tree/v2.0) (2019-31-07)
329
+ ## [v2.0](https://github.com/faker-ruby/faker/tree/v2.0) (2019-07-31)
177
330
 
178
331
  ## Important Note:
179
332
 
data/README.md CHANGED
@@ -7,6 +7,7 @@
7
7
  [![Inline docs](https://inch-ci.org/github/faker-ruby/faker.svg?branch=master)](https://inch-ci.org/github/faker-ruby/faker)
8
8
  [![Test Coverage](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/test_coverage)](https://codeclimate.com/github/stympy/faker/test_coverage)
9
9
  [![Maintainability](https://api.codeclimate.com/v1/badges/ef54c7f9df86e965d64b/maintainability)](https://codeclimate.com/github/stympy/faker/maintainability)
10
+ [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=faker&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=faker&package-manager=bundler&version-scheme=semver)
10
11
 
11
12
  This gem is a port of [Perl's Data::Faker library](https://metacpan.org/pod/Data::Faker) that generates fake data.
12
13
 
@@ -360,5 +361,7 @@ See [CONTRIBUTING.md](https://github.com/stympy/faker/blob/master/CONTRIBUTING.m
360
361
  ## Contact
361
362
  Comments and feedback are welcome. Send an email to Benjamin Curtis via the [google group](http://groups.google.com/group/ruby-faker).
362
363
 
364
+ You can also join our [discord channel](https://discord.gg/RMumTwB) to discuss anything regarding improvements or feature requests.
365
+
363
366
  ## License
364
367
  This code is free to use under the terms of the MIT license.
@@ -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