Class: AppStoreInfo::App
- Inherits:
-
Object
- Object
- AppStoreInfo::App
- Includes:
- JSONAccessors
- Defined in:
- lib/appstore_info/app.rb
Instance Attribute Summary collapse
-
#current_version ⇒ Object
readonly
Returns the value of attribute current_version.
Instance Method Summary collapse
- #genre_names ⇒ Object
-
#initialize(json) ⇒ App
constructor
A new instance of App.
- #store_icon_url ⇒ Object
- #universal? ⇒ Boolean
Methods included from JSONAccessors
included, #read_json_accessors
Constructor Details
#initialize(json) ⇒ App
Returns a new instance of App.
18 19 20 21 22 23 24 |
# 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 |
Instance Attribute Details
#current_version ⇒ Object (readonly)
Returns the value of attribute current_version.
8 9 10 |
# File 'lib/appstore_info/app.rb', line 8 def current_version @current_version end |
Instance Method Details
#genre_names ⇒ Object
30 31 32 |
# File 'lib/appstore_info/app.rb', line 30 def genre_names @genre_ids.map { |genre| AppStoreInfo::GENRES[genre.to_i] } end |
#store_icon_url ⇒ Object
34 35 36 37 38 |
# File 'lib/appstore_info/app.rb', line 34 def store_icon_url return unless @artwork @artwork =~ /\.(png|jpg|gif)\z/ ? @artwork : nil end |
#universal? ⇒ Boolean
26 27 28 |
# File 'lib/appstore_info/app.rb', line 26 def universal? @features.include?('iosUniversal') end |