Class: Gamesdb::Client::Game
- Inherits:
-
Cistern::Model
- Object
- Cistern::Model
- Gamesdb::Client::Game
- Defined in:
- lib/gamesdb/models/game.rb
Instance Method Summary collapse
- #append_urls(resource) ⇒ Object
- #banner ⇒ Object
- #boxart ⇒ Object
- #clearlogo ⇒ Object
- #fanart ⇒ Object
-
#path_url ⇒ Object
attribute :fanart, aliases: “Images”, squash: “fanart” attribute :boxart, aliases: “Images”, squash: “boxart” attribute :banner, aliases: “Images”, squash: “banner” attribute :screenshot, aliases: “Images”, squash: “screenshot” attribute :thumb, aliases: “Images”, squash: “thumb” attribute :clearlogo, aliases: “Images”, squash: “clearlogo”.
- #screenshot ⇒ Object
Instance Method Details
#append_urls(resource) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/gamesdb/models/game.rb', line 28 def append_urls(resource) resource = resource.class == Array ? resource : [resource] if resource.first.is_a?(Hash) resource.map! { |h| h.each { |k,v| h[k] = path_url + v } } else resource.map! { |url| path_url + url } end resource end |
#banner ⇒ Object
48 49 50 51 |
# File 'lib/gamesdb/models/game.rb', line 48 def requires :images images["banner"].nil? ? [] : append_urls(images["banner"]) end |
#boxart ⇒ Object
43 44 45 46 |
# File 'lib/gamesdb/models/game.rb', line 43 def boxart requires :images images["boxart"].nil? ? [] : append_urls(images["boxart"]) end |
#clearlogo ⇒ Object
58 59 60 61 |
# File 'lib/gamesdb/models/game.rb', line 58 def clearlogo requires :images images["clearlogo"].nil? ? [] : append_urls(images["clearlogo"]) end |
#fanart ⇒ Object
38 39 40 41 |
# File 'lib/gamesdb/models/game.rb', line 38 def fanart requires :images images["fanart"].nil? ? [] : append_urls(images["fanart"]) end |
#path_url ⇒ Object
attribute :fanart, aliases: “Images”, squash: “fanart” attribute :boxart, aliases: “Images”, squash: “boxart” attribute :banner, aliases: “Images”, squash: “banner” attribute :screenshot, aliases: “Images”, squash: “screenshot” attribute :thumb, aliases: “Images”, squash: “thumb” attribute :clearlogo, aliases: “Images”, squash: “clearlogo”
24 25 26 |
# File 'lib/gamesdb/models/game.rb', line 24 def path_url "http://thegamesdb.net/banners/_gameviewcache/" end |
#screenshot ⇒ Object
53 54 55 56 |
# File 'lib/gamesdb/models/game.rb', line 53 def screenshot requires :images images["screenshot"].nil? ? [] : append_urls(images["screenshot"]) end |