Class: Gamesdb::Client::Platform
- Inherits:
-
Cistern::Model
- Object
- Cistern::Model
- Gamesdb::Client::Platform
- Defined in:
- lib/gamesdb/models/platform.rb
Instance Method Summary collapse
- #append_urls(resource) ⇒ Object
- #banner ⇒ Object
- #boxart ⇒ Object
- #consoleart ⇒ Object
- #controllerart ⇒ Object
- #fanart ⇒ Object
- #games ⇒ Object
-
#path_url ⇒ Object
attribute :fanart, aliases: “Images”, squash: “fanart”, type: Array attribute :boxart, aliases: “Images”, squash: “boxart”, type: Array attribute :banner, aliases: “Images”, squash: “banner”, type: Array attribute :consoleart, aliases: “Images”, squash: “consoleart”, type: Array attribute :controllerart, aliases: “Images”, squash: “controllerart”, type: Array.
Instance Method Details
#append_urls(resource) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/gamesdb/models/platform.rb', line 30 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
55 56 57 58 |
# File 'lib/gamesdb/models/platform.rb', line 55 def requires :images images["banner"].nil? ? [] : append_urls(images["banner"]) end |
#boxart ⇒ Object
50 51 52 53 |
# File 'lib/gamesdb/models/platform.rb', line 50 def boxart requires :images images["boxart"].nil? ? [] : append_urls(images["boxart"]) end |
#consoleart ⇒ Object
60 61 62 63 |
# File 'lib/gamesdb/models/platform.rb', line 60 def consoleart requires :images images["consoleart"].nil? ? [] : append_urls(images["consoleart"]) end |
#controllerart ⇒ Object
65 66 67 68 |
# File 'lib/gamesdb/models/platform.rb', line 65 def controllerart requires :images images["controllerart"].nil? ? [] : append_urls(images["controllerart"]) end |
#fanart ⇒ Object
45 46 47 48 |
# File 'lib/gamesdb/models/platform.rb', line 45 def fanart requires :images images["fanart"].nil? ? [] : append_urls(images["fanart"]) end |
#games ⇒ Object
40 41 42 43 |
# File 'lib/gamesdb/models/platform.rb', line 40 def games data = connection.get_platform_games(identity)["Game"] connection.games.load(data) end |
#path_url ⇒ Object
attribute :fanart, aliases: “Images”, squash: “fanart”, type: Array attribute :boxart, aliases: “Images”, squash: “boxart”, type: Array attribute :banner, aliases: “Images”, squash: “banner”, type: Array attribute :consoleart, aliases: “Images”, squash: “consoleart”, type: Array attribute :controllerart, aliases: “Images”, squash: “controllerart”, type: Array
26 27 28 |
# File 'lib/gamesdb/models/platform.rb', line 26 def path_url "http://thegamesdb.net/banners/_gameviewcache/" end |