games_radar 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +9 -0
- data/lib/games_radar/game.rb +43 -2
- data/lib/games_radar/screenshot.rb +41 -0
- data/lib/games_radar/version.rb +1 -1
- data/lib/games_radar.rb +1 -0
- data/test/game_test.rb +7 -15
- data/test/resources/screenshots.xml +1 -0
- data/test/result_test.rb +36 -0
- data/test/screenshot_test.rb +27 -0
- metadata +8 -2
data/CHANGELOG.rdoc
CHANGED
data/lib/games_radar/game.rb
CHANGED
@@ -18,15 +18,30 @@ module GamesRadar
|
|
18
18
|
# The game description
|
19
19
|
attr_reader :description
|
20
20
|
|
21
|
-
# Retrieve the game list.
|
21
|
+
# Retrieve the game list. Return a GamesRadar::Result instance.
|
22
22
|
#
|
23
23
|
# == Options
|
24
24
|
#
|
25
25
|
# * +:filter+: filter the results by title. You can specify a letter from +a+ to +z+ or +0-9+.
|
26
26
|
# * +:genre+: set the game genre. Can be +all+ or any value from GamesRadar::Genre::GENRES.
|
27
|
-
# * +:page+: set the current page.
|
27
|
+
# * +:page+: set the current page.
|
28
|
+
# * +:size+: set the page size. Can be +5+ or multiples of +10+ up to +50+.
|
28
29
|
# * +:platform+: set the console platform. Can be +all+ or any code returned by GamesRadar::Platform#code
|
29
30
|
# * +:sort+: specify how the result will be sorted. The available options are +newest+, +oldest+, +updated+, +asc+ and +desc+.
|
31
|
+
#
|
32
|
+
# == Examples
|
33
|
+
#
|
34
|
+
# result = GamesRadar::Game.all
|
35
|
+
# result = GamesRadar::Game.all(:filter => 'a')
|
36
|
+
# result = GamesRadar::Game.all(:filter => '0-9')
|
37
|
+
# result = GamesRadar::Game.all(:genre => :sports)
|
38
|
+
# result = GamesRadar::Game.all(:page => 1)
|
39
|
+
# result = GamesRadar::Game.all(:platform => :ps3)
|
40
|
+
# result = GamesRadar::Game.all(:sort => :asc)
|
41
|
+
#
|
42
|
+
# result.each do |game|
|
43
|
+
# puts game.title
|
44
|
+
# end
|
30
45
|
def self.all(options = {})
|
31
46
|
options = {
|
32
47
|
:page => 1,
|
@@ -94,5 +109,31 @@ module GamesRadar
|
|
94
109
|
def title
|
95
110
|
name[:us]
|
96
111
|
end
|
112
|
+
|
113
|
+
# Retrieve the screenshot list. Return a GamesRadar::Result instance.
|
114
|
+
#
|
115
|
+
# == Options
|
116
|
+
#
|
117
|
+
# * +:region+: filter screenshots by region. Can be +us+ or +uk+.
|
118
|
+
# * +:page+: set the current page.
|
119
|
+
# * +:size+: set the page size. Can be +5+ or multiples of +10+ up to +50+.
|
120
|
+
def screenshots(options = {})
|
121
|
+
options = {
|
122
|
+
:region => :us,
|
123
|
+
:page => 1,
|
124
|
+
:size => GamesRadar::Config.page_size
|
125
|
+
}.merge(options)
|
126
|
+
|
127
|
+
request "/game/screenshots/:id", options.merge(:id => id) do |xml|
|
128
|
+
total_rows = xml.at("total_rows").text.to_i
|
129
|
+
items = xml.search("screenshot").collect {|node| GamesRadar::Screenshot.initialize_with_node node }
|
130
|
+
|
131
|
+
GamesRadar::Result.new(
|
132
|
+
:items => items,
|
133
|
+
:page_size => options[:size],
|
134
|
+
:count => total_rows
|
135
|
+
)
|
136
|
+
end
|
137
|
+
end
|
97
138
|
end
|
98
139
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module GamesRadar
|
2
|
+
class Screenshot
|
3
|
+
# The screenshot page on GamesRadar[http://gamesradar.com]
|
4
|
+
attr_reader :url
|
5
|
+
|
6
|
+
# The thumbnail url
|
7
|
+
attr_reader :thumbnail
|
8
|
+
|
9
|
+
# The large image url
|
10
|
+
attr_reader :image
|
11
|
+
|
12
|
+
# When the screenshot was published on GamesRadar[http://gamesradar.com]
|
13
|
+
attr_reader :published_at
|
14
|
+
|
15
|
+
def self.initialize_with_node(node) # :nodoc:
|
16
|
+
thumbnail = node.at("thumbnail").text
|
17
|
+
image = thumbnail.gsub(/screenshot_small\.jpg/, "screenshot_viewer_medium.jpg")
|
18
|
+
|
19
|
+
new(
|
20
|
+
{
|
21
|
+
:url => node.at("url").text,
|
22
|
+
:thumbnail => thumbnail,
|
23
|
+
:image => image,
|
24
|
+
:published_at => Time.parse(node.at("published_date").text)
|
25
|
+
}
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Initialize a new screenshot object and set the hash to its attributes.
|
30
|
+
#
|
31
|
+
# GamesRadar::Screenshot.new(
|
32
|
+
# :url => "/some/url",
|
33
|
+
# :image => "/some/image.jpg"
|
34
|
+
# )
|
35
|
+
def initialize(attrs = {})
|
36
|
+
attrs.each do |name, value|
|
37
|
+
instance_variable_set("@#{name}", value)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/games_radar/version.rb
CHANGED
data/lib/games_radar.rb
CHANGED
data/test/game_test.rb
CHANGED
@@ -71,22 +71,14 @@ class GamesRadar::GameTest < Test::Unit::TestCase
|
|
71
71
|
assert_equal 50, result.items.size
|
72
72
|
end
|
73
73
|
|
74
|
-
def
|
75
|
-
register_uri "/
|
76
|
-
|
77
|
-
|
78
|
-
result.each do |game|
|
79
|
-
assert_kind_of GamesRadar::Game, game
|
80
|
-
end
|
81
|
-
end
|
74
|
+
def test_screenshots
|
75
|
+
register_uri "/game/20060713144458560042?api_key=SxKuVse22qqUcZXq", "game.xml"
|
76
|
+
register_uri "/game/screenshots/20060713144458560042?page_num=1&page_size=50&api_key=SxKuVse22qqUcZXq®ion=us", "screenshots.xml"
|
82
77
|
|
83
|
-
|
84
|
-
register_uri "/games?api_key=SxKuVse22qqUcZXq&page_size=50&page_num=1&sort=newest", "games.xml"
|
85
|
-
result = GamesRadar::Game.all
|
78
|
+
game = GamesRadar::Game.find("20060713144458560042")
|
86
79
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
end
|
80
|
+
assert_kind_of GamesRadar::Result, game.screenshots
|
81
|
+
assert_equal 50, game.screenshots.items.size
|
82
|
+
assert_kind_of GamesRadar::Screenshot, game.screenshots.items.first
|
91
83
|
end
|
92
84
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?><screenshots xmlns='http://api.gamesradar.com'><total_rows>81</total_rows><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2010-01-18T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-C50D60BB-4B4D-48B3-9D6D-A4969D5F5236</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2010-01-18/Gaia01--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2010-01-18T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-9607C5FB-D784-45DD-A82B-AEC01B676F91</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2010-01-18/Gaia02--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2010-01-18T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-F1CD1132-9ECA-4FCB-BD69-8871C287F9D7</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2010-01-18/Gaia03--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2010-01-18T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-7617B3A6-9B7D-49F6-A072-0B3E68529059</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2010-01-18/Gaia04--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2010-01-18T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-B2529539-92A9-407A-80CA-7CB155B1E03D</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2010-01-18/Gaia05--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2010-01-18T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-D21C184E-8258-4A98-BAF5-9DB5C3176FED</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2010-01-18/Gaia06--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2010-01-18T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-B50851AF-6B30-4131-99F1-D94E7D66A6D5</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2010-01-18/Gaia07--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-12-01T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-E3609EF3-B790-41FF-A5E4-EA3F22BC5062</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-12-01/GOWIII_bloody_centaur_ewww--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-12-01T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-849B3408-4A14-41D2-86F6-5EDEAE1F70B8</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-12-01/In_your_chest--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-12-01T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-14BB9D59-B923-42E8-85D8-CA545E632F15</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-12-01/In_your_eye--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-12-01T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-AC54C138-3F91-4C7E-ADF4-CA71C1102C60</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-12-01/centaur_kicking_back--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-12-01T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-0ED70D91-6A08-498A-9F7A-F284276C05B4</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-12-01/off_with_his_head--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-12-01T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-38E70177-A823-4284-9091-2694F1F2390C</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-12-01/out_with_your_eye--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-12-01T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-48AD4C35-CC73-4CF7-9498-14B299B59D24</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-12-01/out_with_your_eye_2--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-12-01T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-BF07D185-3E36-49E4-B60A-FBE65DB64F23</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-12-01/thats_gotta_hurt--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-6AB50066-F1B6-4E12-9AEE-15FB9526E465</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/Cyclops--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-30FB4D17-0D0D-4DF8-88B8-5104B2A43842</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/Cyclops2--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-E7AB1A35-0B01-41C1-B7EA-53352074CED6</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/Helios1--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-DE9C2BB4-D2D0-4700-B41D-6D5A0B6FE445</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/Helios2--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-50649A02-1E8A-47E6-A730-F0D99692C3D8</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/Helios3--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-7C2E4B89-D158-4C05-B052-F8868E888C44</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/Helios4--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-048DDAC3-9C46-459C-BD66-FBF2FD853BDB</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/Helios5--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-A8B5749A-44AA-495F-8F3C-D66D4A786574</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/Heliosguard--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-4F0994AC-CF81-4C97-9F05-398F1D600D05</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/Icarus--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-0988E3CE-3869-4991-8D46-E8C8EBF36168</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/airgrab--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-0FB5A4C9-F954-435F-813C-094DD0BA96C3</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/arrow--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-50C40107-59FB-4044-BB96-B6E457D3529D</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/asplode--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-A601AFA9-E4E7-4C60-B6EB-7942F129218D</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/centaur1--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-8A09EA72-AA70-4DE2-A038-AD457E5BDD31</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/centaur2--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-AA00D5FF-F89B-44EA-8CA2-F4562B0702DA</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/centaur3--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-5F16DFF9-9D6C-40E6-8FE1-287B33F15874</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/chimera1--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-7B589F7E-E2DC-498E-A84C-FD3C589367E0</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/chimera2--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-2B41B381-E96B-4664-8BAC-F0B22288774B</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/chimera3--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-A6EAD03D-13D3-4717-AFBA-9860AEB19A91</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/eyerip3--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-82338EBC-FF6D-433B-95DB-174A730BF0C8</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/grabhit1--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-7EDB8041-8F21-453E-936E-202EB92E42CB</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/grabhit2--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-C59DDD18-6E9E-4617-9A09-FA0663C38645</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/grabhit3--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-C69864D5-DBF2-4C65-BD86-86B02961A804</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/halfrip--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-93539986-391B-4852-B52A-1D0E18B21568</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/harpy--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-34BCB1AE-12E2-4FCC-A176-518724D9BC49</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/harpyride1--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-68EDEAE6-053B-41A6-9F8E-D71D61E47F23</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/harpyride2--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-A0636FBB-A6BB-4807-9B3D-6ED346322ABA</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/lantern--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-02A77876-ADE5-4C6D-B378-834914F2AD2E</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/lavatitan1--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-8F07A2CE-2277-40B5-BA76-A1A3891E22F2</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/lavatitan2--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-334E4F00-8A07-4AE8-9867-7A4384A676EB</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/lavatitan3--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-7BF0A96D-1F9F-4542-94A4-1719DE504692</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/lavatitan4--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-30597F57-C4C7-4B69-AD17-B245CFA1D475</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/lavatitan5--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-7E3D3AD3-8B18-4F94-AE7D-7FC244D48BFC</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/lavatitan6--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-0B6856EC-CE75-4890-AC40-7A09B78EDC01</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/neckrip1--screenshot_small.jpg]]></thumbnail></images></screenshot><screenshot><id></id><game><id>20060713144458560042</id><name><![CDATA[God of War III]]></name><platform><id>5</id><name>PS3</name></platform></game><published_date>2009-11-24T00:00:00.00+0000</published_date><url>http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-37CF7587-E9C4-4D3A-9BD1-C090B1FB2B42</url><images><thumbnail><![CDATA[http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2009-11-24/neckrip2--screenshot_small.jpg]]></thumbnail></images></screenshot></screenshots>
|
data/test/result_test.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class GamesRadar::ResultTest < Test::Unit::TestCase
|
4
|
+
class Sample; end
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@result = GamesRadar::Result.new(
|
8
|
+
:count => 50,
|
9
|
+
:page_size => 50,
|
10
|
+
:items => Array.new(50) { Sample.new }
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_each
|
15
|
+
@result.each do |sample|
|
16
|
+
assert_kind_of Sample, sample
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_each_with_index
|
21
|
+
@result.each_with_index do |sample, i|
|
22
|
+
assert_kind_of Sample, sample
|
23
|
+
assert_kind_of Integer, i
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_set_pages_count
|
28
|
+
result = GamesRadar::Result.new(:count => 10, :page_size => 1, :items => [1])
|
29
|
+
assert_equal 10, result.pages
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_no_pages
|
33
|
+
result = GamesRadar::Result.new(:count => 10, :page_size => 1, :items => [])
|
34
|
+
assert_equal 0, result.pages
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class GamesRadar::ScreenshotTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
register_uri "/game/20060713144458560042?api_key=SxKuVse22qqUcZXq", "game.xml"
|
6
|
+
register_uri "/game/screenshots/20060713144458560042?page_num=1&page_size=50&api_key=SxKuVse22qqUcZXq®ion=us", "screenshots.xml"
|
7
|
+
|
8
|
+
@game = GamesRadar::Game.find("20060713144458560042")
|
9
|
+
@screenshot = @game.screenshots.items.first
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_set_large_image_url
|
13
|
+
assert_equal "http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2010-01-18/Gaia01--screenshot_viewer_medium.jpg", @screenshot.image
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_set_thumbnail_url
|
17
|
+
assert_equal "http://static.gamesradar.com/images/mb/GamesRadar/us/Games/G/God%20Of%20War%203/Bulk%20Viewers/PS3/2010-01-18/Gaia01--screenshot_small.jpg", @screenshot.thumbnail
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_set_url
|
21
|
+
assert_equal "http://www.gamesradar.com/ps3/god-of-war-iii/screenshots/g-20060713144458560042/pic-C50D60BB-4B4D-48B3-9D6D-A4969D5F5236", @screenshot.url
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_set_published_at
|
25
|
+
assert_equal Time.parse("2010-01-18T00:00:00.00+0000"), @screenshot.published_at
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: games_radar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-20 00:00:00 -02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/games_radar/platform.rb
|
43
43
|
- lib/games_radar/request.rb
|
44
44
|
- lib/games_radar/result.rb
|
45
|
+
- lib/games_radar/screenshot.rb
|
45
46
|
- lib/games_radar/version.rb
|
46
47
|
- test/config_test.rb
|
47
48
|
- test/game_test.rb
|
@@ -55,6 +56,9 @@ files:
|
|
55
56
|
- test/resources/invalid_api_key.xml
|
56
57
|
- test/resources/no_games.xml
|
57
58
|
- test/resources/platforms.xml
|
59
|
+
- test/resources/screenshots.xml
|
60
|
+
- test/result_test.rb
|
61
|
+
- test/screenshot_test.rb
|
58
62
|
- test/test_helper.rb
|
59
63
|
has_rdoc: true
|
60
64
|
homepage: http://github.com/fnando/games_radar
|
@@ -91,4 +95,6 @@ test_files:
|
|
91
95
|
- test/genre_test.rb
|
92
96
|
- test/platform_test.rb
|
93
97
|
- test/request_test.rb
|
98
|
+
- test/result_test.rb
|
99
|
+
- test/screenshot_test.rb
|
94
100
|
- test/test_helper.rb
|