appstore-search-api 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/appstore-search-api.rb +47 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1e933f08abdaab99dfdff2dcaf2825c976c4ecbe
|
4
|
+
data.tar.gz: 622ff54606339d03a422c9b6fefcf1efefc1d46d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c12704ddc8278ff622e050516592531358270cca257cf491dcb40526667acdbd15c3b6100510374b04e96e4f50bddca17f859bb5752ffc84dad8d827e8c870e
|
7
|
+
data.tar.gz: 3b1440d24fbcf11214f15b3ea57310608091454ad5c5864a98cb97df04f93fd828e4417787a3e0bbc1eaee59ff3015d4121fc355b11c06deabaee0cdee49fde2
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# AppStore Search API Helper
|
3
|
+
#
|
4
|
+
# last update 2016.02.04
|
5
|
+
#
|
6
|
+
# hwj4477@gmail.com
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'net/http'
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
class AppStoreSearch
|
13
|
+
|
14
|
+
APP_STORE_API = "https://itunes.apple.com/lookup"
|
15
|
+
|
16
|
+
attr_accessor :title, :icon, :url
|
17
|
+
|
18
|
+
def request_app_info(app_id)
|
19
|
+
|
20
|
+
param = Hash.new
|
21
|
+
param["id"] = app_id
|
22
|
+
|
23
|
+
uri = URI.parse(APP_STORE_API)
|
24
|
+
uri.query = URI.encode_www_form(param)
|
25
|
+
|
26
|
+
response = Net::HTTP.get_response(uri)
|
27
|
+
|
28
|
+
result = JSON.parse(response.body)
|
29
|
+
|
30
|
+
if result["resultCount"] == 0
|
31
|
+
|
32
|
+
yield false
|
33
|
+
return
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
app_info = result["results"][0]
|
38
|
+
|
39
|
+
self.title = app_info["trackCensoredName"]
|
40
|
+
self.icon = app_info["artworkUrl60"]
|
41
|
+
self.url = app_info["trackViewUrl"]
|
42
|
+
|
43
|
+
yield true
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: appstore-search-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- hwj4477
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-04 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: AppStore Search API Helper
|
14
|
+
email: hwj4477@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib//appstore-search-api.rb
|
20
|
+
homepage: http://github.com/hwj4477/appstore-search-api
|
21
|
+
licenses:
|
22
|
+
- hwj4477
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.4.8
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: AppStore Search API
|
44
|
+
test_files: []
|