iso_country_codes 0.7.1 → 0.7.2

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: cdaa725630fdd0526188835414249347dfb27d03
4
- data.tar.gz: c2bdf6f01db237598b2ecc19b95bf15ca8f84fc8
3
+ metadata.gz: 413050b3b4caedd31fbf379ea859a5646436f42c
4
+ data.tar.gz: f1e8ee5ed01e7dd343405188bbdf3ebcc05b982f
5
5
  SHA512:
6
- metadata.gz: 64110f1ed3ef27269d5b6b70d2b675d02824c3e73cab8ab795a24c73c4ce0d0f565333f2fb6a91ddd25a14e0bcdd23b7209092946aaf37ff26a5845a8df05bd7
7
- data.tar.gz: 9c8b10d9fb339a331a382712dea6c4d9816f2219a5fdc06ffc2aa634e387d780781e7c2eedb1d7a5fbe144cfcd84e1c3b648864d166014f929d56a37809bf4a8
6
+ metadata.gz: 77340d6e00213e6ff14f8bcd9a91a5ea5bae8650babeeb98c3965d80684549ea8e8acf0c775f6858d40423a0665597650a044455472db967ba4c24b161b85ce7
7
+ data.tar.gz: a3f8a5a6957c45f32886dccab2e28c2bce4c9046c2416df6b5012c80fff9b5dc3c865386c0ce855b2002bec829a00c645b9fec8fbe8a6dc873036d5ba0245a44
@@ -1,82 +1,88 @@
1
- === 0.7.1 / 2015-05-21
1
+ ## Unreleased
2
+
3
+ * Fixed RegExp error in `search_by_name` (see #21)
4
+ * Moved Cyprus from Asia to Europe
5
+ * Added IBAN codes for British Crown Dependencies
6
+
7
+ ## 0.7.1 - 2015-05-21
2
8
 
3
9
  * Adds IsoCountryCodes.search_by_iban method to search by IBAN code
4
10
 
5
- === 0.7.0 / 2015-05-21
11
+ ## 0.7.0 - 2015-05-21
6
12
 
7
13
  * Adds ISO 13616-1 IBAN codes
8
14
  * Updated with the latest data from Wikipedia
9
15
 
10
- === 0.6.1 / 2014-11-08
16
+ ## 0.6.1 - 2014-11-08
11
17
 
12
18
  * Allows continents to be accessed in a class instance
13
19
 
14
- === 0.6.0 / 2014-10-23
20
+ ## 0.6.0 - 2014-10-23
15
21
 
16
22
  * Added ability to raise custom fallbacks and return default values
17
23
 
18
- === 0.5.0 / 2014-10-13
24
+ ## 0.5.0 - 2014-10-13
19
25
 
20
26
  * Added continent codes
21
27
 
22
- === 0.4.4 / 2014-07-23
28
+ ## 0.4.4 - 2014-07-23
23
29
 
24
30
  * Corrected Korean currency codes (fixes #13)
25
31
 
26
- === 0.4.3 / 2014-06-24
32
+ ## 0.4.3 - 2014-06-24
27
33
 
28
34
  * Latvian LAT replaced with the Euro (fixes #10)
29
35
  * Updated with the latest data from Wikipedia (fixes #12)
30
36
 
31
- === 0.4.2 / 2013-09-17
37
+ ## 0.4.2 - 2013-09-17
32
38
 
33
39
  * Fixed a problem with IsoCountryCodes.search_by_name when the result is an exact match
34
40
 
35
- === 0.4.1 / 2013-04-03
41
+ ## 0.4.1 - 2013-04-03
36
42
 
37
43
  * Fixed a problem with IsoCountryCodes.search_by_name when an exception is thrown
38
44
  * Remvoed Jeweller dependency in development
39
45
 
40
- === 0.4.0 / 2013-01-29
46
+ ## 0.4.0 - 2013-01-29
41
47
 
42
48
  * Added country calling codes, which may be accessed with the `calling` instance method
43
49
  * Added `search_by_name`, `search_by_currency` and `search_by_calling_code` methods
44
50
  * `:fuzzy` option on `find` is deprecated (use the `search_by_name` method instead)
45
51
 
46
- === 0.3.1 / 2013-01-28
52
+ ## 0.3.1 - 2013-01-28
47
53
 
48
54
  * Updated with the latest data from Wikipedia
49
55
 
50
- === 0.3.0 / 2012-03-13
56
+ ## 0.3.0 - 2012-03-13
51
57
 
52
58
  * Added IsoCountryCodes.for_select convenience method
53
59
  * Updated with the latest country names from Wikipedia
54
60
 
55
- === 0.2.3 / 2011-10-27
61
+ ## 0.2.3 - 2011-10-27
56
62
 
57
63
  * Updated with the latest data from Wikipedia
58
64
 
59
- === 0.2.2 / 2009-08-07
65
+ ## 0.2.2 - 2009-08-07
60
66
 
61
67
  * Added Ruby 1.9 UTF-8 encoding header
62
68
  * Updated with the latest country names from Wikipedia
63
69
 
64
- === 0.2.1 / 2008-11-25
70
+ ## 0.2.1 - 2008-11-25
65
71
 
66
72
  * All Ruby warnings resolved
67
73
 
68
- === 0.2.0 / 2008-11-24
74
+ ## 0.2.0 - 2008-11-24
69
75
 
70
76
  * Currency codes added
71
77
 
72
- === 0.1.2 / 2008-11-24
78
+ ## 0.1.2 - 2008-11-24
73
79
 
74
80
  * Inexact strings can now be used to search for country names
75
81
 
76
- === 0.1.1 / 2008-11-21
82
+ ## 0.1.1 - 2008-11-21
77
83
 
78
84
  * Each country now represented by a single class instead of one for each code
79
85
 
80
- === 0.1.0 / 2008-11-20
86
+ ## 0.1.0 - 2008-11-20
81
87
 
82
88
  * Initial release
data/README.rdoc CHANGED
@@ -13,7 +13,7 @@ Provides ISO codes, names and currencies for countries.
13
13
  == SYNOPSIS:
14
14
 
15
15
  # Finding an ISO code returns the country name and other code formats
16
- code = IsoCountryCodes.find('usa')
16
+ code = IsoCountryCodes.find('gb')
17
17
  code.name # => "United Kingdom of Great Britain and Northern Ireland"
18
18
  code.numeric # => "826"
19
19
  code.alpha2 # => "GB"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.2
@@ -159,7 +159,7 @@ class IsoCountryCodes
159
159
  self.continent = 'AS'
160
160
  end
161
161
  class CYP < Code #:nodoc:
162
- self.continent = 'AS'
162
+ self.continent = 'EU'
163
163
  end
164
164
  class CZE < Code #:nodoc:
165
165
  self.continent = 'EU'
@@ -738,4 +738,4 @@ class IsoCountryCodes
738
738
  self.continent = 'AF'
739
739
  end
740
740
  end
741
- end
741
+ end
@@ -69,6 +69,9 @@ class IsoCountryCodes
69
69
  class DEU < Code #:nodoc:
70
70
  self.iban = 'DE'
71
71
  end
72
+ class GGC < Code #:nodoc:
73
+ self.iban = 'GB'
74
+ end
72
75
  class GIB < Code #:nodoc:
73
76
  self.iban = 'GI'
74
77
  end
@@ -81,6 +84,9 @@ class IsoCountryCodes
81
84
  class HUN < Code #:nodoc:
82
85
  self.iban = 'HU'
83
86
  end
87
+ class IMN < Code #:nodoc:
88
+ self.iban = 'GB'
89
+ end
84
90
  class ISL < Code #:nodoc:
85
91
  self.iban = 'IS'
86
92
  end
@@ -93,6 +99,9 @@ class IsoCountryCodes
93
99
  class ITA < Code #:nodoc:
94
100
  self.iban = 'IT'
95
101
  end
102
+ class JEY < Code #:nodoc:
103
+ self.iban = 'GB'
104
+ end
96
105
  class JOR < Code #:nodoc:
97
106
  self.iban = 'JO'
98
107
  end
@@ -38,9 +38,9 @@ class IsoCountryCodes # :nodoc:
38
38
  def search_by_name(str, &fallback)
39
39
  fallback ||= DEFAULT_FALLBACK
40
40
 
41
- instances = all.select { |c| c.name.upcase == str.upcase }
42
- instances = all.select { |c| c.name.match(/^#{str}/i) } if instances.empty?
43
- instances = all.select { |c| c.name.match(/#{str}/i) } if instances.empty?
41
+ instances = all.select { |c| c.name.to_s.upcase == str.to_s.upcase }
42
+ instances = all.select { |c| c.name.to_s.match(/^#{Regexp.escape(str)}/i) } if instances.empty?
43
+ instances = all.select { |c| c.name.to_s.match(/#{Regexp.escape(str)}/i) } if instances.empty?
44
44
 
45
45
  return fallback.call "No ISO 3166-1 codes could be found searching with name '#{str}'." if instances.empty?
46
46
 
@@ -65,7 +65,7 @@ class IsoCountryCodes # :nodoc:
65
65
  def search_by_currency(code, &fallback)
66
66
  fallback ||= DEFAULT_FALLBACK
67
67
 
68
- code = code.to_str.upcase
68
+ code = code.to_s.upcase
69
69
  instances = all.select { |c|
70
70
  c.currencies.select { |currency|
71
71
  currency != code
@@ -80,7 +80,7 @@ class IsoCountryCodes # :nodoc:
80
80
  def search_by_iban(code, &fallback)
81
81
  fallback ||= DEFAULT_FALLBACK
82
82
 
83
- code = code.to_str.upcase
83
+ code = code.to_s.upcase
84
84
  instances = all.select { |c| c.iban == code }
85
85
 
86
86
  return fallback.call "No ISO 3166-1 codes could be found searching with IBAN '#{code}'." if instances.empty?
@@ -92,6 +92,12 @@ class TestIsoCountryCodes < Test::Unit::TestCase
92
92
  assert_equal IsoCountryCodes.search_by_name('unknown country') {[]}, []
93
93
  end
94
94
 
95
+ def test_search_by_name_does_not_raise_regexp_error
96
+ assert_nothing_raised do
97
+ IsoCountryCodes.search_by_name('+ab'){[]}
98
+ end
99
+ end
100
+
95
101
  def test_search_by_name_exact_match
96
102
  assert_equal(
97
103
  [IsoCountryCodes::Code::CCK.instance],
@@ -165,11 +171,11 @@ class TestIsoCountryCodes < Test::Unit::TestCase
165
171
  end
166
172
 
167
173
  def test_search_by_iban_lowercase
168
- assert_equal [IsoCountryCodes::Code::GBR.instance], IsoCountryCodes.search_by_iban('gb')
174
+ assert_equal [IsoCountryCodes::Code::BIH.instance], IsoCountryCodes.search_by_iban('ba')
169
175
  end
170
176
 
171
177
  def test_search_by_iban_uppercase
172
- assert_equal [IsoCountryCodes::Code::GBR.instance], IsoCountryCodes.search_by_iban('GB')
178
+ assert_equal [IsoCountryCodes::Code::BIH.instance], IsoCountryCodes.search_by_iban('BA')
173
179
  end
174
180
 
175
181
  def test_search_by_iban_invalid_value_and_raise_exception
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.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rabarts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-21 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,9 +75,9 @@ extra_rdoc_files:
75
75
  files:
76
76
  - .gitignore
77
77
  - .travis.yml
78
+ - CHANGELOG.md
78
79
  - Gemfile
79
80
  - Gemfile.lock
80
- - History.txt
81
81
  - Manifest.txt
82
82
  - README.rdoc
83
83
  - Rakefile
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.2.2
120
+ rubygems_version: 2.4.8
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Provides ISO 3166-1 country codes/names and ISO 4217 currencies.