ffaker 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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +7 -0
  3. data/REFERENCE.md +32 -2
  4. data/ffaker.gemspec +2 -2
  5. data/lib/ffaker.rb +4 -1
  6. data/lib/ffaker/address_us.rb +22 -2
  7. data/lib/ffaker/bank.rb +15 -3
  8. data/lib/ffaker/color_pl.rb +14 -0
  9. data/lib/ffaker/data/address_ja/city +0 -23
  10. data/lib/ffaker/data/address_us/state_abbr +0 -1
  11. data/lib/ffaker/data/bank/card_types +12 -0
  12. data/lib/ffaker/data/book/nouns +2 -2
  13. data/lib/ffaker/data/color_pl/names_list +122 -0
  14. data/lib/ffaker/data/movie/nouns +2 -2
  15. data/lib/ffaker/data/name/first_names_female +0 -230
  16. data/lib/ffaker/data/name/first_names_male +0 -37
  17. data/lib/ffaker/data/sport_pl/summer +53 -0
  18. data/lib/ffaker/data/sport_pl/winter +14 -0
  19. data/lib/ffaker/data/vehicle/color_prefixes +25 -0
  20. data/lib/ffaker/identification_kr.rb +1 -1
  21. data/lib/ffaker/identification_pl.rb +77 -0
  22. data/lib/ffaker/internet.rb +3 -5
  23. data/lib/ffaker/sport_pl.rb +25 -0
  24. data/lib/ffaker/utils/random_utils.rb +2 -0
  25. data/lib/ffaker/vehicle.rb +1 -6
  26. data/test/helper.rb +35 -0
  27. data/test/test_address_us.rb +9 -0
  28. data/test/test_bank.rb +41 -5
  29. data/test/test_color_pl.rb +13 -0
  30. data/test/test_identification_co.rb +1 -1
  31. data/test/test_identification_pl.rb +28 -0
  32. data/test/test_internet.rb +9 -9
  33. data/test/test_job_cn.rb +1 -1
  34. data/test/test_job_ja.rb +1 -1
  35. data/test/test_job_kr.rb +1 -1
  36. data/test/test_job_vn.rb +1 -1
  37. data/test/test_lorem_cn.rb +6 -6
  38. data/test/test_lorem_ja.rb +3 -3
  39. data/test/test_name_da.rb +3 -3
  40. data/test/test_phone_number_se.rb +2 -2
  41. data/test/test_sport_pl.rb +30 -0
  42. data/test/test_ssn_se.rb +4 -6
  43. data/test/test_time.rb +13 -6
  44. data/test/test_tweet.rb +6 -6
  45. metadata +18 -9
  46. data/lib/ffaker/data/address_jp/city +0 -127
  47. data/lib/ffaker/data/address_jp/designated_city +0 -20
  48. data/lib/ffaker/data/address_jp/street +0 -37
  49. data/lib/ffaker/data/address_jp/tokyo_ward +0 -23
  50. data/lib/ffaker/data/address_jp/village +0 -183
  51. data/lib/ffaker/data/address_jp/ward +0 -188
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a209fad0923ed8b1cdd50ef995f797d57f3d3fb090abc8e7215197f9af6571d
4
- data.tar.gz: 8123997c8b80e7b2ff091a8f22de5d374a24e055038e9f8d14c1ba23e0c2eef4
3
+ metadata.gz: de5e451ca4c630460be33cc18f72638a608c932c797017afa25a405a328dfcdd
4
+ data.tar.gz: b7641f275b6dcb1e0f4edc1fa9a476c2f243a6802a2d95c2abf5339d644da276
5
5
  SHA512:
6
- metadata.gz: 2a03ef7ea34a75d24a8cbca82574d2a8d0a635e9e88aa438761dbb73be21102287c332bc8b7b5b7832efabe29de12cb44730fb0e6060236987f5fc3bb3b66b23
7
- data.tar.gz: 2ac5ff654870dbbe54f93420a7dd6e28a8a834de4ef2aed72fac70dc56083ef2bca57e8c253d1f188442fad47685ed52c96ef9ba6fe4209a9df4aae87eca292e
6
+ metadata.gz: 5b1455abd7797ae7221dd47f8c3cc99cfedd1bf8739c67ed5ad440108b3b8c109bcae0171234e6c5c5fe02c23066986382da402a73db0728a43b59f253362465
7
+ data.tar.gz: 07b818140be988bcf18227a1b21903077a0d6b772748e6a5c3072d4fe209e030a66ffebcf537fa4d78c87be06aee7344ee375d3d7cdac1009f0c950ee9f61e9c
@@ -2,6 +2,13 @@
2
2
 
