faker 2.12.0 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +71 -0
  3. data/README.md +3 -0
  4. data/lib/faker.rb +2 -1
  5. data/lib/faker/default/address.rb +30 -0
  6. data/lib/faker/default/bank.rb +1 -1
  7. data/lib/faker/default/blood.rb +3 -3
  8. data/lib/faker/default/chile_rut.rb +44 -1
  9. data/lib/faker/default/company.rb +1 -3
  10. data/lib/faker/default/computer.rb +4 -4
  11. data/lib/faker/default/date.rb +16 -12
  12. data/lib/faker/default/gender.rb +1 -1
  13. data/lib/faker/default/id_number.rb +86 -0
  14. data/lib/faker/default/internet.rb +35 -7
  15. data/lib/faker/default/internet_http.rb +48 -0
  16. data/lib/faker/default/lorem_flickr.rb +65 -0
  17. data/lib/faker/default/lorem_pixel.rb +22 -0
  18. data/lib/faker/default/markdown.rb +89 -0
  19. data/lib/faker/default/name.rb +15 -0
  20. data/lib/faker/default/nhs.rb +19 -0
  21. data/lib/faker/default/number.rb +5 -7
  22. data/lib/faker/default/omniauth.rb +58 -5
  23. data/lib/faker/default/world_cup.rb +4 -4
  24. data/lib/faker/games/control.rb +8 -8
  25. data/lib/faker/games/dnd.rb +4 -4
  26. data/lib/faker/games/heroes_of_the_storm.rb +16 -5
  27. data/lib/faker/games/minecraft.rb +48 -0
  28. data/lib/faker/games/warhammer_fantasy.rb +5 -5
  29. data/lib/faker/movies/departed.rb +3 -3
  30. data/lib/faker/movies/movie.rb +13 -0
  31. data/lib/faker/music/pearl_jam.rb +3 -3
  32. data/lib/faker/music/phish.rb +2 -2
  33. data/lib/faker/music/prince.rb +64 -0
  34. data/lib/faker/music/rush.rb +37 -0
  35. data/lib/faker/music/show.rb +3 -3
  36. data/lib/faker/tv_shows/aqua_teen_hunger_force.rb +13 -0
  37. data/lib/faker/tv_shows/big_bang_theory.rb +37 -0
  38. data/lib/faker/tv_shows/dr_who.rb +1 -1
  39. data/lib/faker/tv_shows/futurama.rb +65 -0
  40. data/lib/faker/tv_shows/simpsons.rb +14 -0
  41. data/lib/faker/tv_shows/suits.rb +2 -2
  42. data/lib/faker/version.rb +1 -1
  43. data/lib/helpers/base58.rb +1 -1
  44. data/lib/helpers/char.rb +20 -26
  45. data/lib/locales/en/aqua_teen_hunger_force.yml +33 -1
  46. data/lib/locales/en/bank.yml +1 -1
  47. data/lib/locales/en/big_bang_theory.yml +38 -0
  48. data/lib/locales/en/futurama.yml +344 -0
  49. data/lib/locales/en/heroes_of_the_storm.yml +1 -1
  50. data/lib/locales/en/minecraft.yml +390 -0
  51. data/lib/locales/en/movie.yml +192 -1
  52. data/lib/locales/en/name.yml +3 -2
  53. data/lib/locales/en/prince.yml +227 -0
  54. data/lib/locales/en/rush.yml +32 -0
  55. data/lib/locales/en/simpsons.yml +668 -0
  56. data/lib/locales/en/star_wars.yml +1 -0
  57. metadata +21 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e07357f193be20c639621339c209b48ee1a99bb64528e2f3d2c4b61afed8b8b
4
- data.tar.gz: 39d54382315e2fd6abe4b8275b5bee60c832ef2b045ae16bba46e82233ab7697
3
+ metadata.gz: 419bb77c9f0a8bc8f7c1b7ea5d93ba7d407bf7c437598eb91413f062f67494ce
4
+ data.tar.gz: 6566078b00ceb18763960551f913a341393858c2458cec01fcb4b0f0163d2e4b
5
5
  SHA512:
