class AppStoreInfo::App

Attributes

current_version[R]

Public Class Methods

new(json) click to toggle source
# File lib/appstore_info/app.rb, line 18
def initialize(json)
  read_json_accessors(json)

  @artwork = json['artworkUrl512'] || json['artworkUrl100']

  @current_version = read_current_version(json)
end

Public Instance Methods

genre_names() click to toggle source
# File lib/appstore_info/app.rb, line 30
def genre_names
  @genre_ids.map { |genre| AppStoreInfo::GENRES[genre.to_i] }
end
store_icon_url() click to toggle source
# File lib/appstore_info/app.rb, line 34
def store_icon_url
  return unless @artwork

  @artwork =~ /\.(png|jpg|gif)\z/ ? @artwork : nil
end
universal?() click to toggle source
# File lib/appstore_info/app.rb, line 26
def universal?
  @features.include?('iosUniversal')
end

Private Instance Methods

read_current_version(json) click to toggle source
# File lib/appstore_info/app.rb, line 42
def read_current_version(json)
  version = OpenStruct.new

  version.average_user_rating = json['averageUserRatingForCurrentVersion']
  version.user_rating_count = json['userRatingCountForCurrentVersion']
  version.number = json['version']
  version.release_notes = json['releaseNotes']

  version
end