iso_country_codes 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c3110dc1bdfd991c513b2c27f5939d281e9b0d5
4
- data.tar.gz: 44d7afee30fa805ef207686c2a99ee3694251753
3
+ metadata.gz: 41bee119bf0ac1ab5496544b3d62c2bf9cbcab06
4
+ data.tar.gz: c649cd0acdf92729d3e3e2a7b39e5bcad53fd3dc
5
5
  SHA512:
6
- metadata.gz: da54487463320edd915ffa883c460c029a30481b10846f3415a5eccde01786277eb66d7b18100460d3ce190124ebc38fd799cd2123c3d516a4a9a5d8f475afd9
7
- data.tar.gz: 0ab5d7894e4909d116fe8d906f910e024243c9946af9254b328165c1ab543e5134501cec5405dfd95551d5880fcfe85c39dc7f6959fe09777540cfc4790e1662
6
+ metadata.gz: 92c6b6fdf850a365c90bf1ff77d8937e1a48570ca8e86de41aa26c38d45a2569be169c49d772df468f51baa423e8e7f875073c73520afd8d9a42d2e1e1ba0f91
7
+ data.tar.gz: 130ace694034cbac7a9591f9b55ed54d932d52f1b97ee7d7d9955008788ad8be0093d3b3fe8ec5d430ccf7b8480ff5cb1bc811939f80fb6a1138563b6428cbc0
data/Gemfile CHANGED
@@ -5,4 +5,5 @@ gem 'rdoc'
5
5
 
6
6
  group :development do
7
7
  gem 'nokogiri'
8
+ gem 'erubis'
8
9
  end
data/Gemfile.lock CHANGED
@@ -1,16 +1,20 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- json (1.6.1)
5
- nokogiri (1.5.2)
6
- rake (0.9.2.2)
7
- rdoc (3.11)
4
+ erubis (2.7.0)
5
+ json (1.8.2)
6
+ mini_portile (0.6.2)
7
+ nokogiri (1.6.6.2)
8
+ mini_portile (~> 0.6.0)
9
+ rake (10.4.2)
10
+ rdoc (4.2.0)
8
11
  json (~> 1.4)
9
12
 
10
13
  PLATFORMS
11
14
  ruby
12
15
 
13
16
  DEPENDENCIES
17
+ erubis
14
18
  nokogiri
15
19
  rake
16
20
  rdoc
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.7.0 / 2015-05-21
2
+
3
+ * Adds ISO 13616-1 IBAN codes
4
+ * Updated with the latest data from Wikipedia
5
+
1
6
  === 0.6.1 / 2014-11-08
2
7
 
3
8
  * Allows continents to be accessed in a class instance
@@ -71,4 +76,3 @@
71
76
  === 0.1.0 / 2008-11-20
72
77
 
73
78
  * Initial release
74
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.7.0
@@ -3,6 +3,7 @@ $LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
3
3
 
4
4
  require 'iso_country_codes/code'
5
5
  require 'iso_country_codes/iso_3166_1'
6
+ require 'iso_country_codes/iso_13616_1'
6
7
  require 'iso_country_codes/iso_4217'
7
8
  require 'iso_country_codes/calling'
8
9
  require 'iso_country_codes/continent'
@@ -31,7 +31,7 @@ class IsoCountryCodes
31
31
  def continent
32
32
  self.class.continent
33
33
  end
34
-
34
+
35
35
  def main_currency
36
36
  self.class.main_currency
37
37
  end
@@ -44,8 +44,12 @@ class IsoCountryCodes
44
44
  self.class.currencies
45
45
  end
46
46
 
47
+ def iban
48
+ self.class.iban
49
+ end
50
+
47
51
  class << self
48
- attr_accessor :name, :numeric, :alpha2, :alpha3, :calling, :continent, :main_currency
52
+ attr_accessor :name, :numeric, :alpha2, :alpha3, :calling, :continent, :main_currency, :iban
49
53
  attr_writer :currencies
50
54
  alias_method :currency, :main_currency
51
55
  alias_method :calling_code, :calling
@@ -71,6 +75,11 @@ class IsoCountryCodes
71
75
  return [@main_currency]
72
76
  end
73
77
  end
78
+
79
+ def iban
80
+ # Return `nil` if the country doesn't use IBANs
81
+ return @iban if defined? @iban
82
+ end
74
83
  end
75
84
  end
76
85
  end
@@ -0,0 +1,232 @@
1
+ class IsoCountryCodes
2
+ class Code
3
+ class ALA < Code #:nodoc:
4
+ self.iban = 'FI'
5
+ end
6
+ class ALB < Code #:nodoc:
7
+ self.iban = 'AL'
8
+ end
9
+ class AND < Code #:nodoc:
10
+ self.iban = 'AD'
11
+ end
12
+ class AUT < Code #:nodoc:
13
+ self.iban = 'AT'
14
+ end
15
+ class AZE < Code #:nodoc:
16
+ self.iban = 'AZ'
17
+ end
18
+ class BHR < Code #:nodoc:
19
+ self.iban = 'BH'
20
+ end
21
+ class BEL < Code #:nodoc:
22
+ self.iban = 'BE'
23
+ end
24
+ class BIH < Code #:nodoc:
25
+ self.iban = 'BA'
26
+ end
27
+ class BRA < Code #:nodoc:
28
+ self.iban = 'BR'
29
+ end
30
+ class BGR < Code #:nodoc:
31
+ self.iban = 'BG'
32
+ end
33
+ class CRI < Code #:nodoc:
34
+ self.iban = 'CR'
35
+ end
36
+ class HRV < Code #:nodoc:
37
+ self.iban = 'HR'
38
+ end
39
+ class CYP < Code #:nodoc:
40
+ self.iban = 'CY'
41
+ end
42
+ class CZE < Code #:nodoc:
43
+ self.iban = 'CZ'
44
+ end
45
+ class DNK < Code #:nodoc:
46
+ self.iban = 'DK'
47
+ end
48
+ class FRO < Code #:nodoc:
49
+ self.iban = 'FO'
50
+ end
51
+ class GRL < Code #:nodoc:
52
+ self.iban = 'GL'
53
+ end
54
+ class DOM < Code #:nodoc:
55
+ self.iban = 'DO'
56
+ end
57
+ class EST < Code #:nodoc:
58
+ self.iban = 'EE'
59
+ end
60
+ class FIN < Code #:nodoc:
61
+ self.iban = 'FI'
62
+ end
63
+ class FRA < Code #:nodoc:
64
+ self.iban = 'FR'
65
+ end
66
+ class GEO < Code #:nodoc:
67
+ self.iban = 'GE'
68
+ end
69
+ class DEU < Code #:nodoc:
70
+ self.iban = 'DE'
71
+ end
72
+ class GIB < Code #:nodoc:
73
+ self.iban = 'GI'
74
+ end
75
+ class GRC < Code #:nodoc:
76
+ self.iban = 'GR'
77
+ end
78
+ class GTM < Code #:nodoc:
79
+ self.iban = 'GT'
80
+ end
81
+ class HUN < Code #:nodoc:
82
+ self.iban = 'HU'
83
+ end
84
+ class ISL < Code #:nodoc:
85
+ self.iban = 'IS'
86
+ end
87
+ class IRL < Code #:nodoc:
88
+ self.iban = 'IE'
89
+ end
90
+ class ISR < Code #:nodoc:
91
+ self.iban = 'IL'
92
+ end
93
+ class ITA < Code #:nodoc:
94
+ self.iban = 'IT'
95
+ end
96
+ class JOR < Code #:nodoc:
97
+ self.iban = 'JO'
98
+ end
99
+ class KAZ < Code #:nodoc:
100
+ self.iban = 'KZ'
101
+ end
102
+ class KWT < Code #:nodoc:
103
+ self.iban = 'KW'
104
+ end
105
+ class LVA < Code #:nodoc:
106
+ self.iban = 'LV'
107
+ end
108
+ class LBN < Code #:nodoc:
109
+ self.iban = 'LB'
110
+ end
111
+ class LIE < Code #:nodoc:
112
+ self.iban = 'LI'
113
+ end
114
+ class LTU < Code #:nodoc:
115
+ self.iban = 'LT'
116
+ end
117
+ class LUX < Code #:nodoc:
118
+ self.iban = 'LU'
119
+ end
120
+ class MKD < Code #:nodoc:
121
+ self.iban = 'MK'
122
+ end
123
+ class MLT < Code #:nodoc:
124
+ self.iban = 'MT'
125
+ end
126
+ class MRT < Code #:nodoc:
127
+ self.iban = 'MR'
128
+ end
129
+ class MUS < Code #:nodoc:
130
+ self.iban = 'MU'
131
+ end
132
+ class MDA < Code #:nodoc:
133
+ self.iban = 'MD'
134
+ end
135
+ class MCO < Code #:nodoc:
136
+ self.iban = 'MC'
137
+ end
138
+ class MNE < Code #:nodoc:
139
+ self.iban = 'ME'
140
+ end
141
+ class NLD < Code #:nodoc:
142
+ self.iban = 'NL'
143
+ end
144
+ class NOR < Code #:nodoc:
145
+ self.iban = 'NO'
146
+ end
147
+ class PAK < Code #:nodoc:
148
+ self.iban = 'PK'
149
+ end
150
+ class PSE < Code #:nodoc:
151
+ self.iban = 'PS'
152
+ end
153
+ class POL < Code #:nodoc:
154
+ self.iban = 'PL'
155
+ end
156
+ class PRT < Code #:nodoc:
157
+ self.iban = 'PT'
158
+ end
159
+ class QAT < Code #:nodoc:
160
+ self.iban = 'QA'
161
+ end
162
+ class ROU < Code #:nodoc:
163
+ self.iban = 'RO'
164
+ end
165
+ class SMR < Code #:nodoc:
166
+ self.iban = 'SM'
167
+ end
168
+ class SAU < Code #:nodoc:
169
+ self.iban = 'SA'
170
+ end
171
+ class SRB < Code #:nodoc:
172
+ self.iban = 'RS'
173
+ end
174
+ class SVK < Code #:nodoc:
175
+ self.iban = 'SK'
176
+ end
177
+ class SVN < Code #:nodoc:
178
+ self.iban = 'SI'
179
+ end
180
+ class ESP < Code #:nodoc:
181
+ self.iban = 'ES'
182
+ end
183
+ class SWE < Code #:nodoc:
184
+ self.iban = 'SE'
185
+ end
186
+ class CHE < Code #:nodoc:
187
+ self.iban = 'CH'
188
+ end
189
+ class TLS < Code #:nodoc:
190
+ self.iban = 'TL'
191
+ end
192
+ class TUN < Code #:nodoc:
193
+ self.iban = 'TN'
194
+ end
195
+ class TUR < Code #:nodoc:
196
+ self.iban = 'TR'
197
+ end
198
+ class ARE < Code #:nodoc:
199
+ self.iban = 'AU'
200
+ end
201
+ class GBR < Code #:nodoc:
202
+ self.iban = 'GB'
203
+ end
204
+ class VGB < Code #:nodoc:
205
+ self.iban = 'VG'
206
+ end
207
+ class GUF < Code #:nodoc:
208
+ self.iban = 'FR'
209
+ end
210
+ class GLP < Code #:nodoc:
211
+ self.iban = 'FR'
212
+ end
213
+ class MTQ < Code #:nodoc:
214
+ self.iban = 'FR'
215
+ end
216
+ class MYT < Code #:nodoc:
217
+ self.iban = 'FR'
218
+ end
219
+ class REU < Code #:nodoc:
220
+ self.iban = 'FR'
221
+ end
222
+ class BLM < Code #:nodoc:
223
+ self.iban = 'FR'
224
+ end
225
+ class MAF < Code #:nodoc:
226
+ self.iban = 'FR'
227
+ end
228
+ class SPM < Code #:nodoc:
229
+ self.iban = 'FR'
230
+ end
231
+ end # end Code
232
+ end # IsoCountryCodes
@@ -160,7 +160,7 @@ class IsoCountryCodes
160
160
  end
