Class: StoreApi::AppStore::Apps::Ranking
- Inherits:
-
Object
- Object
- StoreApi::AppStore::Apps::Ranking
- Includes:
- Request
- Defined in:
- lib/store_api/app_store/apps/ranking.rb
Constant Summary
Constants included from Request
Instance Attribute Summary collapse
-
#topchart ⇒ Object
Returns the value of attribute topchart.
Instance Method Summary collapse
-
#initialize(ranking_type = nil, category_id = nil, country = nil, limit = 10, proxy = nil, header = nil) ⇒ Ranking
constructor
initialize.
Methods included from Request
Constructor Details
#initialize(ranking_type = nil, category_id = nil, country = nil, limit = 10, proxy = nil, header = nil) ⇒ Ranking
initialize
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/store_api/app_store/apps/ranking.rb', line 19 def initialize(ranking_type=nil, category_id=nil, country=nil, limit=10, proxy=nil, header=nil) if category_id.nil? @@path = "/#{country}/rss/#{ranking_type}/limit=#{limit}/json" else @@path = "/#{country}/rss/#{ranking_type}/limit=#{limit}/genre=#{category_id}/json" end @topchart = [] feed_data = JSON.load(get(StoreApi::AppStore::HOST, @@path, nil, StoreApi::AppStore::HTTPS, proxy, header))['feed']['entry'] feed_data.each.with_index(1) do |entry, rank| @topchart.push({ :id => entry['id']['attributes']['im:id'], :title => entry['im:name']['label'], :bundle_id => entry['id']['attributes']['im:bundleId'], :category_id => entry['category']['attributes']['im:id'], :category => entry['category']['attributes']['label'], :cover_image => entry['im:image'][0]['label'], :price => entry['im:price']['attributes']['amount'], :developer => entry['im:artist']['label'], :release_date => entry['im:releaseDate']['label'], :rank => rank }) end end |
Instance Attribute Details
#topchart ⇒ Object
Returns the value of attribute topchart.
9 10 11 |
# File 'lib/store_api/app_store/apps/ranking.rb', line 9 def topchart @topchart end |