Class: AppStore::Client
- Inherits:
-
Object
- Object
- AppStore::Client
- Defined in:
- lib/app_store/client.rb
Overview
Client regroups all the calling and xml parsing mechanism to call the AppStore.
Constant Summary collapse
- FeaturedCategoriesURL =
Urls
"http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewFeaturedSoftwareCategories"- ApplicationURL =
"http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware"- CategoryURL =
"http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewGenre"- SearchURL =
"http://ax.search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search"- StoreFronts =
Store Front
{ :us => "143441", :fr => "143442" }
- DefaultStoreFront =
StoreFronts[:us]
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Client
constructor
A new instance of Client.
-
#iphone_get(url, params = {}) ⇒ Object
(also: #get)
Call the Apple AppStore using given
urland passingparamswith an HTTP Get method. -
#itunes_get(url, params = {}) ⇒ Object
Call the Apple AppStore using given
urland passingparamswith HTTP Get method.
Constructor Details
#initialize(args = {}) ⇒ Client
Returns a new instance of Client.
24 25 26 27 28 29 30 |
# File 'lib/app_store/client.rb', line 24 def initialize(args = {}) # About the X-Apple-Store-Front header: this is used to select which store and which language. # Format is XXXXXX-Y,Z where XXXXXX is the store number (us, french, ...), Y the language and Z the return format. # If you omit the language, the default one for the store is used. # Return format can be either "1" or "2" : "1" returns data to be directly displayed and "2" is a more structured format. @store_front = "#{args[:store_front] || DefaultStoreFront},2" end |
Instance Method Details
#iphone_get(url, params = {}) ⇒ Object Also known as: get
Call the Apple AppStore using given url and passing params with an HTTP Get method. Call is seen as a fake iPhone iTunes client.
34 35 36 |
# File 'lib/app_store/client.rb', line 34 def iphone_get(url, params = {}) Plist::parse_xml make_call_and_handle_answer(iphone_agent, url, params).body end |
#itunes_get(url, params = {}) ⇒ Object
Call the Apple AppStore using given url and passing params with HTTP Get method. Call is seen as a fake Mac OS X iTunes client.
42 43 44 |
# File 'lib/app_store/client.rb', line 42 def itunes_get(url, params = {}) Nokogiri.parse make_call_and_handle_answer(itunes_agent, url, params).body end |