class AppStoreLookup::App
Attributes
artist[R]
artwork[R]
bundle_id[R]
censored_name[R]
content_advisory_rating[R]
currency[R]
current_version_rating[R]
current_version_release_date[R]
description[R]
file_size[R]
genres[R]
id[R]
is_game_center_enabled[R]
is_vpp_device_based_licensing_enabled[R]
kind[R]
languages[R]
minimum_os_version[R]
name[R]
price[R]
primary_genre[R]
rating[R]
release_date[R]
screenshots[R]
seller[R]
supported_devices[R]
url[R]
version[R]
Public Class Methods
find_by_bundle_id(bundle_id)
click to toggle source
# File lib/app_store_lookup.rb, line 39 def self.find_by_bundle_id(bundle_id) require 'net/http' require 'uri' require 'json' listing = JSON.parse(Net::HTTP.get(URI.parse("https://itunes.apple.com/lookup?bundleId="+bundle_id)))['results'] unless listing.empty? AppStoreLookup::App.new(listing[0]) else end end
new(attributes = {})
click to toggle source
# File lib/app_store_lookup.rb, line 8 def initialize(attributes = {}) require 'date' @id = attributes['trackId'].to_i @name = attributes['trackName'] @censored_name = attributes['trackCensoredName'] @kind = attributes['kind'] @release_date = DateTime.parse(attributes['releaseDate']) @primary_genre = AppStoreLookup::AppGenre.new(:name => attributes['primaryGenreName'], :id => attributes['primaryGenreId']) @genres = attributes['genres'].each_with_index.map {|genre,i| AppStoreLookup::AppGenre.new(:name => genre, :id => attributes['genreIds'][i])} @price = attributes['price'].to_f @currency = attributes['currency'] @version = attributes['version'] @current_version_release_date = DateTime.parse(attributes['currentVersionReleaseDate']) @artist = AppStoreLookup::AppArtist.new(:name => attributes['artistName'], :id => attributes['artistId'], :url => attributes['artistViewUrl']) @bundle_id = attributes['bundleId'] @minimum_os_version = attributes['minimum_os_version'] @description = attributes['description'] @is_vpp_device_based_licensing_enabled = attributes['isVppDeviceBasedLicensingEnabled'] @is_game_center_enabled = attributes['is_game_center_enabled'] @rating = AppStoreLookup::AppRating.new(:count => attributes['userRatingCount'], :rating => attributes['averageUserRating']) @current_version_rating = AppStoreLookup::AppRating.new(:count => attributes['userRatingCountForCurrentVersion'], :rating => attributes['averageUserRatingForCurrentVersion']) @seller = AppStoreLookup::AppSeller.new(:name => attributes['sellerName'], :url => attributes['sellerUrl']) @file_size = attributes['fileSizeBytes'].to_i @languages = attributes['languageCodesISO2A'].map {|l| AppStoreLookup::AppLanguage.new(:code => l)} @content_advisory_rating = attributes['contentAdvisoryRating'] @url = attributes['trackViewUrl'] @supported_devices = attributes['supportedDevices'].map {|sd| AppStoreLookup::AppSupportedDevices.new(:name => sd)} @artwork = { :a60 => AppStoreLookup::AppImage.new(:url => attributes['artworkUrl60']), :a100 => AppStoreLookup::AppImage.new(:url => attributes['artworkUrl100']), :a512 => AppStoreLookup::AppImage.new(:url => attributes['artworkUrl512'])} @screenshots = {:iphone => attributes['screenshotUrls'].map {|s| AppStoreLookup::AppImage.new(:url => s)}, :ipad => attributes['ipadScreenshotUrls'].map {|s| AppStoreLookup::AppImage.new(:url => s)}, :apple_tv => attributes['appletvScreenshotUrls'].map {|s| AppStoreLookup::AppImage.new(:url => s)}} end