gamesdb 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/gamesdb/models/game.rb +19 -10
- data/lib/gamesdb/models/platform.rb +19 -5
- data/lib/gamesdb/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/gamesdb/models/game.rb
CHANGED
@@ -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
|
data/lib/gamesdb/version.rb
CHANGED