Class: Gamesdb::Client::Platform

Inherits:
Cistern::Model
  • Object
show all
Defined in:
lib/gamesdb/models/platform.rb

Instance Method Summary collapse

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


55
56
57
58
# File 'lib/gamesdb/models/platform.rb', line 55

def banner
  requires :images
  images["banner"].nil? ? [] : append_urls(images["banner"])
end

#boxartObject



50
51
52
53
# File 'lib/gamesdb/models/platform.rb', line 50

def boxart
  requires :images
  images["boxart"].nil? ? [] : append_urls(images["boxart"])
end

#consoleartObject



60
61
62
63
# File 'lib/gamesdb/models/platform.rb', line 60

def consoleart
  requires :images
  images["consoleart"].nil? ? [] : append_urls(images["consoleart"])
end

#controllerartObject



65
66
67
68
# File 'lib/gamesdb/models/platform.rb', line 65

def controllerart
  requires :images
  images["controllerart"].nil? ? [] : append_urls(images["controllerart"])
end

#fanartObject



45
46
47
48
# File 'lib/gamesdb/models/platform.rb', line 45

def fanart
  requires :images
  images["fanart"].nil? ? [] : append_urls(images["fanart"])
end

#gamesObject



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_urlObject

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