3
3
  - Add your change HERE
4
4
 
5
+ ## 2.13.0
6
+ - Add `Bank.card_number`, `.card_expiry_date` and `.card_type` [@AlexWayfer]
7
+ - Add `Bank.iban` [@Volosh1n]
8
+ - Add optional argument to `AddressUS.state_abbr` to determine state's abbreviation [@Volosh1n]
9
+ - Add `Name.pronouns` [@danderozier]
10
+ - Add `FFaker::ColorPL`, `FFaker::IdentificationPL`, `FFaker::SportPL` [@walerian777]
11
+
5
12
  ## 2.12.0
6
13
  - Add Russian Phone Numbers [@steverovsky]
7
14
  - Remove invalid example from NameRU.first_name_male [@steverovsky]
@@ -39,6 +39,7 @@
39
39
  * [FFaker::CheesyLingo](#ffakercheesylingo)
40
40
  * [FFaker::Code](#ffakercode)
41
41
  * [FFaker::Color](#ffakercolor)
42
+ * [FFaker::ColorPL](#ffakercolorpl)
42
43
  * [FFaker::ColorUA](#ffakercolorua)
43
44
  * [FFaker::Company](#ffakercompany)
44
45
  * [FFaker::CompanyCN](#ffakercompanycn)
@@ -70,6 +71,7 @@
70
71
  * [FFaker::IdentificationESCO](#ffakeridentificationesco)
71
72
  * [FFaker::IdentificationKr](#ffakeridentificationkr)
72
73
  * [FFaker::IdentificationMX](#ffakeridentificationmx)
74
+ * [FFaker::IdentificationPL](#ffakeridentificationpl)
73
75
  * [FFaker::Image](#ffakerimage)
74
76
  * [FFaker::Internet](#ffakerinternet)
75
77
  * [FFaker::InternetSE](#ffakerinternetse)
@@ -149,6 +151,7 @@
149
151
  * [FFaker::SSNSE](#ffakerssnse)
150
152
  * [FFaker::Skill](#ffakerskill)
151
153
  * [FFaker::Sport](#ffakersport)
154
+ * [FFaker::SportPL](#ffakersportpl)
152
155
  * [FFaker::SportUS](#ffakersportus)
153
156
  * [FFaker::String](#ffakerstring)
154
157
  * [FFaker::Time](#ffakertime)
@@ -805,6 +808,7 @@
805
808
  | `secondary_address` | Suite 597, Apt. 857, Apt. 834 |
806
809
  | `state` | North Dakota, Florida, Illinois |
807
810
  | `state_abbr` | NJ, MN, WA |
811
+ | `state_abbr('California')` | CA |
808
812
  | `state_and_territories_abbr` | MD, VA, NM |
809
813
  | `street_address` | 221 Lester Lodge, 61254 Boyle Extension, 025 Nada Mill |
810
814
  | `street_name` | Mike Plain, Wisozk Ports, Zaida Causeway |
@@ -869,6 +873,10 @@
869
873
  | `iban` | LT068461723457561501, FO2226825430828346, UA353917102886113677140435165 |
870
874
  | `iban(country_code: 'at')` | AT817312345658600785, AT578030055615784246, AT788430896006678628 |
871
875
  | `iban(country_code: 'AT')` | AT935154385139465376, AT199676443295940702, AT575421622953218726 |
876
+ | `card_number` | "8388 2554 2337 8097", "3112 2867 3411 2867", "1600 8342 6533 2869" |
877
+ | `card_expiry_date` | "04/24", "09/23", "08/23" |
878
+ | `card_expiry_date(format: '%m/%Y')` | "01/2021", "09/2021", "08/2022" |
879
+ | `card_type` | "maestro", "discover", "american_express" |
872
880
 
873
881
  ## FFaker::Book
874
882
 
@@ -879,7 +887,7 @@
879
887
  | `description` | Ut ea aut necessitatibus corrupti ut repellendus odio. Voluptate rerum dolorem vero laborum et laudantium. Molestias adipisci veritatis eum quaerat in dignissimos possimus ab. Quidem assumenda repudiandae velit exercitationem qui dolorum labore quod., Explicabo quasi voluptas aut aut ad nam. Deserunt in tenetur est quidem doloribus aliquam quod. Voluptatem cum aperiam cumque nobis iusto dolores in. Sed necessitatibus molestiae et aliquam., Nisi et quam officia ea. Reprehenderit optio excepturi et commodi. Ut reiciendis amet deserunt ea voluptate. Temporibus consequatur quod sunt voluptatem. |
880
888
  | `genre` | Dieselpunk, Epic / High fantasy, Blessing |
881
889
  | `isbn` | 18445054293, 6871724811, 18215783130 |
882
- | `orly_cover` | https://orly-appstore.herokuapp.com/generate?title=A+Fistful+of+Green+Cousins&top_text=Fantasy&author=Latrina+Sporer&image_code=34&theme=16, https://orly-appstore.herokuapp.com/generate?title=Action+Gypsy&top_text=Whig+history&author=Venessa+Rogahn&image_code=21&theme=5, https://orly-appstore.herokuapp.com/generate?title=Forbidden+Women&top_text=Nonfiction+novel&author=Lupe+Kutch&image_code=11&theme=15 |
890
+ | `orly_cover` | https://orly-appstore.herokuapp.com/generate?title=A+Fistful+of+Green+Cousins&top_text=Fantasy&author=Latrina+Sporer&image_code=34&theme=16, https://orly-appstore.herokuapp.com/generate?title=Action+Imp&top_text=Whig+history&author=Venessa+Rogahn&image_code=21&theme=5, https://orly-appstore.herokuapp.com/generate?title=Forbidden+Women&top_text=Nonfiction+novel&author=Lupe+Kutch&image_code=11&theme=15 |
883
891
  | `title` | Rise of the American Friday, Codename: Red Mutant, War of the Dangerous City |
884
892
 
885
893
  ## FFaker::Boolean
@@ -921,6 +929,12 @@
921
929
  | `rgba_array` | 40, 94, 30, 0.86, 120, 84, 19, 0.96, 17, 68, 203, 0.73 |
922
930
  | `rgba_list` | 90,59,232,0.0, 14,141,128,0.26, 0,136,137,0.37 |
923
931
 
932
+ ## FFaker::ColorPL
933
+
934
+ | Method | Example |
935
+ | ------ | ------- |
936
+ | `name` | kardynalski, zielony, rubinowy |
937
+
924
938
  ## FFaker::ColorUA
925
939
 
926
940
  | Method | Example |
@@ -1198,6 +1212,14 @@
1198
1212
  | `rfc_persona_fisica` | BEHW7007246NE, XOQW7111161QZ, DUOY990416G12 |
1199
1213
  | `rfc_persona_moral` | DUJ1004129M7, HSA930723WU3, RÑI161008SJ8 |
1200
1214
 
1215
+ ## FFaker::IdentificationPL
1216
+
1217
+ | Method | Example |
1218
+ | ------ | ------- |
1219
+ | `pesel` | 82042691480, 05221154824, 53073028936 |
1220
+ | `identity_card` | AKH956298, CPI928237, VYB372774 |
1221
+ | `drivers_license` | 47704/10/7415, 20409/05/8025, 90741/34/4389 |
1222
+
1201
1223
  ## FFaker::Image
1202
1224
 
1203
1225
  | Method | Example |
@@ -1436,7 +1458,7 @@
1436
1458
  | Method | Example |
1437
1459
  | ------ | ------- |
1438
1460
  | `rating` | PG, R, G |
1439
- | `title` | Bloody City, The Gypsy That Came to Dinner, Nuclear Dreams 2: Son of Nuclear Dreams |
1461
+ | `title` | Bloody City, The Imp That Came to Dinner, Nuclear Dreams 2: Son of Nuclear Dreams |
1440
1462
 
1441
1463
  ## FFaker::Music
1442
1464
 
@@ -2238,6 +2260,14 @@
2238
2260
  | ------ | ------- |
2239
2261
  | `name` | ❗ *[name] is deprecated. For US sports please use the SportUS module* |
2240
2262
 
2263
+ ## FFaker::SportPL
2264
+
2265
+ | Method | Example |
2266
+ | ------ | ------- |
2267
+ | `name` | Siatkówka plażowa, Saneczkarstwo, Szachy |
2268
+ | `summer` | Rzut dyskiem, Wioślarstwo, Żeglarstwo |
2269
+ | `winter` | Narciarstwo alpejskie, Dwubój zimowy, Łyżwiarstwo figurowe |
2270
+
2241
2271
  ## FFaker::SportUS
2242
2272
 
2243
2273
  | Method | Example |
@@ -6,8 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.rubygems_version = '1.3.5'
7
7
 
8
8
  s.name = 'ffaker'
9
- s.version = '2.12.0'
10
- s.date = '2019-08-24'
9
+ s.version = '2.13.0'
10
+ s.date = '2019-10-04'
11
11
  s.rubyforge_project = 'ffaker'
12
12
  s.required_ruby_version = '>= 2.4'
13
13
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FFaker
4
- VERSION = '2.12.0'
4
+ VERSION = '2.13.0'
5
5
 
6
6
  require 'ffaker/utils/array_utils'
7
7
  require 'ffaker/utils/module_utils'
@@ -70,6 +70,7 @@ module FFaker
70
70
  autoload :CheesyLingo, 'ffaker/cheesy_lingo'
71
71
  autoload :Code, 'ffaker/code'
72
72
  autoload :Color, 'ffaker/color'
73
+ autoload :ColorPL, 'ffaker/color_pl'
73
74
  autoload :ColorUA, 'ffaker/color_ua'
74
75
  autoload :Company, 'ffaker/company'
75
76
  autoload :CompanyCN, 'ffaker/company_cn'
@@ -104,6 +105,7 @@ module FFaker
104
105
  autoload :IdentificationESCO, 'ffaker/identification_es_co'
105
106
  autoload :IdentificationKr, 'ffaker/identification_kr'
106
107
  autoload :IdentificationMX, 'ffaker/identification_mx'
108
+ autoload :IdentificationPL, 'ffaker/identification_pl'
107
109
  autoload :Image, 'ffaker/image'
108
110
  autoload :Internet, 'ffaker/internet'
109
111
  autoload :InternetSE, 'ffaker/internet_se'
@@ -182,6 +184,7 @@ module FFaker
182
184
  autoload :SemVer, 'ffaker/sem_ver'
183
185
  autoload :Skill, 'ffaker/skill'
184
186
  autoload :Sport, 'ffaker/sport'
187
+ autoload :SportPL, 'ffaker/sport_pl'
185
188
  autoload :SportUS, 'ffaker/sport_us'
186
189
  autoload :SSN, 'ffaker/ssn'
187
190
  autoload :SSNMX, 'ffaker/ssn_mx'
@@ -21,8 +21,12 @@ module FFaker
21
21
  fetch_sample(STATE)
22
22
  end
23
23
 
24
- def state_abbr
25
- fetch_sample(STATE_ABBR)
24
+ def state_abbr(st_name = nil)
25
+ return find_abbr(state) unless st_name
26
+
27
+ st_name = capitalize_all_words(st_name)
28
+ check_state_existence(st_name)
29
+ find_abbr(st_name)
26
30
  end
27
31
 
28
32
  def state_and_territories_abbr
@@ -36,5 +40,21 @@ module FFaker
36
40
  def continental_state_abbr
37
41
  fetch_sample(CONTINENTAL_STATE_ABBR)
38
42
  end
43
+
44
+ private
45
+
46
+ def check_state_existence(state_name)
47
+ return if STATE.include?(state_name)
48
+
49
+ raise ArgumentError, "Unexpected state name: '#{state_name}'"
50
+ end
51
+
52
+ def find_abbr(state)
53
+ STATE_ABBR[STATE.index(state)]
54
+ end
55
+
56
+ def capitalize_all_words(string)
57
+ string.split.map(&:capitalize).join(' ')
58
+ end
39
59
  end
40
60
  end
@@ -91,6 +91,18 @@ module FFaker
91
91
  formatify_iban(COUNTRIES[country_code.upcase])
92
92
  end
93
93
 
94
+ def card_number
95
+ FFaker.numerify('#### #### #### ####')
96
+ end
97
+
98
+ def card_expiry_date(year_range: 5, year_latest: -5, format: '%m/%y')
99
+ FFaker::Time.date({ year_range: year_range, year_latest: year_latest }).strftime(format)
100
+ end
101
+
102
+ def card_type
103
+ fetch_sample(CARD_TYPES)
104
+ end
105
+
94
106
  private
95
107
 
96
108
  def formatify_iban(code)
@@ -98,9 +110,9 @@ module FFaker
98
110
  end
99
111
 
100
112
  def check_country_existence(country_code)
101
- unless COUNTRIES.keys.include?(country_code.upcase)
102
- raise ArgumentError, "Unexpected country code: '#{country_code}'"
103
- end
113
+ return if COUNTRIES.keys.include?(country_code.upcase)
114
+
115
+ raise ArgumentError, "Unexpected country code: '#{country_code}'"
104
116
  end
105
117
  end
106
118
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FFaker
4
+ # Inspiration:
5
+ # https://pl.wikipedia.org/wiki/Lista_kolor%C3%B3w
6
+ module ColorPL
7
+ extend ModuleUtils
8
+ extend self
9
+
10
+ def name
11
+ fetch_sample(NAMES_LIST)
12
+ end
13
+ end
14
+ end
@@ -11,25 +11,18 @@
11
11
  仙台市
12
12
  北九州市
13
13
  千葉市
14
- 世田谷区
15
14
  堺市
16
15
  新潟市
17
16
  浜松市
18
17
  熊本市
19
18
  相模原市
20
- 練馬区
21
19
  静岡市
22
20
  岡山市
23
- 大田区
24
- 足立区
25
- 江戸川区
26
21
  船橋市
27
22
  鹿児島市
28
23
  八王子市
29
24
  川口市
30
- 杉並区
31
25
  姫路市
32
- 板橋区
33
26
  松山市
34
27
  宇都宮市
35
28
  東大阪市
@@ -40,10 +33,8 @@
40
33
  大分市
41
34
  金沢市
42
35
  福山市
43
- 江東区
44
36
  尼崎市
45
37
  長崎市
46
- 葛飾区
47
38
  町田市
48
39
  富山市
49
40
  豊田市
@@ -62,7 +53,6 @@
62
53
  高崎市
63
54
  和歌山市
64
55
  奈良市
65
- 品川区
66
56
  高槻市
67
57
  吹田市
68
58
  旭川市
@@ -73,12 +63,9 @@
73
63
  前橋市
74
64
  郡山市
75
65
  大津市
76
- 北区
77
66
  越谷市
78
- 新宿区
79
67
  秋田市
80
68
  那覇市
81
- 中野区
82
69
  四日市市
83
70
  春日井市
84
71
  久留米市
@@ -87,14 +74,12 @@
87
74
  福島市
88
75
  明石市
89
76
  津市
90
- 豊島区
91
77
  長岡市
92
78
  下関市
93
79
  市原市
94
80
  函館市
95
81
  茨木市
96
82
  水戸市
97
- 目黒区
98
83
  八尾市
99
84
  加古川市
100
85
  福井市
@@ -104,7 +89,6 @@
104
89
  府中市
105
90
  山形市
106
91
  富士市
107
- 墨田区
108
92
  草加市
109
93
  松本市
110
94
  呉市
@@ -122,10 +106,6 @@
122
106
  つくば市
123
107
  松江市
124
108
  伊勢崎市
125
- 文京区
126
- 港区
127
- 渋谷区
128
- 荒川区
129
109
  上越市
130
110
  熊谷市
131
111
  沼津市
@@ -151,7 +131,6 @@
151
131
  日野市
152
132
  安城市
153
133
  高岡市
154
- 台東区
155
134
  鎌倉市
156
135
  宇部市
157
136
  苫小牧市
@@ -234,7 +213,6 @@
234
213
  江別市
235
214
  大牟田市
236
215
  戸田市
237
- 中央区
238
216
  新居浜市
239
217
  桐生市
240
218
  佐野市
@@ -580,7 +558,6 @@
580
558
  洲本市
581
559
  雲仙市
582
560
  大洲市
583
- 千代田区
584
561
  富谷市
585
562
  菊川市
586
563
  北茨城市
@@ -6,7 +6,6 @@ CA
6
6
  CO
7
7
  CT
8
8
  DE
9
- DC
10
9
  FL
11
10
  GA
12
11
  HI
@@ -0,0 +1,12 @@
1
+ visa
2
+ mastercard
3
+ american_express
4
+ discover
5
+ diners_club
6
+ jcb
7
+ switch
8
+ solo
9
+ dankort
10
+ maestro
11
+ forbrugsforeningen
12
+ laser
@@ -20,8 +20,8 @@ Brains
20
20
  Fly
21
21
  Mutant
22
22
  Blow
23
- Diaries
24
- Gypsy
23
+ Imp
24
+ Journals
25
25
  Diaries
26
26
  Dreams
27
27
  Tears
@@ -0,0 +1,122 @@
1
+ akwamarynowy
2
+ alabastrowy
3
+ amarantowy
4
+ ametystowy
5
+ antracytowy
6
+ atramentowy
7
+ bananowy
8
+ beżowy
9
+ biały
10
+ biskupi
11
+ błękitny
12
+ bordowy
13
+ brązowy
14
+ brunatny
15
+ brzoskwiniowy
16
+ buraczkowy
17
+ burgundowy
18
+ bursztynowy
19
+ bury
20
+ ceglasty
21
+ chabrowy
22
+ cielisty
23
+ cynamonowy
24
+ cynobrowy
25
+ cytrynowy
26
+ czarny
27
+ czekoladowy
28
+ czerwony
29
+ écru
30
+ fioletowy
31
+ fiołkowy
32
+ fuksjowy
33
+ gołębi
34
+ granatowy
35
+ groszkowy
36
+ grynszpanowy
37
+ hebanowy
38
+ herbaciany
39
+ jagodowy
40
+ jasnożółty
41
+ jaśminowy
42
+ kakaowy
43
+ kanarkowy
44
+ kardynalski
45
+ karmazynowy
46
+ karminowy
47
+ kasztanowy
48
+ kawowy
49
+ khaki
50
+ kobaltowy
51
+ koniakowy
52
+ koralowy
53
+ kremowy
54
+ krwisty
55
+ lawendowy
56
+ lazurowy
57
+ liliowy
58
+ limonkowy
59
+ łososiowy
60
+ magentowy
61
+ mahoniowy
62
+ majtkowy
63
+ makowy
64
+ malachitowy
65
+ malinowy
66
+ marchewkowy
67
+ miedziany
68
+ miętowy
69
+ miodowy
70
+ mleczny
71
+ modry
72
+ morelowy
73
+ morski
74
+ mysi
75
+ niebieski
76
+ oberżynowy
77
+ oliwkowy
78
+ oranż
79
+ orzechowy
80
+ patynowy
81
+ pąsowy
82
+ perłowy
83
+ piaskowy
84
+ pistacjowy
85
+ platynowy
86
+ płowy
87
+ pomarańczowy
88
+ popielaty
89
+ porcelanowy
90
+ poziomkowy
91
+ purpurowy
92
+ rdzawy
93
+ różowy
94
+ rubinowy
95
+ rudy
96
+ seledynowy
97
+ siarkowy
98
+ siny
99
+ siwy
100
+ słomkowy
101
+ smolisty
102
+ spiżowy
103
+ srebrny
104
+ stalowy
105
+ szafirowy
106
+ szafranowy
107
+ szary
108
+ szkarłatny
109
+ szmaragdowy
110
+ śliwkowy
111
+ świniowy
112
+ tabaczkowy
113
+ truskawkowy
114
+ turkusowy
115
+ winny
116
+ wiśniowy
117
+ woskowy
118
+ wrzosowy
119
+ zielony
120
+ złocisty
121
+ złoty
122
+ żółty