faker 2.4.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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +159 -0
  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/app.rb +2 -1
  7. data/lib/faker/default/avatar.rb +2 -1
  8. data/lib/faker/default/bank.rb +13 -7
  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 +12 -2
  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/date.rb +83 -2
  18. data/lib/faker/default/demographic.rb +57 -0
  19. data/lib/faker/default/driving_licence.rb +2 -2
  20. data/lib/faker/default/educator.rb +60 -6
  21. data/lib/faker/default/esport.rb +45 -0
  22. data/lib/faker/default/fillmurray.rb +23 -1
  23. data/lib/faker/default/food.rb +65 -1
  24. data/lib/faker/default/id_number.rb +29 -0
  25. data/lib/faker/default/internet.rb +21 -8
  26. data/lib/faker/default/kpop.rb +54 -0
  27. data/lib/faker/default/nation.rb +48 -5
  28. data/lib/faker/default/number.rb +124 -0
  29. data/lib/faker/default/relationship.rb +45 -0
  30. data/lib/faker/default/restaurant.rb +54 -2
  31. data/lib/faker/default/space.rb +127 -0
  32. data/lib/faker/default/team.rb +45 -0
  33. data/lib/faker/default/time.rb +85 -8
  34. data/lib/faker/default/world_cup.rb +50 -0
  35. data/lib/faker/games/zelda.rb +1 -1
  36. data/lib/faker/japanese_media/one_piece.rb +54 -0
  37. data/lib/faker/movies/back_to_the_future.rb +28 -0
  38. data/lib/faker/movies/ghostbusters.rb +28 -0
  39. data/lib/faker/movies/harry_potter.rb +54 -0
  40. data/lib/faker/movies/hitchhikers_guide_to_the_galaxy.rb +69 -0
  41. data/lib/faker/movies/lebowski.rb +27 -0
  42. data/lib/faker/movies/lord_of_the_rings.rb +28 -0
  43. data/lib/faker/movies/princess_bride.rb +19 -0
  44. data/lib/faker/movies/star_wars.rb +94 -0
  45. data/lib/faker/movies/v_for_vendetta.rb +29 -0
  46. data/lib/faker/music/umphreys_mcgee.rb +9 -0
  47. data/lib/faker/sports/basketball.rb +36 -0
  48. data/lib/faker/sports/football.rb +45 -0
  49. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +9 -0
  50. data/lib/faker/tv_shows/bojack_horseman.rb +28 -0
  51. data/lib/faker/tv_shows/buffy.rb +45 -0
  52. data/lib/faker/tv_shows/community.rb +19 -0
  53. data/lib/faker/tv_shows/dr_who.rb +78 -2
  54. data/lib/faker/tv_shows/dumb_and_dumber.rb +28 -0
  55. data/lib/faker/tv_shows/family_guy.rb +28 -0
  56. data/lib/faker/tv_shows/friends.rb +27 -0
  57. data/lib/faker/tv_shows/game_of_thrones.rb +46 -0
  58. data/lib/faker/tv_shows/hey_arnold.rb +27 -0
  59. data/lib/faker/tv_shows/how_i_met_your_mother.rb +37 -0
  60. data/lib/faker/tv_shows/michael_scott.rb +13 -0
  61. data/lib/faker/tv_shows/new_girl.rb +19 -0
  62. data/lib/faker/tv_shows/parks_and_rec.rb +18 -0
  63. data/lib/faker/tv_shows/rick_and_morty.rb +28 -0
  64. data/lib/faker/tv_shows/ru_paul.rb +18 -0
  65. data/lib/faker/tv_shows/seinfeld.rb +28 -0
  66. data/lib/faker/tv_shows/silicon_valley.rb +75 -0
  67. data/lib/faker/tv_shows/simpsons.rb +28 -0
  68. data/lib/faker/tv_shows/south_park.rb +19 -0
  69. data/lib/faker/tv_shows/star_trek.rb +36 -0
  70. data/lib/faker/tv_shows/stargate.rb +28 -0
  71. data/lib/faker/tv_shows/stranger_things.rb +19 -0
  72. data/lib/faker/tv_shows/the_expanse.rb +36 -0
  73. data/lib/faker/tv_shows/the_fresh_prince_of_bel_air.rb +28 -0
  74. data/lib/faker/tv_shows/the_it_crowd.rb +37 -0
  75. data/lib/faker/tv_shows/the_thick_of_it.rb +28 -0
  76. data/lib/faker/tv_shows/twin_peaks.rb +28 -0
  77. data/lib/faker/tv_shows/venture_bros.rb +38 -0
  78. data/lib/faker/version.rb +1 -1
  79. data/lib/locales/en-CA.yml +1 -0
  80. data/lib/locales/en-TH.yml +360 -0
  81. data/lib/locales/en/color.yml +1 -1
  82. data/lib/locales/en/dr_who.yml +1 -1
  83. data/lib/locales/en/educator.yml +69 -6
  84. data/lib/locales/en/overwatch.yml +2617 -32
  85. data/lib/locales/en/super_smash_bros.yml +1 -0
  86. data/lib/locales/fr-CA.yml +1 -1
  87. data/lib/locales/ja.yml +6 -2
  88. data/lib/locales/pt-BR.yml +23 -2
  89. data/lib/locales/th.yml +380 -0
  90. metadata +22 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f048f99db924a824430ec4b564d6526df4912994e5837146e309adfa35d8a8b5
