app_store_info 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/.ruby-version +1 -1
- data/.travis.yml +2 -2
- data/lib/app_store_info/api.rb +3 -3
- data/lib/app_store_info/app.rb +1 -1
- data/lib/app_store_info/regions.rb +23 -21
- data/lib/app_store_info/version.rb +1 -1
- data/lib/app_store_info.rb +2 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb2950431c398803bbe3a5101fb2e812d908f763
|
4
|
+
data.tar.gz: f3f92aa3830de415f225c41a3d3f7bbc6e0150de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c13a26b2667be052fa3eaeb70d68e458f5a9047f0852ff1eb7080bbab5d286a6dd05ad3657710055bcb7d1227138af785689f1264d985e7908a989b7fd33dc8f
|
7
|
+
data.tar.gz: e9092d12073c8752cd71905bb6e3de1e95cb7cbb21e6034fa9fca7e2e0cfcda65189655fda9113fee6f454a77a0bcfcaf0bae3d84fc1858cde233bf9492ccf31
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.3
|
data/.travis.yml
CHANGED
data/lib/app_store_info/api.rb
CHANGED
@@ -19,7 +19,7 @@ module AppStoreInfo
|
|
19
19
|
response = Faraday.get(url)
|
20
20
|
|
21
21
|
unless response.status == 200 && response.body
|
22
|
-
|
22
|
+
raise ConnectionError, "Cound't connect to app store API"
|
23
23
|
end
|
24
24
|
|
25
25
|
parse_json(response.body)
|
@@ -30,13 +30,13 @@ module AppStoreInfo
|
|
30
30
|
def parse_json(body)
|
31
31
|
json = JSON.parse(body)
|
32
32
|
|
33
|
-
|
33
|
+
raise EntryNotFound, 'No results' unless json.key?('results')
|
34
34
|
|
35
35
|
json = json['results'].first
|
36
36
|
|
37
37
|
# If the JSON exists and it's a mobile app (to avoid OS X apps)
|
38
38
|
unless json && json['supportedDevices']
|
39
|
-
|
39
|
+
raise EntryNotFound, "App not found or unavailable on '#{@region}' region"
|
40
40
|
end
|
41
41
|
|
42
42
|
json
|
data/lib/app_store_info/app.rb
CHANGED
@@ -26,32 +26,34 @@ module AppStoreInfo
|
|
26
26
|
'BG' => 'Bulgaria', 'BH' => 'Bahrain', 'BJ' => 'Benin', 'BM' => 'Bermuda',
|
27
27
|
'BN' => 'Brunei Darussalam', 'BO' => 'Bolivia', 'BR' => 'Brazil', 'BS' => 'Bahamas',
|
28
28
|
'BT' => 'Bhutan', 'BW' => 'Botswana', 'BY' => 'Belarus', 'BZ' => 'Belize', 'CA' => 'Canada',
|
29
|
-
'CG' => 'Republic Of Congo', 'CH' => 'Switzerland', 'CL' => 'Chile', '
|
30
|
-
'CO' => 'Colombia', 'CR' => 'Costa Rica', 'CV' => 'Cape Verde',
|
31
|
-
'
|
32
|
-
'
|
33
|
-
'EG' => 'Egypt', 'ES' => 'Spain', '
|
34
|
-
'FM' => 'Federated States Of Micronesia', 'FR' => 'France',
|
35
|
-
'
|
36
|
-
'
|
37
|
-
'
|
38
|
-
'
|
29
|
+
'CG' => 'Republic Of Congo', 'CH' => 'Switzerland', 'CL' => 'Chile', 'CM' => 'Cameroon',
|
30
|
+
'CN' => 'China', 'CO' => 'Colombia', 'CR' => 'Costa Rica', 'CV' => 'Cape Verde',
|
31
|
+
'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DE' => 'Germany', 'DK' => 'Denmark',
|
32
|
+
'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'DZ' => 'Algeria', 'EC' => 'Ecuador',
|
33
|
+
'EE' => 'Estonia', 'EG' => 'Egypt', 'ES' => 'Spain', 'ET' => 'Ethiopia', 'FI' => 'Finland',
|
34
|
+
'FJ' => 'Fiji', 'FM' => 'Federated States Of Micronesia', 'FR' => 'France',
|
35
|
+
'GB' => 'United Kingdom', 'GD' => 'Grenada', 'GH' => 'Ghana', 'GM' => 'Gambia',
|
36
|
+
'GR' => 'Greece', 'GT' => 'Guatemala', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana',
|
37
|
+
'HK' => 'Hong Kong', 'HN' => 'Honduras', 'HR' => 'Croatia', 'HU' => 'Hungary',
|
38
|
+
'ID' => 'Indonesia', 'IE' => 'Ireland', 'IL' => 'Israel', 'IN' => 'India', 'IS' => 'Iceland',
|
39
|
+
'IT' => 'Italy', 'JM' => 'Jamaica',
|
39
40
|
'JO' => 'Jordan', 'JP' => 'Japan', 'KE' => 'Kenya', 'KG' => 'Kyrgyzstan', 'KH' => 'Cambodia',
|
40
41
|
'KN' => 'St. Kitts and Nevis', 'KR' => 'Republic Of Korea', 'KW' => 'Kuwait',
|
41
42
|
'KY' => 'Cayman Islands', 'KZ' => 'Kazakhstan', 'LA' => "Lao People's Democratic Republic",
|
42
43
|
'LB' => 'Lebanon', 'LC' => 'Santa Lucia', 'LK' => 'Sri Lanka', 'LR' => 'Liberia',
|
43
|
-
'
|
44
|
-
'
|
45
|
-
'
|
46
|
-
'MU' => 'Mauritius', 'MW' => 'Malawi', 'MX' => 'Mexico', 'MY' => 'Malaysia',
|
44
|
+
'LS' => 'Lesotho', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'LV' => 'Latvia',
|
45
|
+
'MD' => 'Republic Of Moldova', 'MG' => 'Madagascar', 'MK' => 'Macedonia', 'ML' => 'Mali',
|
46
|
+
'MN' => 'Mongolia', 'MO' => 'Macau', 'MR' => 'Mauritania', 'MS' => 'Montserrat',
|
47
|
+
'MT' => 'Malta', 'MU' => 'Mauritius', 'MW' => 'Malawi', 'MX' => 'Mexico', 'MY' => 'Malaysia',
|
47
48
|
'MZ' => 'Mozambique', 'NA' => 'Namibia', 'NE' => 'Niger', 'NG' => 'Nigeria',
|
48
49
|
'NI' => 'Nicaragua', 'NL' => 'Netherlands', 'NO' => 'Norway', 'NP' => 'Nepal',
|
49
50
|
'NZ' => 'New Zealand', 'OM' => 'Oman', 'PA' => 'Panama', 'PE' => 'Peru',
|
50
51
|
'PG' => 'Papua New Guinea', 'PH' => 'Philippines', 'PK' => 'Pakistan', 'PL' => 'Poland',
|
51
52
|
'PT' => 'Portugal', 'PW' => 'Palau', 'PY' => 'Paraguay', 'QA' => 'Qatar', 'RO' => 'Romania',
|
52
|
-
'RU' => 'Russia', '
|
53
|
-
'
|
54
|
-
'
|
53
|
+
'RU' => 'Russia', 'RW' => 'Rwanda', 'SA' => 'Saudi Arabia', 'SB' => 'Solomon Islands',
|
54
|
+
'SC' => 'Seychelles', 'SE' => 'Sweden', 'SG' => 'Singapore',
|
55
|
+
'SI' => 'Slovenia', 'SK' => 'Slovakia', 'SL' => 'Sierra Leone',
|
56
|
+
'SN' => 'Senegal', 'SR' => 'Suriname', 'SS' => 'South Sudan',
|
55
57
|
'ST' => 'Sao Tome and Principe', 'SV' => 'El Salvador', 'SZ' => 'Swaziland',
|
56
58
|
'TC' => 'Turks and Caicos', 'TD' => 'Chad', 'TH' => 'Thailand', 'TJ' => 'Tajikistan',
|
57
59
|
'TM' => 'Turkmenistan', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TT' => 'Trinidad and Tobago',
|
@@ -59,7 +61,7 @@ module AppStoreInfo
|
|
59
61
|
'US' => 'United States', 'UY' => 'Uruguay', 'UZ' => 'Uzbekistan',
|
60
62
|
'VC' => 'St. Vincent and The Grenadines', 'VE' => 'Venezuela',
|
61
63
|
'VG' => 'British Virgin Islands', 'VN' => 'Vietnam', 'YE' => 'Yemen',
|
62
|
-
'ZA' => 'South Africa', 'ZW' => 'Zimbabwe'
|
64
|
+
'ZA' => 'South Africa', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe'
|
63
65
|
}.freeze
|
64
66
|
|
65
67
|
REGIONS = {
|
@@ -69,8 +71,8 @@ module AppStoreInfo
|
|
69
71
|
),
|
70
72
|
|
71
73
|
'Africa, Middle East, and India' => %w(
|
72
|
-
DZ AO AM AZ BH BJ BW BF CV TD CG EG GM GH GW IN IL JO KE KW LB LR MG MW ML MR MU
|
73
|
-
NG OM QA SA SN SC SL ZA SZ ST TZ TN UG AE YE ZW
|
74
|
+
DZ AO AM AZ BH BJ BW BF CM CV TD CG EG ET GM GH GW IN IL JO KE KW LB LS LR MG MW ML MR MU
|
75
|
+
MZ NA NE NG OM QA RW SA SN SC SS SL ZA SZ ST TZ TN UG AE YE ZM ZW
|
74
76
|
),
|
75
77
|
|
76
78
|
'Latin America and the Caribbean' => %w(
|
@@ -84,7 +86,7 @@ module AppStoreInfo
|
|
84
86
|
),
|
85
87
|
|
86
88
|
'The United States and Canada' => %w(CA US)
|
87
|
-
}
|
89
|
+
}.freeze
|
88
90
|
|
89
91
|
# Find a territory by code.
|
90
92
|
#
|
data/lib/app_store_info.rb
CHANGED
@@ -5,7 +5,7 @@ require 'app_store_info/regions'
|
|
5
5
|
require 'app_store_info/genres'
|
6
6
|
|
7
7
|
module AppStoreInfo
|
8
|
-
DEFAULT_REGION = 'us'
|
8
|
+
DEFAULT_REGION = 'us'.freeze
|
9
9
|
|
10
10
|
def self.read(id, region = DEFAULT_REGION)
|
11
11
|
# The region can be wrong because of the multiple app store formats (and our way of getting) it
|
@@ -20,7 +20,7 @@ module AppStoreInfo
|
|
20
20
|
def self.read_url(url)
|
21
21
|
match = url.match(%r{\Ahttps://itunes.apple.com/(\w+)/.+/?id=?([\d]+)})
|
22
22
|
|
23
|
-
|
23
|
+
raise InvalidURLError, 'Invalid App Store URL' unless match
|
24
24
|
|
25
25
|
region = match.captures.first
|
26
26
|
id = match.captures.last
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_store_info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Otero
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -182,9 +182,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.5.2
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: App Store parser
|
189
189
|
test_files: []
|
190
|
-
has_rdoc:
|