yahoo_countries_and_provinces 0.0.1 → 0.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6ed4080e2aba87088ecdf7aba9cd6fc9fc0bfbd
|
4
|
+
data.tar.gz: 0aef4606910e33ac24a1c9f3ca4c68c8f2fa7345
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc610d2246c52fa914cac95d384cf48dfc05ef8c50204ad23fca1dc9c1dba9a559c42bf2be1f672248b8096f70ccd9a731174ffe53a5778ffb68956c9059a4cf
|
7
|
+
data.tar.gz: 6e4ddb69d335d876b78813002af9007c9389ac72a96daa1fd37b482ed5173327df499448b133bc75dbe1658f4791b9f53b5a9149060656391e116528367899b9
|
data/README.md
CHANGED
@@ -4,13 +4,13 @@ require 'json'
|
|
4
4
|
module YahooCountriesAndProvinces
|
5
5
|
class YahooProvinceList
|
6
6
|
def initialize()
|
7
|
-
@
|
7
|
+
@province_array = []
|
8
8
|
end
|
9
9
|
|
10
10
|
def provinces(country, language = "en")
|
11
11
|
set_url(country, language)
|
12
12
|
|
13
|
-
@
|
13
|
+
@province_array.clear if @province_array.any?
|
14
14
|
begin
|
15
15
|
resp = Net::HTTP.get_response(URI.parse(@url))
|
16
16
|
data = resp.body
|
@@ -19,11 +19,11 @@ module YahooCountriesAndProvinces
|
|
19
19
|
raise "Could not get the data from yahoo's servers"
|
20
20
|
end
|
21
21
|
|
22
|
-
result.each { |
|
23
|
-
@
|
22
|
+
result.each { |province|
|
23
|
+
@province_array << province['name']
|
24
24
|
}
|
25
25
|
|
26
|
-
@
|
26
|
+
@province_array
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
@@ -9,11 +9,11 @@ class YahooCountriesAndProvincesTest < Test::Unit::TestCase
|
|
9
9
|
assert YahooCountriesAndProvinces::countries("de").include?("Kleinere Inselbesitzungen der Vereinigten Staaten")
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def test_get_province_baghdad_in_english
|
13
13
|
assert YahooCountriesAndProvinces::provinces("Iraq", "en").include?("Baghdad")
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def test_get_province_stockholm_in_arabic
|
17
17
|
assert YahooCountriesAndProvinces::provinces("Sweden", "ar").include?("ستوكهولم")
|
18
18
|
end
|
19
19
|
end
|