4
- data.tar.gz: a6d6c98bd04fb29faaa2549e51053d882cf930dd4fae38b478e8e35230e496ab
3
+ metadata.gz: 76e19dcb7a0fa3703ab5ad3864a973a9bb4ce8d18ca75947ebc8300a3f29fbcb
4
+ data.tar.gz: 7a171e80faa3db8686d8e0f9e2d4e21f77322268161aebfbae5b58b14139a795
5
5
  SHA512:
6
- metadata.gz: 6e389da23548bfd30277a61c39051a874fb1da29b4af4258b11c8327eef7a2707c5862983eecd93658331d2c89643a18a588a3f978a3de3276511a501ff2f659
7
- data.tar.gz: 9028bfe72719c6f4da2653bfc17f50fac5559a1238175045b9aaad4dd86fd404b12048e5e9ba6dbe7d3ab388300b5ff8763e0c0f9984fa51d57b2c760e5c02cb
6
+ metadata.gz: 8f161b394abfccf7ca9122d8bc6d8957f63f8c0f9c5d3772c31ed898dfc50fb50b13b0da01289a67ff89904ec3cf4a16e514b568a9ef69a07f48e27e4e1e7da5
7
+ data.tar.gz: 00f2bcd1ae3821b113e1b375a1ceb0baa5657aad695f9f7fb7569f4bc74a65cacec2096535664a73f6a0840554613e7e11111dcce6d50fcc126e6c46199b930b
@@ -1,5 +1,164 @@
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
+
31
+ ## [v2.8.0](https://github.com/faker-ruby/faker/tree/v2.8.0) (2019-12-01)
32
+
33
+ ## Bug/Fixes
34
+
35
+ - [PR #1563](https://github.com/faker-ruby/faker/pull/1563)
36
+ Fix generating routing number [@psienko](https://github.com/psienko)
37
+
38
+ ## Chores
39
+
40
+ - [PR #1835](https://github.com/faker-ruby/faker/pull/1835)
41
+ Remove duplicate method description [@pacso](https://github.com/pacso)
42
+
43
+ ## Documentation
44
+
45
+ - [PR #1837](https://github.com/faker-ruby/faker/pull/1837)
46
+ docs: Internet #email, #domain do not control TLD [@olleolleolle](https://github.com/olleolleolle)
47
+ - [PR #1833](https://github.com/faker-ruby/faker/pull/1833) Explain safe_email method [@swrobel](https://github.com/swrobel)
48
+ - [PR #1810](https://github.com/faker-ruby/faker/pull/1810) Add yard docs for Faker::Coffee methods [@LuanGB](https://github.com/LuanGB)
49
+ - [PR #1803](https://github.com/faker-ruby/faker/pull/1803)
50
+ add YARD doc for Faker::Coin [@sap1enza](https://github.com/sap1enza) [@connorshea](https://github.com/connorshea)
51
+ - [PR #1799](https://github.com/faker-ruby/faker/pull/1799) Remove 'See below examples' for consistency [@DevUsmanGhani](https://github.com/DevUsmanGhani)
52
+ - [PR #1793](https://github.com/faker-ruby/faker/pull/1793) add Faker::Relationship YARD docs [@DevUsmanGhani](https://github.com/DevUsmanGhani)
53
+
54
+ ## Feature Request
55
+
56
+ - [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)
57
+
58
+ ## Update locales
59
+
60
+ - [PR #1841](https://github.com/faker-ruby/faker/pull/1841)
61
+ Fix strange result from `Lorem.word` in ja locale [@yujideveloper](https://github.com/yujideveloper)
62
+ - [PR #1839](https://github.com/faker-ruby/faker/pull/1839)
63
+ added new heroes, new maps and almost all of the quotes [@TCsTheMechanic](https://github.com/TCsTheMechanic)
64
+
65
+ ## Update local dependencies
66
+
67
+ - [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)
68
+
69
+ ------------------------------------------------------------------------------
70
+
71
+ ## [v2.7.0](https://github.com/faker-ruby/faker/tree/v2.7.0) (2019-11-01)
72
+
73
+ This version:
74
+ - adds `Faker::IDNumber.chilean_id`
75
+ - updates some translations/locales
76
+ - updates local dependencies
77
+ - adds SemVer badge
78
+
79
+ ## Documentation
80
+
81
+ - [PR #1814](https://github.com/faker-ruby/faker/pull/1814) Add Discord link [@vbrazo](https://github.com/vbrazo)
82
+ - [PR #1289](https://github.com/faker-ruby/faker/pull/1289) Add SemVer compatibility badge to README [@greysteil](https://github.com/greysteil)
83
+
84
+ ## Feature Request
85
+
86
+ - [PR #1819](https://github.com/faker-ruby/faker/pull/1819) Adding chilean_id in Faker::IDNumber [@cristofer](https://github.com/cristofer)
87
+
88
+ ## Update locales
89
+
90
+ - [PR #1824](https://github.com/faker-ruby/faker/pull/1824) Added Canadian Country Code [@clinch](https://github.com/clinch)
91
+ - [PR #1817](https://github.com/faker-ruby/faker/pull/1817) Add Japanese animal names [@shouichi](https://github.com/shouichi)
92
+ - [PR #1816](https://github.com/faker-ruby/faker/pull/1816) Add Japanese bank names [@shouichi](https://github.com/shouichi)
93
+ - [PR #1813](https://github.com/faker-ruby/faker/pull/1813) Translate Canadian provinces for fr-CA [@Bhacaz](https://github.com/Bhacaz)
94
+ - [PR #1806](https://github.com/faker-ruby/faker/pull/1806) Add Terry Bogard to Super Smash Bros. options [@clinch](https://github.com/clinch)
95
+
96
+ ## Update local dependencies
97
+
98
+ - Update rubocop requirement from = 0.75.0 to = 0.75.1 (#1811)
99
+ - Update rubocop requirement from = 0.75.1 to = 0.76.0 (#1822)
100
+ - Update minitest requirement from = 5.12.2 to = 5.13.0 (#1823)
101
+
102
+ ------------------------------------------------------------------------------
103
+
104
+ ## [v2.6.0](https://github.com/faker-ruby/faker/tree/v2.6.0) (2019-10-10)
105
+
106
+ This version:
107
+ - adds `Faker::Date.in_date_period`
108
+ - adds `Faker::WorldCup` YARD docs
109
+ - updates local dependencies
110
+
111
+ ## Documentation
112
+
113
+ - [PR #1789](https://github.com/faker-ruby/faker/pull/1789) Faker::WorldCup YARD docs [@ashishra0](https://github.com/ashishra0)
114
+
115
+ ## Feature Request
116
+
117
+ - [PR #1755](https://github.com/faker-ruby/faker/pull/1755) Add Faker::Date.in_date_period [@AmrAdelKhalil](https://github.com/AmrAdelKhalil)
118
+
119
+ ## Update local dependencies
120
+
121
+ The following development dependencies were updated:
122
+ - Update rake requirement from = 12.3.3 to = 13.0.0 (#1776)
123
+ - Update minitest requirement from = 5.12.0 to = 5.12.2 (#1775)
124
+ - Update test-unit requirement from = 3.3.3 to = 3.3.4 (#1774)
125
+
126
+ ------------------------------------------------------------------------------
127
+
128
+ ## [v2.5.0](https://github.com/faker-ruby/faker/tree/v2.5.0) (2019-30-09)
129
+
130
+ This version introduces:
131
+ - locales for Thai language - the mother language in Thailand
132
+ - YARD documentation for faker interfaces
133
+ - locales updates or fixes
134
+
135
+ ## Feature Request
136
+
137
+ - [PR #1773](https://github.com/faker-ruby/faker/pull/1773) Two new locales added: th and en-th [@kodram](https://github.com/kodram)
138
+
139
+ ## Documentation
140
+
141
+ - [PR #1771](https://github.com/faker-ruby/faker/pull/1771) Fix some rubocop comments that were showing up in YARD docs. [@connorshea](https://github.com/connorshea)
142
+ - [PR #1767](https://github.com/faker-ruby/faker/pull/1767) Fix two incorrect flexible method calls. [@connorshea](https://github.com/connorshea)
143
+ - [PR #1761](https://github.com/faker-ruby/faker/pull/1761) Add YARD docs for the Basketball and Football fakers. [@connorshea](https://github.com/connorshea)
144
+ - [PR #1768](https://github.com/faker-ruby/faker/pull/1768) Add YARD docs for Faker::Restaurant. [@connorshea](https://github.com/connorshea)
145
+ - [PR #1759](https://github.com/faker-ruby/faker/pull/1759) Add YARD docs for all remaining TV Shows [@connorshea](https://github.com/connorshea)
146
+ - [PR #1758](https://github.com/faker-ruby/faker/pull/1758) Add YARD docs for Doctor Who and fix a method name. [@connorshea](https://github.com/connorshea)
147
+ - [PR #1756](https://github.com/faker-ruby/faker/pull/1756) Add more miscellaneous YARD docs [@connorshea](https://github.com/connorshea)
148
+ - [PR #1753](https://github.com/faker-ruby/faker/pull/1753) Add YARD docs for Date, Time, and Number [@connorshea](https://github.com/connorshea)
149
+
150
+ ## Update locales
151
+
152
+ - [PR #1764](https://github.com/faker-ruby/faker/pull/1764) Remove "mint green" from color [@ro-savage](https://github.com/ro-savage)
153
+ - [PR #1751](https://github.com/faker-ruby/faker/pull/1751) fix from Color.name to Color.color_name [@4geru](https://github.com/4geru)
154
+
155
+ ## Update local dependencies
156
+
157
+ The following development dependencies were updated:
158
+ - Update minitest requirement from = 5.11.3 to = 5.12.0 (#1763)
159
+
160
+ ------------------------------------------------------------------------------
161
+
3
162
  ## [v2.4.0](https://github.com/faker-ruby/faker/tree/v2.4.0) (2019-19-09)
4
163
 
5
164
  ## Documentation
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