app_store_info 1.0.0 → 1.0.1

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: b373ddd16194c0c7cc275cf7c3d8cc626ccca9b9
4
- data.tar.gz: 19751924943f11933dc977b6ce5f11c3a4e256f9
3
+ metadata.gz: 0b0050fc08b2d1862909ccab9dfddee394a735c0
4
+ data.tar.gz: 90546fd08bdb5673ffd93e3f53ae445d9474b5a4
5
5
  SHA512:
6
- metadata.gz: df93c102915029dda150226ed17f5cd74282895d58c490eb5cfecb4d6a6fc36c5a35023535be2cf5ffa8b103006a7f78b8684453f692ab1462eeb81d06c728e7
7
- data.tar.gz: 0867b3e3df2dad6d59373574a8d2aba23e0353f22eb85b537230461d98807855cf97cf7b2b5ac0c4cd774cb6e90c99679337e86a3830c41a4279ec99d008df25
6
+ metadata.gz: 89163dd9da0430aaff1e4f000aec73ce8891c337a3f50d184a8d00ddc66c0074acc37f12a5bd9d4709a706d7fdccf3527c88045ba927baeca0a3be28d4b9ae63
7
+ data.tar.gz: 112b10887926332f345c7bfc7150ac1cf13d104d3e7ea63621198e161931665ce498999ef05cdb971322bb9b4157291b83dbeba80c0496ad9d1e2f7603c80a20
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ *.gem
1
2
  /.bundle/
2
3
  /.yardoc
3
4
  /Gemfile.lock
data/.travis.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.3
4
+ - 2.0.0
3
5
  - 2.2.2
4
6
  before_install: gem install bundler -v 1.10.6
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
+ [![Build Status](https://travis-ci.org/rikas/app_store_info.svg)](https://travis-ci.org/rikas/app_store_info)
2
+
1
3
  # AppStoreInfo
2
4
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/app_store_info`. To experiment with that code, run `bin/console` for an interactive prompt.
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).
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
7
+ Compatible with ruby >= 1.9.3
6
8
 
7
9
  ## Installation
8
10
 
@@ -22,7 +24,56 @@ Or install it yourself as:
22
24
 
23
25
  ## Usage
24
26
 
25
- TODO: Write usage instructions here
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
+ ```ruby
61
+ current_version = app.current_version
62
+
63
+ current_version.average_user_rating # => 4.0
64
+ current_version.user_rating_count # => 191
65
+ current_version.number # => "5.2.0"
66
+ current_version.release_notes # => "We popped some pesky bugs!"
67
+ ```
68
+
69
+ If you need to get the genre names there's an helper method for that:
70
+ ```ruby
71
+ app.genre_names # => ["Games", "Action", "Arcade", "Entertainment"]
72
+ ```
73
+
74
+ Keep in mind that the information can be localized if you request for a particular region
75
+ information. Ratings, currency, price etc. can change.
76
+
26
77
 
27
78
  ## Development
28
79
 
@@ -32,10 +83,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
83
 
33
84
  ## Contributing
34
85
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/app_store_info.
86
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rikas/app_store_info.
36
87
 
37
88
 
38
89
  ## License
39
90
 
40
91
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
@@ -1,4 +1,5 @@
1
1
  require 'app_store_info/json_accessors'
2
+ require 'ostruct'
2
3
 
3
4
  module AppStoreInfo
4
5
  class App
@@ -6,7 +7,7 @@ module AppStoreInfo
6
7
 
7
8
  attr_reader :current_version
8
9
 
9
- json_accessors id: 'trackId', name: 'trackCensoredName', domain: 'sellerUrl',
10
+ json_accessors id: 'trackId', name: 'trackCensoredName', url: 'sellerUrl',
10
11
  average_user_rating: 'averageUserRating', user_rating_count: 'userRatingCount',
11
12
  genre_ids: 'genreIds', price: 'price', currency: 'currency',
12
13
  supported_devices: 'supportedDevices', company: 'artistName',
@@ -26,7 +27,7 @@ module AppStoreInfo
26
27
  end
27
28
 
28
29
  def genre_names
29
- @genre_ids.map { |genre| GENRES[genre.to_i] }
30
+ @genre_ids.map { |genre| AppStoreInfo::GENRES[genre.to_i] }
30
31
  end
31
32
 
32
33
  def store_icon_url
@@ -1,3 +1,4 @@
1
+ # coding: utf-8
1
2
  module AppStoreInfo
2
3
  class Regions
3
4
  # All the available regions (taken from https://developer.apple.com/library/ios/documentation/
@@ -22,7 +23,7 @@ module AppStoreInfo
22
23
  'IS' => 'Iceland', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JO' => 'Jordan', 'JP' => 'Japan',
23
24
  'KE' => 'Kenya', 'KG' => 'Kyrgyzstan', 'KH' => 'Cambodia', 'KN' => 'St. Kitts and Nevis',
24
25
  'KR' => 'Republic Of Korea', 'KW' => 'Kuwait', 'KY' => 'Cayman Islands',
25
- 'KZ' => 'Kazakstan', 'LA' => 'Lao Peoples Democratic Republic', 'LB' => 'Lebanon',
26
+ 'KZ' => 'Kazakstan', 'LA' => "Lao People's Democratic Republic", 'LB' => 'Lebanon',
26
27
  'LC' => 'St. Lucia', 'LK' => 'Sri Lanka', 'LR' => 'Liberia', 'LT' => 'Lithuania',
27
28
  'LU' => 'Luxembourg', 'LV' => 'Latvia', 'MD' => 'Republic Of Moldova', 'MG' => 'Madagascar',
28
29
  'MK' => 'Macedonia', 'ML' => 'Mali', 'MN' => 'Mongolia', 'MO' => 'Macau',
@@ -1,3 +1,3 @@
1
1
  module AppStoreInfo
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -2,6 +2,7 @@ require 'app_store_info/version'
2
2
  require 'app_store_info/api'
3
3
  require 'app_store_info/app'
4
4
  require 'app_store_info/regions'
5
+ require 'app_store_info/genres'
5
6
 
6
7
  module AppStoreInfo
7
8
  DEFAULT_REGION = 'us'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_store_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero