app_store_lookup 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +82 -0
- data/Rakefile +2 -0
- data/app_store_lookup.gemspec +25 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/app_store_lookup.rb +112 -0
- data/lib/app_store_lookup/version.rb +3 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8b7c53ab814121193bf34268f3f39bd22c0e333c
|
4
|
+
data.tar.gz: 930040fd577f7a6f5b7796d825b194223d8369d4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 54678f752e5f55dfdc5202c06c9b52aab2a46209200902f3e9f0dd14d48d278fd7bc616af2234df7c0c2ff352a739c68c60a61dbddb5022a69ec011056c64eac
|
7
|
+
data.tar.gz: edceff2e49e775b1301ce279ff66c590a294bb379f2d75abce562769c427fc1a40d17bebe1c0fcf14e425aad67dd864112260fb5415ecc89fc4cc1c6498e06fa
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 TODO: Write your name
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# AppStoreLookup
|
2
|
+
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
gem 'app_store_lookup'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install app_store_lookup
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
You can find any app by its unique bundle ID like this:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
app = AppStoreLookup::App.find_by_bundle_id("...")
|
26
|
+
```
|
27
|
+
|
28
|
+
### Example
|
29
|
+
```ruby
|
30
|
+
twitter_app = AppStoreLookup::App.find_by_bundle_id("com.atebits.Tweetie2")
|
31
|
+
twitter_app.name #APP NAME
|
32
|
+
=> "Twitter"
|
33
|
+
twitter_app.rating.rating #OVERALL RATING
|
34
|
+
=> 3.5
|
35
|
+
twitter_app.screenshots[:iphone][0].url #FIRST IPHONE SCREENSHOT URL
|
36
|
+
=> "http://a4.mzstatic.com/us/r30/Purple18/v4/2e/6c/d6/2e6cd646-df7b-b500-dd75-2bb9cf676cd5/screen1136x1136.jpeg"
|
37
|
+
twitter_app.artwork[:a60].url #APP ICON (60x60px)
|
38
|
+
=> "http://is1.mzstatic.com/image/thumb/Purple30/v4/95/77/3c/95773c1b-6799-7edf-20ae-2738f233be33/source/60x60bb.jpg"
|
39
|
+
```
|
40
|
+
|
41
|
+
You can use any (or all :simple_smile:) of these attributes:
|
42
|
+
|
43
|
+
id [Integer]
|
44
|
+
name [String]
|
45
|
+
censored_name [String]
|
46
|
+
kind [String]
|
47
|
+
release_date [DateTime]
|
48
|
+
primary_genre [AppGenre object]
|
49
|
+
genres [AppGenre object]
|
50
|
+
price [Float]
|
51
|
+
currency [String]
|
52
|
+
version [String]
|
53
|
+
current_version_release_date [DateTime]
|
54
|
+
artist [AppArtist object]
|
55
|
+
bundle_id [String]
|
56
|
+
minimum_os_version [String]
|
57
|
+
description [String]
|
58
|
+
is_game_center_enabled [Boolean]
|
59
|
+
is_vpp_device_based_licensing_enabled [Boolean]
|
60
|
+
rating [AppRating object]
|
61
|
+
current_version_rating [AppRating object]
|
62
|
+
seller [AppSeller object]
|
63
|
+
file_size [Integer]
|
64
|
+
languages [AppLanguage]
|
65
|
+
content_advisory_rating [String]
|
66
|
+
url [String]
|
67
|
+
supported_devices [AppSupportedDevice object]
|
68
|
+
artwork [AppImage object]*
|
69
|
+
screenshots [AppImage object]**
|
70
|
+
|
71
|
+
*artwork has three image sizes [:a60, :a100, :a512]
|
72
|
+
**screenshots are divided in categories [:iphone, :ipad, :apple_tv]
|
73
|
+
|
74
|
+
## Contributing
|
75
|
+
|
76
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/MichalHlavacek/app_store_lookup.
|
77
|
+
|
78
|
+
|
79
|
+
## License
|
80
|
+
|
81
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
82
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'app_store_lookup/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "app_store_lookup"
|
8
|
+
s.version = AppStoreLookup::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Michal Hlaváček"]
|
11
|
+
s.email = ["hello@michalhlavacek.com"]
|
12
|
+
|
13
|
+
s.summary = "AppStoreLookup is a parser of app info from iTunes."
|
14
|
+
s.description = "AppStoreLookup is a parser of app info from iTunes."
|
15
|
+
s.homepage = "https://github.com/HlavacekMichal/app_store_lookup"
|
16
|
+
s.license = "MIT"
|
17
|
+
|
18
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
s.bindir = "exe"
|
20
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
s.add_development_dependency "bundler", "~> 1.11"
|
24
|
+
s.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "app_store_lookup"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
require "app_store_lookup/version"
|
2
|
+
|
3
|
+
module AppStoreLookup
|
4
|
+
class App
|
5
|
+
attr_reader :id, :name, :censored_name, :kind, :release_date, :primary_genre, :genres, :price, :currency, :version, :current_version_release_date, :artist, :bundle_id, :minimum_os_version, :description,
|
6
|
+
:is_game_center_enabled, :is_vpp_device_based_licensing_enabled, :rating, :current_version_rating, :seller, :file_size, :languages, :content_advisory_rating, :url, :supported_devices, :artwork, :screenshots
|
7
|
+
|
8
|
+
def initialize(attributes = {})
|
9
|
+
require 'date'
|
10
|
+
@id = attributes['trackId'].to_i
|
11
|
+
@name = attributes['trackName']
|
12
|
+
@censored_name = attributes['trackCensoredName']
|
13
|
+
@kind = attributes['kind']
|
14
|
+
@release_date = DateTime.parse(attributes['releaseDate'])
|
15
|
+
@primary_genre = AppStoreLookup::AppGenre.new(:name => attributes['primaryGenreName'], :id => attributes['primaryGenreId'])
|
16
|
+
@genres = attributes['genres'].each_with_index.map {|genre,i| AppStoreLookup::AppGenre.new(:name => genre, :id => attributes['genreIds'][i])}
|
17
|
+
@price = attributes['price'].to_f
|
18
|
+
@currency = attributes['currency']
|
19
|
+
@version = attributes['version']
|
20
|
+
@current_version_release_date = DateTime.parse(attributes['currentVersionReleaseDate'])
|
21
|
+
@artist = AppStoreLookup::AppArtist.new(:name => attributes['artistName'], :id => attributes['artistId'], :url => attributes['artistViewUrl'])
|
22
|
+
@bundle_id = attributes['bundleId']
|
23
|
+
@minimum_os_version = attributes['minimum_os_version']
|
24
|
+
@description = attributes['description']
|
25
|
+
@is_vpp_device_based_licensing_enabled = attributes['isVppDeviceBasedLicensingEnabled']
|
26
|
+
@is_game_center_enabled = attributes['is_game_center_enabled']
|
27
|
+
@rating = AppStoreLookup::AppRating.new(:count => attributes['userRatingCount'], :rating => attributes['averageUserRating'])
|
28
|
+
@current_version_rating = AppStoreLookup::AppRating.new(:count => attributes['userRatingCountForCurrentVersion'], :rating => attributes['averageUserRatingForCurrentVersion'])
|
29
|
+
@seller = AppStoreLookup::AppSeller.new(:name => attributes['sellerName'], :url => attributes['sellerUrl'])
|
30
|
+
@file_size = attributes['fileSizeBytes'].to_i
|
31
|
+
@languages = attributes['languageCodesISO2A'].map {|l| AppStoreLookup::AppLanguage.new(:code => l)}
|
32
|
+
@content_advisory_rating = attributes['contentAdvisoryRating']
|
33
|
+
@url = attributes['trackViewUrl']
|
34
|
+
@supported_devices = attributes['supportedDevices'].map {|sd| AppStoreLookup::AppSupportedDevices.new(:name => sd)}
|
35
|
+
@artwork = { :a60 => AppStoreLookup::AppImage.new(:url => attributes['artworkUrl60']), :a100 => AppStoreLookup::AppImage.new(:url => attributes['artworkUrl100']), :a512 => AppStoreLookup::AppImage.new(:url => attributes['artworkUrl512'])}
|
36
|
+
@screenshots = {:iphone => attributes['screenshotUrls'].map {|s| AppStoreLookup::AppImage.new(:url => s)}, :ipad => attributes['ipadScreenshotUrls'].map {|s| AppStoreLookup::AppImage.new(:url => s)}, :apple_tv => attributes['appletvScreenshotUrls'].map {|s| AppStoreLookup::AppImage.new(:url => s)}}
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.find_by_bundle_id(bundle_id)
|
40
|
+
require 'net/http'
|
41
|
+
require 'uri'
|
42
|
+
require 'json'
|
43
|
+
listing = JSON.parse(Net::HTTP.get(URI.parse("https://itunes.apple.com/lookup?bundleId="+bundle_id)))['results']
|
44
|
+
unless listing.empty?
|
45
|
+
AppStoreLookup::App.new(listing[0])
|
46
|
+
else
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class AppImage
|
53
|
+
attr_reader :url
|
54
|
+
|
55
|
+
def initialize(attributes = {})
|
56
|
+
@url = attributes[:url]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class AppSupportedDevices
|
61
|
+
attr_reader :name
|
62
|
+
|
63
|
+
def initialize(attributes = {})
|
64
|
+
@name = attributes[:name]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class AppGenre
|
69
|
+
attr_reader :id, :name
|
70
|
+
|
71
|
+
def initialize(attributes = {})
|
72
|
+
@name = attributes[:name]
|
73
|
+
@id = attributes[:id].to_i
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class AppArtist
|
78
|
+
attr_reader :id, :name, :url
|
79
|
+
|
80
|
+
def initialize(attributes = {})
|
81
|
+
@name = attributes[:name]
|
82
|
+
@id = attributes[:id]
|
83
|
+
@url = attributes[:url]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
class AppSeller
|
88
|
+
attr_reader :name, :url
|
89
|
+
|
90
|
+
def initialize(attributes = {})
|
91
|
+
@name = attributes[:name]
|
92
|
+
@url = attributes[:url]
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class AppRating
|
97
|
+
attr_reader :count, :rating
|
98
|
+
|
99
|
+
def initialize(attributes = {})
|
100
|
+
@count = attributes[:count]
|
101
|
+
@rating = attributes[:rating]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class AppLanguage
|
106
|
+
attr_reader :code
|
107
|
+
|
108
|
+
def initialize(attributes = {})
|
109
|
+
@code = attributes[:code]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: app_store_lookup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michal Hlaváček
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: AppStoreLookup is a parser of app info from iTunes.
|
42
|
+
email:
|
43
|
+
- hello@michalhlavacek.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- app_store_lookup.gemspec
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- lib/app_store_lookup.rb
|
57
|
+
- lib/app_store_lookup/version.rb
|
58
|
+
homepage: https://github.com/HlavacekMichal/app_store_lookup
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.5.1
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: AppStoreLookup is a parser of app info from iTunes.
|
82
|
+
test_files: []
|