6
- metadata.gz: 16d0fdaf172d74ffa7c1cd1ae88e55801313f779e1d2be385941ec7dfa9b2922dacd104406eaa5f060545bbd3b33c840fa9f72f90637e3dc045d70706ab57a61
7
- data.tar.gz: 5589900168ed8cb068fc6682751f1bc8edf6cbe6d8afc191aaf8668af05ee08edfeebb02e446748a18104623fe09f4205206dbc1b2600c732f3a7abc1d46d556
6
+ metadata.gz: 694b65a586f50b801f47a456954dd6f2fba39a82b9a643153bb140f9bd3467b7e3080c49a63f0a8562db10c6442bc7c5c578928ddde129054cb070d2a81658e3
7
+ data.tar.gz: eb6812f2f21c5a1930ad987ad8023efeb9168a6f6ec909fcd86d3deeb5e8720d82f457be58fc08f907d502571656ee6768bc21cbb6395a5366c2410d65e358cf
@@ -1,5 +1,76 @@
1
1
  # Change Log
2
2
 
3
+ ## [v2.13.0](https://github.com/faker-ruby/faker/tree/v2.13.0) (2020-06-24)
4
+
5
+ This version:
6
+ - adds YARD docs for several interface methods
7
+ - fixes bugs
8
+ - adds improvements to the code base
9
+ - updates dependencies
10
+
11
+ ## Bug/Fixes
12
+
13
+ - [PR #2050](https://github.com/faker-ruby/faker/pull/2050) Fix random error in music tests [@martinjaimem](https://github.com/martinjaimem)
14
+ - [PR #2037](https://github.com/faker-ruby/faker/pull/2037) Bug Fix: BIC Collission (Issue 1907) [@Newman101](https://github.com/Newman101)
15
+ - [PR #2026](https://github.com/faker-ruby/faker/pull/2026) Sanitize email when name has special characters [@Zeragamba](https://github.com/Zeragamba)
16
+ - [PR #1785](https://github.com/faker-ruby/faker/pull/1785) Adds a fix for when :en is not one of the available locales [@jaimerodas](https://github.com/jaimerodas)
17
+
18
+ ## Chores
19
+
20
+ - [PR #2041](https://github.com/faker-ruby/faker/pull/2041) Reduce Lines in char.rb [@Newman101](https://github.com/Newman101)
21
+ - [PR #2039](https://github.com/faker-ruby/faker/pull/2039) restore Kylo Ren quotes [@Zeragamba](https://github.com/Zeragamba)
22
+ - [PR #2038](https://github.com/faker-ruby/faker/pull/2038) Drop EOL Rubies from CI tests [@Zeragamba](https://github.com/Zeragamba)
23
+ - [PR #2033](https://github.com/faker-ruby/faker/pull/2033) Use `Faker::Base::ULetters` constant instead [@vbrazo](https://github.com/vbrazo)
24
+ - [PR #2028](https://github.com/faker-ruby/faker/pull/2028) Reorganize some tests [@connorshea](https://github.com/connorshea)
25
+ - [PR #1853](https://github.com/faker-ruby/faker/pull/1853) Exclude string.rb from consideration by YARD. [@connorshea](https://github.com/connorshea)
26
+
27
+ ## Deprecation
28
+
29
+ - [PR #2031](https://github.com/faker-ruby/faker/pull/2031) Deprecate `HeroesOfTheStorm.class` [@koic](https://github.com/koic)
30
+
31
+ ## Documentation
32
+
33
+ - [PR #2065](https://github.com/faker-ruby/faker/pull/2065) Add missing documentation to `Faker::Computer` [@danielTiringer](https://github.com/danielTiringer)
34
+ - [PR #2064](https://github.com/faker-ruby/faker/pull/2064) Add minecraft generators [@Ri1a](https://github.com/Ri1a)
35
+ - [PR #2061](https://github.com/faker-ruby/faker/pull/2061) Update docs for `Faker::Date` with separate examples [@danielTiringer](https://github.com/danielTiringer)
36
+ - [PR #2057](https://github.com/faker-ruby/faker/pull/2057) Add missing quotes to `Faker::Internet` [@Zeragamba](https://github.com/Zeragamba)
37
+ - [PR #2055](https://github.com/faker-ruby/faker/pull/2055) Add YARD docs to `Faker::NHS` [@danielTiringer](https://github.com/danielTiringer)
38
+ - [PR #2054](https://github.com/faker-ruby/faker/pull/2054) Add YARD docs to `Faker::Chile_Rut` [@danielTiringer](https://github.com/danielTiringer)
39
+ - [PR #2053](https://github.com/faker-ruby/faker/pull/2053) Add YARD docs to `Faker::Lorem_Flickr` [@danielTiringer](https://github.com/danielTiringer)
40
+ - [PR #2052](https://github.com/faker-ruby/faker/pull/2052) Add YARD docs to `Faker::Lorem_Pixel` [@danielTiringer](https://github.com/danielTiringer)
41
+ - [PR #2051](https://github.com/faker-ruby/faker/pull/2051) Add YARD docs to `Faker::Omniauth` [@danielTiringer](https://github.com/danielTiringer)
42
+ - [PR #2036](https://github.com/faker-ruby/faker/pull/2036) Add YARD docs to `Faker::Markdown` [@danielTiringer](https://github.com/danielTiringer)
43
+ - [PR #2035](https://github.com/faker-ruby/faker/pull/2035) Add YARD docs to `Faker::ID_Number` [@danielTiringer](https://github.com/danielTiringer)
44
+ - [PR #2030](https://github.com/faker-ruby/faker/pull/2030) Add general documentation for `Faker::Blood` [@jbergenson](https://github.com/jbergenson)
45
+ - [PR #2029](https://github.com/faker-ruby/faker/pull/2029) Allow passing a string to specific `Faker::Date` methods. [@connorshea](https://github.com/connorshea)
46
+
47
+ ## Feature Request
48
+
49
+ - [PR #2040](https://github.com/faker-ruby/faker/pull/2040) Split lint and test Github actions [@Zeragamba](https://github.com/Zeragamba)
50
+ - [PR #2032](https://github.com/faker-ruby/faker/pull/2032) Add `gender-neutral` first names to `Faker::Name` [@cmunozgar](https://github.com/cmunozgar)
51
+ - [PR #1965](https://github.com/faker-ruby/faker/pull/1965) Add new `full_address_as_hash` method which return the required address [@AmrAdelKhalil](https://github.com/AmrAdelKhalil)
52
+ - [PR #1952](https://github.com/faker-ruby/faker/pull/1952) Add `Faker::Movie.title` [@gizipp](https://github.com/gizipp)
53
+ - [PR #1932](https://github.com/faker-ruby/faker/pull/1932) Added AHTF Wisdom [@brotherjack](https://github.com/brotherjack)
54
+ - [PR #1912](https://github.com/faker-ruby/faker/pull/1912) Add `Faker::Music::Rush` [@willianveiga](https://github.com/willianveiga)
55
+ - [PR #1865](https://github.com/faker-ruby/faker/pull/1865) Add Big Bang Theory [@pathaknv](https://github.com/pathaknv)
56
+ - [PR #1858](https://github.com/faker-ruby/faker/pull/1858) Add `Faker::TvShows::Futurama` [@JoeNyland](https://github.com/JoeNyland)
57
+ - [PR #1821](https://github.com/faker-ruby/faker/pull/1821) Add HTTP status codes generator [@willianveiga](https://github.com/willianveiga)
58
+ - [PR #1804](https://github.com/faker-ruby/faker/pull/1804) Add `Faker::TvShows::Simpsons.episode_title` [@martinbjeldbak](https://github.com/martinbjeldbak)
59
+ - [PR #1670](https://github.com/faker-ruby/faker/pull/1670) Adds `Faker::Music::Prince` [@jessecalton](https://github.com/jessecalton)
60
+
61
+ ## Update locales
62
+
63
+ - [PR #1792](https://github.com/faker-ruby/faker/pull/1792) Add more prefixes and suffixes to Name [@mathisto](https://github.com/mathisto)
64
+
65
+ ## Update local dependencies
66
+
67
+ - Update rubocop requirement from = 0.81.0 to = 0.85.1
68
+ - Update rubocop requirement from = 0.85.1 to = 0.86.0 (#2066)
69
+ - Update test-unit requirement from = 3.3.5 to = 3.3.6 (#2046)
70
+ - Bump i18n from 1.8.2 to 1.8.3 (#2034)
71
+
72
+ ------------------------------------------------------------------------------
73
+
3
74
  ## [v2.12.0](https://github.com/faker-ruby/faker/tree/v2.12.0) (2020-05-31)
4
75
 
5
76
  This version:
data/README.md CHANGED
@@ -275,7 +275,9 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
275
275
  - [Faker::Music::GratefulDead](doc/music/grateful_dead.md)
276
276
  - [Faker::Music::Opera](doc/music/opera.md)
277
277
  - [Faker::Music::Phish](doc/music/phish.md)
278
+ - [Faker::Music::Prince](doc/music/prince.md)
278
279
  - [Faker::Music::RockBand](doc/music/rock_band.md)
280
+ - [Faker::Music::Rush](doc/music/rush.md)
279
281
  - [Faker::Music::UmphreysMcgee](doc/music/umphreys_mcgee.md)
280
282
 
281
283
  ### Quotes
@@ -291,6 +293,7 @@ gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'mast
291
293
 
292
294
  ### Tv Shows
293
295
  - [Faker::TvShows::AquaTeenHungerForce](doc/tv_shows/aqua_teen_hunger_force.md)
296
+ - [Faker::TvShows::BigBangTheory](doc/tv_shows/big_bang_theory.md)
294
297
  - [Faker::TvShows::BojackHorseman](doc/tv_shows/bojack_horseman.md)
295
298
  - [Faker::TvShows::BreakingBad](doc/tv_shows/breaking_bad.md)
296
299
  - [Faker::TvShows::Buffy](doc/tv_shows/buffy.md)
@@ -21,7 +21,8 @@ module Faker
21
21
  attr_writer :random
22
22
 
23
23
  def locale
24
- @locale || I18n.locale
24
+ # Because I18n.locale defaults to :en, if we don't have :en in our available_locales, errors will happen
25
+ @locale || (I18n.available_locales.include?(I18n.locale) ? I18n.locale : I18n.available_locales.first)
25
26
  end
26
27
 
27
28
  def own_locale
@@ -333,6 +333,36 @@ module Faker
333
333
  def full_address
334
334
  parse('address.full_address')
335
335
  end
336
+
337
+ ##
338
+ # Produces Address hash of required fields
339
+ #
340
+ # @return [Hash]
341
+ #
342
+ # @example
343
+ # Faker::Address.full_address_as_hash(:longitude,
344
+ # :latitude,
345
+ # :country_name_to_code,
346
+ # country_name_to_code: {name: 'united_states'})
347
+ # #=> {:longitude=>-101.74428917174603, :latitude=>-37.40056749089944, :country_name_to_code=>"US"}
348
+ #
349
+ # Faker::Address.full_address_as_hash(:full_address)
350
+ # #=> {:full_address=>"87635 Rice Street, Lake Brentonton, OR 61896-5968"}
351
+ #
352
+ # Faker::Address.full_address_as_hash(:city, :time_zone)
353
+ # #=> {:city=>"East Faustina", :time_zone=>"America/Mexico_City"}
354
+ #
355
+ # Faker::Address.full_address_as_hash(:street_address, street_address: {include_secondary: true})
356
+ # #=> {:street_address=>"29423 Kenneth Causeway Suite 563"}
357
+ #
358
+ # @faker.version 2.13.0
359
+ def full_address_as_hash(*attrs, **attrs_params)
360
+ attrs.map!(&:to_sym)
361
+ attrs_params.transform_keys!(&:to_sym)
362
+ attrs.map do |attr|
363
+ { "#{attr}": attrs_params[attr] ? send(attr, **attrs_params[attr]) : send(attr) }
364
+ end.reduce({}, :merge)
365
+ end
336
366
  end
337
367
  end
338
368
  end
@@ -121,7 +121,7 @@ module Faker
121
121
  # Faker::Bank.bsb_number
122
122
  # #=> "036616"
123
123
  #
124
- # @faker.version next
124
+ # @faker.version 2.13.0
125
125
  def bsb_number
126
126
  compile_bsb_number
127
127
  end
@@ -13,7 +13,7 @@ module Faker
13
13
  # @example
14
14
  # Faker::Blood.type #=> "AB"
15
15
  #
16
- # @faker.version next
16
+ # @faker.version 2.13.0
17
17
  def type
18
18
  fetch('blood.type')
19
19
  end
@@ -26,7 +26,7 @@ module Faker
26
26
  # @example
27
27
  # Faker::Blood.rh_factor #=> "-"
28
28
  #
29
- # @faker.version next
29
+ # @faker.version 2.13.0
30
30
  def rh_factor
31
31
  fetch('blood.rh_factor')
32
32
  end
@@ -39,7 +39,7 @@ module Faker
39
39
  # @example
40
40
  # Faker::Blood.group #=> "AB-"
41
41
  #
42
- # @faker.version next
42
+ # @faker.version 2.13.0
43
43
  def group
44
44
  parse('blood.group')
45
45
  end
@@ -5,7 +5,19 @@ module Faker
5
5
  class << self
6
6
  @last_rut = nil
7
7
 
8
- # Fixed param added for testing a specific RUT and check digit combination.
8
+ ##
9
+ # Produces a random Chilean RUT (Rol Unico Tributario, ID with 8 digits).
10
+ #
11
+ # @param min_rut [Integer] Specifies the minimum value of the rut.
12
+ # @param fixed [Boolean] Determines if the rut is fixed (returns the min_rut value).
13
+ # @return [Number]
14
+ #
15
+ # @example
16
+ # Faker::ChileRut.rut #=> 11235813
17
+ # Faker::ChileRut.rut(min_rut: 20890156) #=> 31853211
18
+ # Faker::ChileRut.rut(min_rut: 20890156, fixed: true) #=> 20890156
19
+ #
20
+ # @faker.version 1.9.2
9
21
  def rut(legacy_min_rut = NOT_GIVEN, legacy_fixed = NOT_GIVEN, min_rut: 1, fixed: false)
10
22
  warn_for_deprecated_arguments do |keywords|
11
23
  keywords << :min_rut if legacy_min_rut != NOT_GIVEN
@@ -15,6 +27,15 @@ module Faker
15
27
  @last_rut = fixed ? min_rut : rand_in_range(min_rut, 99_999_999)
16
28
  end
17
29
 
30
+ ##
31
+ # Produces a random Chilean digito verificador (check-digit).
32
+ #
33
+ # @return [String]
34
+ #
35
+ # @example
36
+ # Faker::ChileRut.dv #=> "k"
37
+ #
38
+ # @faker.version 1.9.2
18
39
  def dv
19
40
  split_reversed_rut = @last_rut.to_s.reverse.split('')
20
41
  seq = [2, 3, 4, 5, 6, 7]
@@ -34,11 +55,33 @@ module Faker
34
55
  end
35
56
  end
36
57
 
58
+ ##
59
+ # Produces a random Chilean digito verificador (check-digit).
37
60
  # Alias for english speaking devs.
61
+ #
62
+ # @return [String]
63
+ #
64
+ # @example
65
+ # Faker::ChileRut.check_digit #=> "5"
66
+ #
67
+ # @faker.version 1.9.2
38
68
  def check_digit
39
69
  dv
40
70
  end
41
71
 
72
+ ##
73
+ # Produces a random Chilean RUT (Rol Unico Tributario, ID with 8 digits) with a dv (digito verificador, check-digit).
74
+ #
75
+ # @param min_rut [Integer] Specifies the minimum value of the rut.
76
+ # @param fixed [Boolean] Determines if the rut is fixed (returns the min_rut value).
77
+ # @return [String]
78
+ #
79
+ # @example
80
+ # Faker::ChileRut.full_rut #=> "30686957-4"
81
+ # Faker::ChileRut.full_rut(min_rut: 20890156) #=> "30686957-4"
82
+ # Faker::ChileRut.full_rut(min_rut: 30686957, fixed: true) #=> "30686957-4"
83
+ #
84
+ # @faker.version 1.9.2
42
85
  def full_rut(legacy_min_rut = NOT_GIVEN, legacy_fixed = NOT_GIVEN, min_rut: 0, fixed: false)
43
86
  warn_for_deprecated_arguments do |keywords|
44
87
  keywords << :min_rut if legacy_min_rut != NOT_GIVEN
@@ -165,9 +165,7 @@ module Faker
165
165
  def spanish_organisation_number
166
166
  # Valid leading character: A, B, C, D, E, F, G, H, J, N, P, Q, R, S, U, V, W
167
167
  # 7 digit numbers
168
- letters = %w[A B C D E F G H J N P Q R S U V W]
169
- base = [sample(letters), format('%07d', rand(10**7))].join
170
- base
168
+ [sample(self::ULetters), format('%07d', rand(10**7))].join
171
169
  end
172
170
 
173
171
  ##
@@ -11,7 +11,7 @@ module Faker
11
11
  # @example
12
12
  # Faker::Computer.platform #=> "Linux"
13
13
  #
14
- # @faker.version next
14
+ # @faker.version 2.12.0
15
15
  def platform
16
16
  fetch('computer.platform')
17
17
  end
@@ -24,7 +24,7 @@ module Faker
24
24
  # @example
25
25
  # Faker::Computer.type #=> "server"
26
26
  #
27
- # @faker.version next
27
+ # @faker.version 2.12.0
28
28
  def type
29
29
  fetch('computer.type')
30
30
  end
@@ -38,7 +38,7 @@ module Faker
38
38
  # @example
39
39
  # Faker::Computer.os #=> "RHEL 6.10"
40
40
  #
41
- # @faker.version next
41
+ # @faker.version 2.12.0
42
42
  def os(platform: self.platform)
43
43
  platform = self.platform unless fetch_all('computer.platform').include?(platform)
44
44
  fetch("computer.os.#{platform.downcase}")
@@ -52,7 +52,7 @@ module Faker
52
52
  # @example
53
53
  # Faker::Computer.stack #=> "Linux, RHEL 6.10"
54
54
  #
55
- # @faker.version next
55
+ # @faker.version 2.12.0
56
56
  def stack
57
57
  platform = self.platform
58
58
  os = fetch("computer.os.#{platform.downcase}")
@@ -6,13 +6,15 @@ module Faker
6
6
  ##
7
7
  # Produce a random date between two dates.
8
8
  #
9
- # @param from [Date] The start of the usable date range.
10
- # @param to [Date] The end of the usable date range.
9
+ # @param from [Date, String] The start of the usable date range.
10
+ # @param to [Date, String] The end of the usable date range.
11
11
  # @return [Date]
12
12
  #
13
- # @example
14
- # Faker::Date.between(from: 2.days.ago, to: Date.today)
15
- # #=> #<Date: 2014-09-24>
13
+ # @example if used with or without Rails (Active Support)
14
+ # Faker::Date.between(from: '2014-09-23', to: '2014-09-25') #=> #<Date: 2014-09-24>
15
+ #
16
+ # @example if used with Rails (Active Support)
17
+ # Faker::Date.between(from: 2.days.ago, to: Date.today) #=> #<Date: 2014-09-24>
16
18
  #
17
19
  # @faker.version 1.0.0
18
20
  def between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from:, to:)
@@ -32,14 +34,16 @@ module Faker
32
34
  ##
33
35
  # Produce a random date between two dates.
34
36
  #
35
- # @param from [Date] The start of the usable date range.
36
- # @param to [Date] The end of the usable date range.
37
- # @param excepted [Date] A date to exclude.
37
+ # @param from [Date, String] The start of the usable date range.
38
+ # @param to [Date, String] The end of the usable date range.
39
+ # @param excepted [Date, String] A date to exclude.
38
40
  # @return [Date]
39
41
  #
40
- # @example
41
- # Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today)
42
- # #=> #<Date: 2014-10-03>
42
+ # @example if used with or without Rails (Active Support)
43
+ # Faker::Date.between_except(from: '2014-09-23', to: '2015-09-25', excepted: '2015-01-24') #=> #<Date: 2014-10-03>
44
+ #
45
+ # @example if used with Rails (Active Support)
46
+ # Faker::Date.between_except(from: 1.year.ago, to: 1.year.from_now, excepted: Date.today) #=> #<Date: 2014-10-03>
43
47
  #
44
48
  # @faker.version 1.6.2
45
49
  def between_except(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, legacy_excepted = NOT_GIVEN, from:, to:, excepted:)
@@ -149,7 +153,7 @@ module Faker
149
153
  # @example
150
154
  # Faker::Date.in_date_period(month: 2) #=> #<Date: 2019-02-26>
151
155
  #
152
- # @faker.version next
156
+ # @faker.version 2.13.0
153
157
  def in_date_period(month: nil, year: ::Date.today.year)
154
158
  from = ::Date.new(year, month || 1, 1)
155
159
  to = ::Date.new(year, month || 12, ::Date.civil(year, month || 12, -1).day)
@@ -37,7 +37,7 @@ module Faker
37
37
  # @example
38
38
  # Faker::Gender.short_binary_type #=> "f"
39
39
  #
40
- # @faker.version next
40
+ # @faker.version 2.13.0
41
41
  def short_binary_type
42
42
  fetch('gender.short_binary_types')
43
43
  end
@@ -19,10 +19,28 @@ module Faker
19
19
  CHILEAN_MODULO = 11
20
20
 
21
21
  class << self
22
+ ##
23
+ # Produces a random valid US Social Security number.
24
+ #
25
+ # @return [String]
26
+ #
27
+ # @example
28
+ # Faker::IDNumber.valid #=> "552-56-3593"
29
+ #
30
+ # @faker.version 1.6.0
22
31
  def valid
23
32
  _translate('valid')
24
33
  end
25
34
 
35
+ ##
36
+ # Produces a random invalid US Social Security number.
37
+ #
38
+ # @return [String]
39
+ #
40
+ # @example
41
+ # Faker::IDNumber.invalid #=> "311-72-0000"
42
+ #
43
+ # @faker.version 1.6.0
26
44
  def invalid
27
45
  _translate('invalid')
28
46
  end
@@ -33,6 +51,15 @@ module Faker
33
51
  INVALID_SSN.any? { |regex| regex =~ ssn } ? ssn_valid : ssn
34
52
  end
35
53
 
54
+ ##
55
+ # Produces a random Spanish citizen identifier (DNI).
56
+ #
57
+ # @return [String]
58
+ #
59
+ # @example
60
+ # Faker::IDNumber.spanish_citizen_number #=> "53290236-H"
61
+ #
62
+ # @faker.version 1.9.0
36
63
  def spanish_citizen_number
37
64
  num = Faker::Number.number(digits: 8)
38
65
  mod = num.to_i % 23
@@ -40,6 +67,15 @@ module Faker
40
67
  "#{num}-#{check}"
41
68
  end
42
69
 
70
+ ##
71
+ # Produces a random Spanish foreign born citizen identifier (NIE).
72
+ #
73
+ # @return [String]
74
+ #
75
+ # @example
76
+ # Faker::IDNumber.spanish_foreign_citizen_number #=> "Z-1600870-Y"
77
+ #
78
+ # @faker.version 1.9.0
43
79
  def spanish_foreign_citizen_number
44
80
  code = 'XYZ'
45
81
  digits = Faker::Number.number(digits: 7)
@@ -50,6 +86,16 @@ module Faker
50
86
  "#{prefix}-#{digits}-#{check}"
51
87
  end
52
88
 
89
+ ##
90
+ # Produces a random valid South African ID Number.
91
+ #
92
+ # @return [String]
93
+ #
94
+ # @example
95
+ # Faker::IDNumber.south_african_id_number #=> "8105128870184"
96
+ # Faker::IDNumber.valid_south_african_id_number #=> "8105128870184"
97
+ #
98
+ # @faker.version 1.9.2
53
99
  def valid_south_african_id_number
54
100
  id_number = [
55
101
  Faker::Date.birthday.strftime('%y%m%d'),
@@ -63,6 +109,15 @@ module Faker
63
109
 
64
110
  alias south_african_id_number valid_south_african_id_number
65
111
 
112
+ ##
113
+ # Produces a random invalid South African ID Number.
114
+ #
115
+ # @return [String]
116
+ #
117
+ # @example
118
+ # Faker::IDNumber.invalid_south_african_id_number #=> "1642972065088"
119
+ #
120
+ # @faker.version 1.9.2
66
121
  def invalid_south_african_id_number
67
122
  invalid_date_of_birth = [
68
123
  Faker::Number.number(digits: 2),
@@ -80,6 +135,17 @@ module Faker
80
135
  [id_number, south_african_id_checksum_digit(id_number)].join
81
136
  end
82
137
 
138
+ ##
139
+ # Produces a random Brazilian Citizen Number (CPF).
140
+ #
141
+ # @param formatted [Boolean] Specifies if the number is formatted with dividers.
142
+ # @return [String]
143
+ #
144
+ # @example
145
+ # Faker::IDNumber.brazilian_citizen_number #=> "53540542221"
146
+ # Faker::IDNumber.brazilian_citizen_number(formatted: true) #=> "535.405.422-21"
147
+ #
148
+ # @faker.version 1.9.2
83
149
  def brazilian_citizen_number(legacy_formatted = NOT_GIVEN, formatted: false)
84
150
  warn_for_deprecated_arguments do |keywords|
85
151
  keywords << :formatted if legacy_formatted != NOT_GIVEN
@@ -94,6 +160,17 @@ module Faker
94
160
 
95
161
  alias brazilian_cpf brazilian_citizen_number
96
162
 
163
+ ##
164
+ # Produces a random Brazilian ID Number (RG).
165
+ #
166
+ # @param formatted [Boolean] Specifies if the number is formatted with dividers.
167
+ # @return [String]
168
+ #
169
+ # @example
170
+ # Faker::IDNumber.brazilian_id #=> "493054029"
171
+ # Faker::IDNumber.brazilian_id(formatted: true) #=> "49.305.402-9"
172
+ #
173
+ # @faker.version 2.1.2
97
174
  def brazilian_id(legacy_formatted = NOT_GIVEN, formatted: false)
98
175
  warn_for_deprecated_arguments do |keywords|
99
176
  keywords << :formatted if legacy_formatted != NOT_GIVEN
@@ -107,6 +184,15 @@ module Faker
107
184
 
108
185
  alias brazilian_rg brazilian_id
109
186
 
187
+ ##
188
+ # Produces a random Chilean ID (Rut with 8 digits).
189
+ #
190
+ # @return [String]
191
+ #
192
+ # @example
193
+ # Faker::IDNumber.chilean_id #=> "15620613-K"
194
+ #
195
+ # @faker.version 2.1.2
110
196
  def chilean_id
111
197
  digits = Faker::Number.number(digits: 8)
112
198
  verification_code = chilean_verification_code(digits)