= AppStore == DESCRIPTION AppStore is an unofficial implementation of the Apple AppStore API. It provides way to search for applications, navigate through categories. == SYNOPSIS === Examples * Simple search @applications = AppStore::Application.search('upnp') @applications.class # => Array @applications.length # => 8 @applications.first.title # => "PlugPlayer" @applications.first.price # => 4.99 * Find an application by id @fontpicker = AppStore::Application.find_by_id(327076783) @fontpicker.class # => AppStore::Application @fontpicker.title # => "FontPicker" @fontpicker.price # => 0.0 @fontpicker.company.title # => "Etienne Segonzac" * Medias @fontpicker.screenshots # => [# "http://a1.phobos.apple.com/us/r1000/017/Purple/c4/99/6d/mzl.jtoxfers.480x480-75.jpg" @fontpicker.icon.url # => "http://a1.phobos.apple.com/us/r1000/026/Purple/39/40/54/mzl.yrrhymuu.100x100-75.jpg" * User reviews @remote = AppStore::Application.find_by_id(284417350) @remote.title # => "Remote" @remote.user_reviews.length # => 10 @review = @remote.user_reviews.first @review.user_name # => "Ebolavoodoo on Aug 27, 2009" @review.average_user_rating # => 1.0 @review.text # => "Simply amazing. My new favorite app. Instantly responds. Easy to navigate and control. For those who say it doesn't work. Stinks to be you." * Categories # Fetch featured categories @categories = AppStore::Category.featured @categories.class # => Array @categories.length # => 20 # Use category @category = @categories.first @category.title # => "Games" @category.item_count # => 1573 # Category by id @category = AppStore::Category.find_by_id(6014) @category.title # => "Games" # Iterate through subcategories and applications # This example will display all categories with all applications available in the current AppStore def go_deeper(category) puts "Category #{category.title}" category.items.each do |item| if item.is_a?(AppStore::Category) go_deeper item else puts " => #{item.title} has id #{item.item_id}" end end end AppStore::Category.featured.each {|category| go_deeper category} === List Every list elements returned by the Apple AppStore are limited to 25 elements. An additional element is provided at the end of the list to fetch the next elements. AppStore::List provides an abstraction to this list and allows to iterate through each element like a traditional enumerable object. list = AppStore::Category.featured.first list = Category.featured.first.items list.count # => 23453 list.elements # => [AppStore::Category, AppStore::Category, ...] list.collect {|item| item.item_id} # => [9843509, 9028423, 8975435, 987345, ...] === Agent There are several Apple AppStore defined by their country. You will have different results (applications, comments) from different store front. You can use AppStore::Agent to ensure you make all yours calls to a specific AppStore (store front). You have a list of available store fronts in the constant StoreFronts defined in AppStore::Client. agent = AppStore::Agent.new(:store_front => :fr) agent.category.featured # => will call Category.featured with store front set to :fr agent.application.find_by_id(42) # => will call Application.find_by_id(42) with store front set to :fr agent.application.find_by_id(42, :bleh => 'yeah') # => also accepts extra arguments and merge them with store front == REQUIREMENTS * mechanize gem * plist gem == INSTALL gem install app_store == DOCUMENTATION * http://rdoc.info/projects/jakimowicz/app_store/ == TODO * use FakeMechanize to unit test each calls * handle multiple store/language == LICENSE (The MIT License) Copyright (c) 2009, Fabien Jakimowicz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.