Class: Gamesdb::Client::Game

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

Instance Method Summary collapse

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


48
49
50
51
# File 'lib/gamesdb/models/game.rb', line 48

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

#boxartObject



43
44
45
46
# File 'lib/gamesdb/models/game.rb', line 43

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

#clearlogoObject



58
59
60
61
# File 'lib/gamesdb/models/game.rb', line 58

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

#fanartObject



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_urlObject

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

#screenshotObject



53
54
55
56
# File 'lib/gamesdb/models/game.rb', line 53

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