161
161
  class BOL < Code #:nodoc:
162
162
  self.numeric = %q{068}
163
- self.name = %q{Bolivia, Plurinational State of}
163
+ self.name = %q{Bolivia (Plurinational State of)}
164
164
  self.alpha2 = %q{BO}
165
165
  self.alpha3 = %q{BOL}
166
166
  end
@@ -310,7 +310,7 @@ class IsoCountryCodes
310
310
  end
311
311
  class COD < Code #:nodoc:
312
312
  self.numeric = %q{180}
313
- self.name = %q{Congo, the Democratic Republic of the}
313
+ self.name = %q{Congo (Democratic Republic of the)}
314
314
  self.alpha2 = %q{CD}
315
315
  self.alpha3 = %q{COD}
316
316
  end
@@ -586,7 +586,7 @@ class IsoCountryCodes
586
586
  end
587
587
  class VAT < Code #:nodoc:
588
588
  self.numeric = %q{336}
589
- self.name = %q{Holy See (Vatican City State)}
589
+ self.name = %q{Holy See}
590
590
  self.alpha2 = %q{VA}
591
591
  self.alpha3 = %q{VAT}
592
592
  end
@@ -628,7 +628,7 @@ class IsoCountryCodes
628
628
  end
629
629
  class IRN < Code #:nodoc:
630
630
  self.numeric = %q{364}
631
- self.name = %q{Iran, Islamic Republic of}
631
+ self.name = %q{Iran (Islamic Republic of)}
632
632
  self.alpha2 = %q{IR}
633
633
  self.alpha3 = %q{IRN}
634
634
  end
@@ -706,13 +706,13 @@ class IsoCountryCodes
706
706
  end
707
707
  class PRK < Code #:nodoc:
708
708
  self.numeric = %q{408}
709
- self.name = %q{Korea, Democratic People's Republic of}
709
+ self.name = %q{Korea (Democratic People's Republic of)}
710
710
  self.alpha2 = %q{KP}
711
711
  self.alpha3 = %q{PRK}
712
712
  end
713
713
  class KOR < Code #:nodoc:
714
714
  self.numeric = %q{410}
715
- self.name = %q{Korea, Republic of}
715
+ self.name = %q{Korea (Republic of)}
716
716
  self.alpha2 = %q{KR}
717
717
  self.alpha3 = %q{KOR}
718
718
  end
@@ -790,7 +790,7 @@ class IsoCountryCodes
790
790
  end
791
791
  class MKD < Code #:nodoc:
792
792
  self.numeric = %q{807}
793
- self.name = %q{Macedonia, the former Yugoslav Republic of}
793
+ self.name = %q{Macedonia (the former Yugoslav Republic of)}
794
794
  self.alpha2 = %q{MK}
795
795
  self.alpha3 = %q{MKD}
796
796
  end
@@ -868,13 +868,13 @@ class IsoCountryCodes
868
868
  end
869
869
  class FSM < Code #:nodoc:
870
870
  self.numeric = %q{583}
871
- self.name = %q{Micronesia, Federated States of}
871
+ self.name = %q{Micronesia (Federated States of)}
872
872
  self.alpha2 = %q{FM}
873
873
  self.alpha3 = %q{FSM}
874
874
  end
875
875
  class MDA < Code #:nodoc:
876
876
  self.numeric = %q{498}
877
- self.name = %q{Moldova, Republic of}
877
+ self.name = %q{Moldova (Republic of)}
878
878
  self.alpha2 = %q{MD}
879
879
  self.alpha3 = %q{MDA}
880
880
  end
@@ -1408,13 +1408,13 @@ class IsoCountryCodes
1408
1408
  end
1409
1409
  class GBR < Code #:nodoc:
1410
1410
  self.numeric = %q{826}
1411
- self.name = %q{United Kingdom}
1411
+ self.name = %q{United Kingdom of Great Britain and Northern Ireland}
1412
1412
  self.alpha2 = %q{GB}
1413
1413
  self.alpha3 = %q{GBR}
1414
1414
  end
1415
1415
  class USA < Code #:nodoc:
1416
1416
  self.numeric = %q{840}
1417
- self.name = %q{United States}
1417
+ self.name = %q{United States of America}
1418
1418
  self.alpha2 = %q{US}
1419
1419
  self.alpha3 = %q{USA}
1420
1420
  end
@@ -1444,25 +1444,25 @@ class IsoCountryCodes
1444
1444
  end
1445
1445
  class VEN < Code #:nodoc:
1446
1446
  self.numeric = %q{862}
1447
- self.name = %q{Venezuela, Bolivarian Republic of}
1447
+ self.name = %q{Venezuela (Bolivarian Republic of)}
1448
1448
  self.alpha2 = %q{VE}
1449
1449
  self.alpha3 = %q{VEN}
1450
1450
  end
1451
1451
  class VNM < Code #:nodoc:
1452
1452
  self.numeric = %q{704}
1453
- self.name = %q{Vietnam}
1453
+ self.name = %q{Viet Nam}
1454
1454
  self.alpha2 = %q{VN}
1455
1455
  self.alpha3 = %q{VNM}
1456
1456
  end
1457
1457
  class VGB < Code #:nodoc:
1458
1458
  self.numeric = %q{092}
1459
- self.name = %q{Virgin Islands, British}
1459
+ self.name = %q{Virgin Islands (British)}
1460
1460
  self.alpha2 = %q{VG}
1461
1461
  self.alpha3 = %q{VGB}
1462
1462
  end
1463
1463
  class VIR < Code #:nodoc:
1464
1464
  self.numeric = %q{850}
1465
- self.name = %q{Virgin Islands, U.S.}
1465
+ self.name = %q{Virgin Islands (U.S.)}
1466
1466
  self.alpha2 = %q{VI}
1467
1467
  self.alpha3 = %q{VIR}
1468
1468
  end
@@ -198,6 +198,16 @@ class TestIsoCountryCodes < Test::Unit::TestCase
198
198
  assert_equal '+61', IsoCountryCodes::Code::AUS.instance.calling
199
199
  end
200
200
 
201
+ def test_get_iban
202
+ assert_equal 'FR', IsoCountryCodes::Code::FRA.iban
203
+ assert_equal 'FR', IsoCountryCodes::Code::FRA.instance.iban
204
+ end
205
+
206
+ def test_get_iban_for_non_iban_country
207
+ assert_equal nil, IsoCountryCodes::Code::USA.iban
208
+ assert_equal nil, IsoCountryCodes::Code::USA.instance.iban
209
+ end
210
+
201
211
  def test_get_calling_code_alias
202
212
  code = IsoCountryCodes::Code::AUS.instance
203
213
  assert_equal code.calling, code.calling_code
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iso_country_codes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rabarts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-08 00:00:00.000000000 Z
11
+ date: 2015-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,6 +87,7 @@ files:
87
87
  - lib/iso_country_codes/calling.rb
88
88
  - lib/iso_country_codes/code.rb
89
89
  - lib/iso_country_codes/continent.rb
90
+ - lib/iso_country_codes/iso_13616_1.rb
90
91
  - lib/iso_country_codes/iso_3166_1.rb
91
92
  - lib/iso_country_codes/iso_4217.rb
92
93
  - lib/iso_country_codes/iso_country_codes.rb