gamesdb 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gamesdb (1.0.1)
4
+ gamesdb (1.0.2)
5
5
  awesome_print
6
6
  cistern
7
7
  excon
@@ -21,33 +21,42 @@ class Gamesdb::Client::Game < Cistern::Model
21
21
  #attribute :thumb, aliases: "Images", squash: "thumb"
22
22
  #attribute :clearlogo, aliases: "Images", squash: "clearlogo"
23
23
 
24
+ def path_url
25
+ "http://thegamesdb.net/banners/_gameviewcache/"
26
+ end
27
+
28
+ def append_urls(resource)
29
+ resource = resource.class == Array ? resource : [resource]
30
+ if resource.first.is_a?(Hash)
31
+ resource.map! { |h| h.each { |k,v| h[k] = path_url + v } }
32
+ else
33
+ resource.map! { |url| path_url + url }
34
+ end
35
+ resource
36
+ end
37
+
24
38
  def fanart
25
39
  requires :images
26
- images["fanart"]
40
+ append_urls images["fanart"]
27
41
  end
28
42
 
29
43
  def boxart
30
44
  requires :images
31
- images["boxart"]
45
+ append_urls images["boxart"]
32
46
  end
33
47
 
34
48
  def banner
35
49
  requires :images
36
- images["banner"]
50
+ append_urls images["banner"]
37
51
  end
38
52
 
39
53
  def screenshot
40
54
  requires :images
41
- images["screenshot"]
42
- end
43
-
44
- def thumb
45
- requires :images
46
- images["thumb"]
55
+ append_urls images["screenshot"]
47
56
  end
48
57
 
49
58
  def clearlogo
50
59
  requires :images
51
- images["clearlogo"]
60
+ append_urls images["clearlogo"]
52
61
  end
53
62
  end
@@ -23,6 +23,20 @@ class Gamesdb::Client::Platform < Cistern::Model
23
23
  #attribute :consoleart, aliases: "Images", squash: "consoleart", type: Array
24
24
  #attribute :controllerart, aliases: "Images", squash: "controllerart", type: Array
25
25
 
26
+ def path_url
27
+ "http://thegamesdb.net/banners/_gameviewcache/"
28
+ end
29
+
30
+ def append_urls(resource)
31
+ resource = resource.class == Array ? resource : [resource]
32
+ if resource.first.is_a?(Hash)
33
+ resource.map! { |h| h.each { |k,v| h[k] = path_url + v } }
34
+ else
35
+ resource.map! { |url| path_url + url }
36
+ end
37
+ resource
38
+ end
39
+
26
40
  def games
27
41
  data = connection.get_platform_games(identity)["Game"]
28
42
  connection.games.load(data)
@@ -30,26 +44,26 @@ class Gamesdb::Client::Platform < Cistern::Model
30
44
 
31
45
  def fanart
32
46
  requires :images
33
- images["fanart"]
47
+ append_urls images["fanart"]
34
48
  end
35
49
 
36
50
  def boxart
37
51
  requires :images
38
- images["boxart"]
52
+ append_urls images["boxart"]
39
53
  end
40
54
 
41
55
  def banner
42
56
  requires :images
43
- images["banner"]
57
+ append_urls images["banner"]
44
58
  end
45
59
 
46
60
  def consoleart
47
61
  requires :images
48
- images["consoleart"]
62
+ append_urls images["consoleart"]
49
63
  end
50
64
 
51
65
  def controllerart
52
66
  requires :images
53
- images["controllerart"]
67
+ append_urls images["controllerart"]
54
68
  end
55
69
  end
@@ -1,3 +1,3 @@
1
1
  module Gamesdb
2
- Version = "1.0.2"
2
+ Version = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamesdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: