eq_appstore_info 2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 52a79e242a47e080a90b1ddb1c046d2a7505a8e20b4ded4d6f54913586ce57db
4
+ data.tar.gz: 5931fac03f00a6bd2d68635e7f3f71524e81f63bbbcc9cf8226ca0c62d75d900
5
+ SHA512:
6
+ metadata.gz: 61c6181d53ffda6ffda46a7b8a6b8ed3ba991cbbcc2c7b0e53376ddda4a0e564c5464aaa7373f628d8cc2d316cebd4bdcdd3154f0a3b9276c10ddbe9e24cda5f
7
+ data.tar.gz: e190ea26b4e64caf9ae2bd911568cc30d9af514b83f99b0a567e1b1cbf2eeb4f15c842483f49839eec74e6c851c8df7ebe98f86b4862e1716ac60fe9fb4b9350
@@ -0,0 +1,10 @@
1
+ *.gem
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,35 @@
1
+ require: rubocop-rspec
2
+
3
+ Metrics/LineLength:
4
+ Max: 100
5
+
6
+ Style/Documentation:
7
+ Enabled: false
8
+
9
+ Metrics/BlockLength:
10
+ Exclude:
11
+ - 'spec/**/*_spec.rb'
12
+
13
+ Style/NumericLiterals:
14
+ Enabled: false
15
+
16
+ Style/FrozenStringLiteralComment:
17
+ Enabled: false
18
+
19
+ RSpec/MultipleExpectations:
20
+ Enabled: false
21
+
22
+ RSpec/ExampleLength:
23
+ Enabled: false
24
+
25
+ # I hate this stupid rule, that makes tests hard to understand
26
+ RSpec/PredicateMatcher:
27
+ Enabled: false
28
+
29
+ # We still need the # coding utf-8 comment for older ruby versions
30
+ Style/Encoding:
31
+ Enabled: false
32
+
33
+ # Although using .match? makes sense for ruby 2.4+ in previous versions it doesn't work
34
+ Performance/RegexpMatch:
35
+ Enabled: false
@@ -0,0 +1 @@
1
+ 2.7.1
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ - 2.3.0
5
+ - 2.3.3
6
+ - 2.4.2
7
+ - 2.7.1
8
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in appstore_info.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Ricardo Otero
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,91 @@
1
+ [![Build Status](https://travis-ci.org/equinux/appstore_info.svg)](https://travis-ci.org/equinux/appstore_info) [![Dependency Status](https://gemnasium.com/equinux/appstore_info.svg)](https://gemnasium.com/equinux/appstore_info)
2
+
3
+ # AppStoreInfo
4
+
5
+ Get details about any app in the Apple App Store. This gem uses iTunes lookup method to get information about apps. (i.e. https://itunes.apple.com/us/lookup?id=343200656).
6
+
7
+ Compatible with ruby >= 1.9.3
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'app_store_info'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install appstore_info
24
+
25
+ ## Usage
26
+
27
+ You first have to read the app details, using the store URL or directly with the ID:
28
+
29
+ ```ruby
30
+ app = AppStoreInfo.read_url('https://itunes.apple.com/gb/app/angry-birds/id343200656?mt=8')
31
+ app = AppStoreInfo.read(343200656)
32
+ app = AppStoreInfo.read(343200656, 'gb') # You can give a particular region or it will use 'us'
33
+ ```
34
+
35
+ Then you have some attributes that can be read easily:
36
+
37
+ ```ruby
38
+ app.id # => 343200656
39
+ app.name # => "Angry Birds"
40
+ app.url # => "http://www.angrybirds.com/"
41
+ app.average_user_rating # => 4.5
42
+ app.user_rating_count # => 222131
43
+ app.genre_ids # => ["6014", "7003", "6016", "7001"]
44
+ app.price # => 0.79
45
+ app.currency # => "GBP"
46
+ app.supported_devices # => ["iPhone-3GS", "iPhone4", "iPodTouchFourthGen", ...]
47
+ app.company # => "Rovio Entertainment Ltd"
48
+ app.description # => "Use the unique powers of the Angry Birds to destroy ...
49
+ app.minimum_os_version # => "6.0"
50
+ app.features # => ["gameCenter"]
51
+ ```
52
+
53
+ You can also check if the app is Universal:
54
+
55
+ ```ruby
56
+ app.universal? # => false
57
+ ```
58
+
59
+ Last, you can check the details about the latest version of the app:
60
+
61
+ ```ruby
62
+ current_version = app.current_version
63
+
64
+ current_version.average_user_rating # => 4.0
65
+ current_version.user_rating_count # => 191
66
+ current_version.number # => "5.2.0"
67
+ current_version.release_notes # => "We popped some pesky bugs!"
68
+ ```
69
+
70
+ If you need to get the genre names there's an helper method for that:
71
+
72
+ ```ruby
73
+ app.genre_names # => ["Games", "Action", "Arcade", "Entertainment"]
74
+ ```
75
+
76
+ Keep in mind that the information can be localized if you request for a particular region
77
+ information. Ratings, currency, price etc. can change.
78
+
79
+ ## Development
80
+
81
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
82
+
83
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
84
+
85
+ ## Contributing
86
+
87
+ Bug reports and pull requests are welcome on GitHub at https://github.com/equinux/appstore_info.
88
+
89
+ ## License
90
+
91
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -0,0 +1,32 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'appstore_info/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'eq_appstore_info'
8
+ spec.version = AppStoreInfo::VERSION
9
+ spec.authors = ['Ricardo Otero', 'Maximilian Szengel']
10
+ spec.email = ['oterosantos@gmail.com', 'szengel@equinux.com']
11
+
12
+ spec.summary = 'App Store parser'
13
+ spec.description = 'Get details about any app in the Apple App Store'
14
+ spec.homepage = 'https://github.com/equinux/appstore_info'
15
+ spec.license = 'MIT'
16
+
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
21
+
22
+ spec.add_dependency 'faraday', '~> 1.0'
23
+
24
+ spec.add_development_dependency 'bundler', '~> 2.1'
25
+ spec.add_development_dependency 'pry', '~> 0.10'
26
+ spec.add_development_dependency 'rake', '~> 13.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.3'
28
+ spec.add_development_dependency 'rubocop', '~> 0.49'
29
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.3'
30
+ spec.add_development_dependency 'vcr', '~> 6.0'
31
+ spec.add_development_dependency 'webmock', '~> 3.9'
32
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'appstore_info'
5
+
6
+ require 'pry'
7
+ Pry.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,40 @@
1
+ require 'appstore_info/version'
2
+ require 'appstore_info/api'
3
+ require 'appstore_info/app'
4
+ require 'appstore_info/regions'
5
+ require 'appstore_info/genres'
6
+
7
+ module AppStoreInfo
8
+ DEFAULT_REGION = 'us'.freeze
9
+
10
+ def self.read(id, region = DEFAULT_REGION)
11
+ # The region can be wrong because of the multiple app store formats (and our way of getting) it
12
+ # from the URL. If that's the case then just fallback to 'us'.
13
+ region = DEFAULT_REGION unless Regions.find(region)
14
+
15
+ json = AppStoreInfo::API.new(id, region).parse
16
+
17
+ App.new(json)
18
+ end
19
+
20
+ def self.read_url(url)
21
+ match = url.match(%r{\Ahttps://itunes.apple.com/(\w+)/.+/?id=?([\d]+)})
22
+
23
+ raise InvalidURLError, 'Invalid App Store URL' unless match
24
+
25
+ region = match.captures.first
26
+ id = match.captures.last
27
+
28
+ read(id, region)
29
+ end
30
+
31
+ class GenericError < StandardError; end
32
+
33
+ class InvalidURLError < GenericError; end
34
+
35
+ class EntryNotFound < GenericError; end
36
+
37
+ class ConnectionError < GenericError; end
38
+
39
+ class ParseError < GenericError; end
40
+ end
@@ -0,0 +1,47 @@
1
+ require 'json'
2
+ require 'faraday'
3
+
4
+ module AppStoreInfo
5
+ class API
6
+ # The URL to lookup an app. The first variable is the region (us, pt, kor, etc..) and the
7
+ # second one is the application id (i.e. 599015198).
8
+ URL_TEMPLATE = 'https://itunes.apple.com/%s/lookup?id=%s'.freeze
9
+
10
+ attr_accessor :id, :url
11
+
12
+ def initialize(id, region = AppStoreInfo::DEFAULT_REGION)
13
+ @id = id
14
+ @region = region
15
+ @url = format(URL_TEMPLATE, region, id)
16
+ end
17
+
18
+ def parse
19
+ response = Faraday.get(url)
20
+
21
+ unless response.status == 200 && response.body
22
+ raise ConnectionError, "Cound't connect to app store API"
23
+ end
24
+
25
+ parse_json(response.body)
26
+ end
27
+
28
+ private
29
+
30
+ def parse_json(body)
31
+ json = JSON.parse(body)
32
+
33
+ raise EntryNotFound, 'No results' unless json.key?('results')
34
+
35
+ json = json['results'].first
36
+
37
+ # If the JSON exists and it's a mobile app (to avoid OS X apps)
38
+ unless json && json['supportedDevices']
39
+ raise EntryNotFound, "App not found or unavailable on '#{@region}' region"
40
+ end
41
+
42
+ json
43
+ rescue JSON::ParserError => error
44
+ raise ParseError, error.message
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,53 @@
1
+ require 'appstore_info/json_accessors'
2
+ require 'ostruct'
3
+
4
+ module AppStoreInfo
5
+ class App
6
+ include AppStoreInfo::JSONAccessors
7
+
8
+ attr_reader :current_version
9
+
10
+ json_accessors id: 'trackId', name: 'trackCensoredName', url: 'sellerUrl',
11
+ average_user_rating: 'averageUserRating', user_rating_count: 'userRatingCount',
12
+ genre_ids: 'genreIds', price: 'price', currency: 'currency',
13
+ supported_devices: 'supportedDevices', company: 'artistName',
14
+ description: 'description', minimum_os_version: 'minimumOsVersion',
15
+ features: 'features', languages: 'languageCodesISO2A',
16
+ app_store_url: 'trackViewUrl'
17
+
18
+ def initialize(json)
19
+ read_json_accessors(json)
20
+
21
+ @artwork = json['artworkUrl512'] || json['artworkUrl100']
22
+
23
+ @current_version = read_current_version(json)
24
+ end
25
+
26
+ def universal?
27
+ @features.include?('iosUniversal')
28
+ end
29
+
30
+ def genre_names
31
+ @genre_ids.map { |genre| AppStoreInfo::GENRES[genre.to_i] }
32
+ end
33
+
34
+ def store_icon_url
35
+ return unless @artwork
36
+
37
+ @artwork =~ /\.(png|jpg|gif)\z/ ? @artwork : nil
38
+ end
39
+
40
+ private
41
+
42
+ def read_current_version(json)
43
+ version = OpenStruct.new
44
+
45
+ version.average_user_rating = json['averageUserRatingForCurrentVersion']
46
+ version.user_rating_count = json['userRatingCountForCurrentVersion']
47
+ version.number = json['version']
48
+ version.release_notes = json['releaseNotes']
49
+
50
+ version
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,77 @@
1
+ module AppStoreInfo
2
+ GENRES = {
3
+ 6018 => 'Books',
4
+ 6000 => 'Business',
5
+ 6022 => 'Catalogs',
6
+ 6017 => 'Education',
7
+ 6016 => 'Entertainment',
8
+ 6015 => 'Finance',
9
+ 6023 => 'Food & Drink',
10
+ 6014 => 'Games',
11
+ 6013 => 'Health & Fitness',
12
+ 6012 => 'Lifestyle',
13
+ 6020 => 'Medical',
14
+ 6011 => 'Music',
15
+ 6010 => 'Navigation',
16
+ 6009 => 'News',
17
+ 6021 => 'Magazines & Newspapers',
18
+ 6008 => 'Photo & Video',
19
+ 6007 => 'Productivity',
20
+ 6006 => 'Reference',
21
+ 6005 => 'Social Networking',
22
+ 6004 => 'Sports',
23
+ 6003 => 'Travel',
24
+ 6002 => 'Utilities',
25
+ 6001 => 'Weather',
26
+
27
+ # Games subgenres
28
+ 7001 => 'Action',
29
+ 7002 => 'Adventure',
30
+ 7003 => 'Arcade',
31
+ 7004 => 'Board',
32
+ 7005 => 'Card',
33
+ 7006 => 'Casino',
34
+ 7007 => 'Dice',
35
+ 7008 => 'Educational',
36
+ 7009 => 'Family',
37
+ 7011 => 'Music',
38
+ 7012 => 'Puzzle',
39
+ 7013 => 'Racing',
40
+ 7014 => 'Role Playing',
41
+ 7015 => 'Simulation',
42
+ 7016 => 'Sports',
43
+ 7017 => 'Strategy',
44
+ 7018 => 'Trivia',
45
+ 7019 => 'Word',
46
+
47
+ # Magazines & Newspapers subgenres
48
+ 13007 => 'Arts & Photography',
49
+ 13006 => 'Automotive',
50
+ 13008 => 'Brides & Weddings',
51
+ 13009 => 'Business & Investing',
52
+ 13010 => "Children's Magazines",
53
+ 13011 => 'Computers & Internet',
54
+ 13012 => 'Cooking, Food & Drink',
55
+ 13013 => 'Crafts & Hobbies',
56
+ 13014 => 'Electronics & Audio',
57
+ 13015 => 'Entertainment',
58
+ 13002 => 'Fashion & Style',
59
+ 13017 => 'Health, Mind & Body',
60
+ 13018 => 'History',
61
+ 13003 => 'Home & Garden',
62
+ 13019 => 'Literary Magazines & Journals',
63
+ 13020 => "Men's Interest",
64
+ 13021 => 'Movies & Music',
65
+ 13001 => 'News & Politics',
66
+ 13004 => 'Outdoors & Nature',
67
+ 13023 => 'Parenting & Family',
68
+ 13024 => 'Pets',
69
+ 13025 => 'Professional & Trade',
70
+ 13026 => 'Regional News',
71
+ 13027 => 'Science',
72
+ 13005 => 'Sports & Leisure',
73
+ 13028 => 'Teens',
74
+ 13029 => 'Travel & Regional',
75
+ 13030 => "Women's Interest"
76
+ }.freeze
77
+ end
@@ -0,0 +1,25 @@
1
+ module AppStoreInfo
2
+ module JSONAccessors
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ end
6
+
7
+ def read_json_accessors(json)
8
+ self.class.accessors.each do |field, json_field|
9
+ instance_variable_set("@#{field}", json[json_field])
10
+ end
11
+ end
12
+
13
+ module ClassMethods
14
+ def json_accessors(json_accessors)
15
+ json_accessors.map { |field, _| attr_reader field }
16
+
17
+ @_json_accessors = json_accessors
18
+ end
19
+
20
+ def accessors
21
+ @_json_accessors
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,108 @@
1
+ module AppStoreInfo
2
+ # Regions maps the App Store regions in different format.
3
+ #
4
+ # AppStoreInfo::Regions.full_list will return a list of countries in the following format:
5
+ # [{"Europe"=>
6
+ # [{:code=>"AL", :name=>"Albania"},
7
+ # {:code=>"AT", :name=>"Austria"},
8
+ # {:code=>"BY", :name=>"Belarus"},...
9
+ #
10
+ # AppStoreInfo::Regions::territory_list is a list of countries available on App Store:
11
+ #
12
+ # {"AE"=>"United Arab Emirates",
13
+ # "AG"=>"Antigua and Barbuda",
14
+ # "AI"=>"Anguilla",
15
+ # "AL"=>"Albania",
16
+ # "AM"=>"Armenia",...
17
+ class Regions
18
+ # All the available regions (taken from https://developer.apple.com/library/ios/documentation/
19
+ # LanguagesUtilities/Conceptual/iTunesConnect_Guide/Appendices/AppStoreTerritories.html
20
+ TERRITORIES = {
21
+ 'AE' => 'United Arab Emirates',
22
+ 'AG' => 'Antigua and Barbuda', 'AI' => 'Anguilla', 'AL' => 'Albania', 'AM' => 'Armenia',
23
+ 'AO' => 'Angola', 'AR' => 'Argentina', 'AT' => 'Austria', 'AU' => 'Australia',
24
+ 'AZ' => 'Azerbaijan', 'BB' => 'Barbados', 'BE' => 'Belgium', 'BF' => 'Burkina Faso',
25
+ 'BG' => 'Bulgaria', 'BH' => 'Bahrain', 'BJ' => 'Benin', 'BM' => 'Bermuda',
26
+ 'BN' => 'Brunei Darussalam', 'BO' => 'Bolivia', 'BR' => 'Brazil', 'BS' => 'Bahamas',
27
+ 'BT' => 'Bhutan', 'BW' => 'Botswana', 'BY' => 'Belarus', 'BZ' => 'Belize', 'CA' => 'Canada',
28
+ 'CG' => 'Republic Of Congo', 'CH' => 'Switzerland', 'CL' => 'Chile', 'CM' => 'Cameroon',
29
+ 'CN' => 'China', 'CO' => 'Colombia', 'CR' => 'Costa Rica', 'CV' => 'Cape Verde',
30
+ 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'DE' => 'Germany', 'DK' => 'Denmark',
31
+ 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'DZ' => 'Algeria', 'EC' => 'Ecuador',
32
+ 'EE' => 'Estonia', 'EG' => 'Egypt', 'ES' => 'Spain', 'ET' => 'Ethiopia', 'FI' => 'Finland',
33
+ 'FJ' => 'Fiji', 'FM' => 'Federated States Of Micronesia', 'FR' => 'France',
34
+ 'GB' => 'United Kingdom', 'GD' => 'Grenada', 'GH' => 'Ghana', 'GM' => 'Gambia',
35
+ 'GR' => 'Greece', 'GT' => 'Guatemala', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana',
36
+ 'HK' => 'Hong Kong', 'HN' => 'Honduras', 'HR' => 'Croatia', 'HU' => 'Hungary',
37
+ 'ID' => 'Indonesia', 'IE' => 'Ireland', 'IL' => 'Israel', 'IN' => 'India', 'IS' => 'Iceland',
38
+ 'IT' => 'Italy', 'IQ' => 'Iraq', 'JM' => 'Jamaica',
39
+ 'JO' => 'Jordan', 'JP' => 'Japan', 'KE' => 'Kenya', 'KG' => 'Kyrgyzstan', 'KH' => 'Cambodia',
40
+ 'KN' => 'St. Kitts and Nevis', 'KR' => 'Republic Of Korea', 'KW' => 'Kuwait',
41
+ 'KY' => 'Cayman Islands', 'KZ' => 'Kazakhstan', 'LA' => "Lao People's Democratic Republic",
42
+ 'LB' => 'Lebanon', 'LC' => 'Santa Lucia', 'LK' => 'Sri Lanka', 'LR' => 'Liberia',
43
+ 'LS' => 'Lesotho', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'LV' => 'Latvia',
44
+ 'MD' => 'Republic Of Moldova', 'MG' => 'Madagascar', 'MK' => 'Macedonia', 'ML' => 'Mali',
45
+ 'MM' => 'Myanmar', 'MN' => 'Mongolia', 'MO' => 'Macau', 'MR' => 'Mauritania',
46
+ 'MS' => 'Montserrat', 'MT' => 'Malta', 'MU' => 'Mauritius', 'MW' => 'Malawi',
47
+ 'MX' => 'Mexico', 'MY' => 'Malaysia', 'MZ' => 'Mozambique', 'NA' => 'Namibia',
48
+ 'NE' => 'Niger', 'NG' => 'Nigeria', 'NI' => 'Nicaragua', 'NL' => 'Netherlands',
49
+ 'NO' => 'Norway', 'NP' => 'Nepal', 'NZ' => 'New Zealand', 'OM' => 'Oman', 'PA' => 'Panama',
50
+ 'PE' => 'Peru', 'PG' => 'Papua New Guinea', 'PH' => 'Philippines', 'PK' => 'Pakistan',
51
+ 'PL' => 'Poland', 'PS' => 'Palestinian Territory', 'PT' => 'Portugal', 'PW' => 'Palau',
52
+ 'PY' => 'Paraguay', 'QA' => 'Qatar', 'RO' => 'Romania', 'RU' => 'Russia', 'RW' => 'Rwanda',
53
+ 'SA' => 'Saudi Arabia', 'SB' => 'Solomon Islands', 'SC' => 'Seychelles', 'SE' => 'Sweden',
54
+ 'SG' => 'Singapore', 'SI' => 'Slovenia', 'SK' => 'Slovakia', 'SL' => 'Sierra Leone',
55
+ 'SN' => 'Senegal', 'SR' => 'Suriname', 'SS' => 'South Sudan',
56
+ 'ST' => 'Sao Tome and Principe', 'SV' => 'El Salvador', 'SZ' => 'Swaziland',
57
+ 'TC' => 'Turks and Caicos', 'TD' => 'Chad', 'TH' => 'Thailand', 'TJ' => 'Tajikistan',
58
+ 'TM' => 'Turkmenistan', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TT' => 'Trinidad and Tobago',
59
+ 'TW' => 'Taiwan', 'TZ' => 'Tanzania', 'UA' => 'Ukraine', 'UG' => 'Uganda',
60
+ 'US' => 'United States', 'UY' => 'Uruguay', 'UZ' => 'Uzbekistan',
61
+ 'VC' => 'St. Vincent and The Grenadines', 'VE' => 'Venezuela',
62
+ 'VG' => 'British Virgin Islands', 'VN' => 'Vietnam', 'YE' => 'Yemen',
63
+ 'ZA' => 'South Africa', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe'
64
+ }.freeze
65
+
66
+ REGIONS = {
67
+ 'Europe' => %w[
68
+ AL AT BY BE BG HR CY CZ DK EE FI FR DE GR HU IS IE IT LV LT LU MK MT MD NL NO PL PT RO RU
69
+ SK SI ES SE CH TR UA GB
70
+ ],
71
+
72
+ 'Africa, Middle East, and India' => %w[
73
+ DZ AO AM AZ BH BJ BW BF CM CV TD CG EG ET GM GH GW IN IL IQ JO KE KW LB LS LR MG MW ML MR MU
74
+ MZ NA NE NG OM PS QA RW SA SN SC SS SL ZA SZ ST TZ TN UG AE YE ZM ZW
75
+ ],
76
+
77
+ 'Latin America and the Caribbean' => %w[
78
+ AI AG AR BS BB BZ BM BO BR KY CL CO CR DM DO EC SV GD GT GY HN JM MX MS NI PA PY PE LC KN
79
+ VC SR TT TC UY VE VG
80
+ ],
81
+
82
+ 'Asia Pacific' => %w[
83
+ AU BT BN KH CN FJ HK ID JP KZ KR KG LA MO MY FM MM MN NP NZ PK PW PG PH SG SB LK TW TJ TH TM
84
+ UZ VN
85
+ ],
86
+
87
+ 'The United States and Canada' => %w[CA US]
88
+ }.freeze
89
+
90
+ # Find a territory by code.
91
+ #
92
+ # AppStoreInfo::Regions.find('PT')
93
+ # # => "Portugal"
94
+ def self.find(code)
95
+ territory_list[code.upcase]
96
+ end
97
+
98
+ def self.full_list
99
+ REGIONS.map do |region|
100
+ { region.first => region.last.map { |code| { code: code, name: TERRITORIES[code] } } }
101
+ end
102
+ end
103
+
104
+ def self.territory_list
105
+ TERRITORIES
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,3 @@
1
+ module AppStoreInfo
2
+ VERSION = '2.0'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,190 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eq_appstore_info
3
+ version: !ruby/object:Gem::Version
4
+ version: '2.0'
5
+ platform: ruby
6
+ authors:
7
+ - Ricardo Otero
8
+ - Maximilian Szengel
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2020-10-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '2.1'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '2.1'
42
+ - !ruby/object:Gem::Dependency
43
+ name: pry
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '0.10'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.10'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '13.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '13.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '3.3'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '3.3'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rubocop
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '0.49'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '0.49'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rubocop-rspec
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '1.3'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '1.3'
112
+ - !ruby/object:Gem::Dependency
113
+ name: vcr
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '6.0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '6.0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: webmock
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '3.9'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '3.9'
140
+ description: Get details about any app in the Apple App Store
141
+ email:
142
+ - oterosantos@gmail.com
143
+ - szengel@equinux.com
144
+ executables: []
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - ".gitignore"
149
+ - ".rspec"
150
+ - ".rubocop.yml"
151
+ - ".ruby-version"
152
+ - ".travis.yml"
153
+ - Gemfile
154
+ - LICENSE.txt
155
+ - README.md
156
+ - Rakefile
157
+ - appstore_info.gemspec
158
+ - bin/console
159
+ - bin/setup
160
+ - lib/appstore_info.rb
161
+ - lib/appstore_info/api.rb
162
+ - lib/appstore_info/app.rb
163
+ - lib/appstore_info/genres.rb
164
+ - lib/appstore_info/json_accessors.rb
165
+ - lib/appstore_info/regions.rb
166
+ - lib/appstore_info/version.rb
167
+ homepage: https://github.com/equinux/appstore_info
168
+ licenses:
169
+ - MIT
170
+ metadata: {}
171
+ post_install_message:
172
+ rdoc_options: []
173
+ require_paths:
174
+ - lib
175
+ required_ruby_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ requirements: []
186
+ rubygems_version: 3.1.2
187
+ signing_key:
188
+ specification_version: 4
189
+ summary: App Store parser
190
+ test_files: []