Class: AppStore::Application
Overview
Represents an application in the AppStore.
Available attributes:
-
average_user_rating: average rating from all user_reviews. -
user_rating_count: user_reviews count. -
release_date: release date on the AppStore for the application. -
description: application description. -
screenshots: array of Image objects for screenshots. -
item_id: application id. -
version: application version. -
company: a Company object, the one which submit the application. -
title: application title. -
price: price of the application on the Apple AppStore. -
icon: Image object of the application icon. -
size: size of the application in byte.
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 # => [#<AppStore::Image:0x1017683e0 @width=320, @ra ...
@fontpicker.screenshots.first.url # => "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. # => 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."
Constant Summary collapse
- ApplicationURL =
"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware"
Instance Attribute Summary collapse
-
#artworks ⇒ Object
readonly
Returns the value of attribute artworks.
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#icon ⇒ Object
readonly
Returns the value of attribute icon.
-
#icon_thumbnail ⇒ Object
readonly
Returns the value of attribute icon_thumbnail.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#screenshots ⇒ Object
readonly
Returns the value of attribute screenshots.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Attributes inherited from Base
Class Method Summary collapse
-
.find_by_id(id, options = {}) ⇒ Object
Search an Application by its
id. -
.search(text, options = {}) ⇒ Object
Search an Application by a
text.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Application
constructor
A new instance of Application.
- #itunes_url ⇒ Object
-
#user_reviews ⇒ Object
Returns an AppStore::List of UserReview objects.
Methods included from Helper::Plist
Constructor Details
#initialize(attrs = {}) ⇒ Application
Returns a new instance of Application.
84 85 86 87 |
# File 'lib/app_store/application.rb', line 84 def initialize(attrs = {}) @screenshots ||= [] super end |
Instance Attribute Details
#artworks ⇒ Object (readonly)
Returns the value of attribute artworks.
55 56 57 |
# File 'lib/app_store/application.rb', line 55 def artworks @artworks end |
#company ⇒ Object (readonly)
Returns the value of attribute company.
55 56 57 |
# File 'lib/app_store/application.rb', line 55 def company @company end |
#icon ⇒ Object (readonly)
Returns the value of attribute icon.
55 56 57 |
# File 'lib/app_store/application.rb', line 55 def icon @icon end |
#icon_thumbnail ⇒ Object (readonly)
Returns the value of attribute icon_thumbnail.
55 56 57 |
# File 'lib/app_store/application.rb', line 55 def icon_thumbnail @icon_thumbnail end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
55 56 57 |
# File 'lib/app_store/application.rb', line 55 def price @price end |
#screenshots ⇒ Object (readonly)
Returns the value of attribute screenshots.
55 56 57 |
# File 'lib/app_store/application.rb', line 55 def screenshots @screenshots end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
55 56 57 |
# File 'lib/app_store/application.rb', line 55 def size @size end |
Class Method Details
.find_by_id(id, options = {}) ⇒ Object
Search an Application by its id. Accepts only one id and returns an Application instance.
69 70 71 72 73 74 |
# File 'lib/app_store/application.rb', line 69 def self.find_by_id(id, = {}) client = [:client] || AppStore::Client.new plist = client.get(AppStore::Client::ApplicationURL, :id => id) # TODO : Check if everything was right before instancianting new :client => client, :plist => plist['item-metadata'] end |
.search(text, options = {}) ⇒ Object
Search an Application by a text. Returns an array with matching application or an empty array if no result found.
78 79 80 81 82 |
# File 'lib/app_store/application.rb', line 78 def self.search(text, = {}) client = [:client] || AppStore::Client.new plist = client.get(AppStore::Client::SearchURL, :media => 'software', :term => text) AppStore::List.new :client => client, :list => plist['items'] end |
Instance Method Details
#itunes_url ⇒ Object
98 99 100 |
# File 'lib/app_store/application.rb', line 98 def itunes_url "#{ApplicationURL}?id=#{item_id}" end |
#user_reviews ⇒ Object
Returns an AppStore::List of UserReview objects.
90 91 92 93 94 95 96 |
# File 'lib/app_store/application.rb', line 90 def user_reviews if @user_reviews.nil? plist = @client.get(@raw['view-user-reviews-url']) @user_reviews = AppStore::List.new(:list => plist['items']) end @user_reviews end |