games_radar_api 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +9 -0
- data/games_radar_api.gemspec +28 -0
- data/lib/faraday/raise_http_exception.rb +51 -0
- data/lib/games_radar_api.rb +26 -0
- data/lib/games_radar_api/api.rb +22 -0
- data/lib/games_radar_api/client.rb +18 -0
- data/lib/games_radar_api/client/cheats.rb +18 -0
- data/lib/games_radar_api/client/developers.rb +9 -0
- data/lib/games_radar_api/client/franchises.rb +9 -0
- data/lib/games_radar_api/client/games.rb +25 -0
- data/lib/games_radar_api/client/genres.rb +9 -0
- data/lib/games_radar_api/client/guides.rb +18 -0
- data/lib/games_radar_api/client/news.rb +57 -0
- data/lib/games_radar_api/client/platforms.rb +9 -0
- data/lib/games_radar_api/client/publishers.rb +9 -0
- data/lib/games_radar_api/client/screenshots.rb +20 -0
- data/lib/games_radar_api/client/videos.rb +18 -0
- data/lib/games_radar_api/configuration.rb +51 -0
- data/lib/games_radar_api/connection.rb +32 -0
- data/lib/games_radar_api/error.rb +19 -0
- data/lib/games_radar_api/request.rb +42 -0
- data/lib/games_radar_api/version.rb +3 -0
- data/spec/lib/games_radar_api/client/cheats_spec.rb +33 -0
- data/spec/lib/games_radar_api/client/developers_spec.rb +22 -0
- data/spec/lib/games_radar_api/client/franchises_spec.rb +22 -0
- data/spec/lib/games_radar_api/client/games_spec.rb +52 -0
- data/spec/lib/games_radar_api/client/genres_spec.rb +21 -0
- data/spec/lib/games_radar_api/client/guides_spec.rb +31 -0
- data/spec/lib/games_radar_api/client/news_spec.rb +77 -0
- data/spec/lib/games_radar_api/client/platforms_spec.rb +22 -0
- data/spec/lib/games_radar_api/client/publishers_spec.rb +22 -0
- data/spec/lib/games_radar_api/client/screenshots_spec.rb +29 -0
- data/spec/lib/games_radar_api/client/videos_spec.rb +24 -0
- data/spec/lib/games_radar_api/client_spec.rb +59 -0
- data/spec/lib/games_radar_api/configuration_spec.rb +26 -0
- data/spec/lib/games_radar_api/games_radar_api_spec.rb +7 -0
- data/spec/spec_helper.rb +15 -0
- metadata +204 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path('../../../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe GamesRadarApi::Client::Platforms do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@client = get_client
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'Platforms list' do
|
10
|
+
let(:response) { @client.platforms }
|
11
|
+
it 'should have at least one result' do
|
12
|
+
response.size.must_be :>, 0
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should return valid platform' do
|
16
|
+
response.first.name.must_equal '3DS'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require File.expand_path('../../../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe GamesRadarApi::Client::Publishers do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@client = get_client
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'Publishers list' do
|
10
|
+
let(:response) { @client.publishers }
|
11
|
+
it 'should have at least one result' do
|
12
|
+
response.size.must_be :>, 0
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should return valid publishers' do
|
16
|
+
response.first.name.wont_be_nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.expand_path('../../../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe GamesRadarApi::Client::Screenshots do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@client = get_client
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'Screenshots List' do
|
10
|
+
it 'should have at least one result' do
|
11
|
+
response = @client.screenshots
|
12
|
+
# Ideally this if statement shouldn't be here, but it's just in place because the screenshot API doesn't work on 28 September 2012
|
13
|
+
if(@client.total_rows > 0)
|
14
|
+
@client.total_rows.must_be :>, 0
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should contain at least one screenshot url' do
|
20
|
+
response = @client.screenshots
|
21
|
+
# Ideally this if statement shouldn't be here, but it's just in place because the screenshot API doesn't work on 28 September 2012
|
22
|
+
if(@client.total_rows > 0)
|
23
|
+
response.images.thumbnail.wont_be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../../../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe GamesRadarApi::Client::Videos do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@client = get_client
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'Videos List' do
|
10
|
+
it 'should have at least one result' do
|
11
|
+
@client.videos
|
12
|
+
@client.total_rows.must_be :>, 0
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'Game Videos' do
|
18
|
+
it 'should fetch videos for a specified game' do
|
19
|
+
@client.game_videos(8783)
|
20
|
+
@client.total_rows.must_be :>, 0
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require_relative '../../../spec/spec_helper'
|
2
|
+
|
3
|
+
describe GamesRadarApi::Client do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@keys = GamesRadarApi::Configuration::VALID_CONFIG_KEYS
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'with module configuration' do
|
10
|
+
before do
|
11
|
+
GamesRadarApi.configure do |config|
|
12
|
+
@keys.each do |key|
|
13
|
+
config.send("#{key}=",key)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
GamesRadarApi.reset
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should inherit module configuration' do
|
23
|
+
api = GamesRadarApi.client
|
24
|
+
@keys.each do |key|
|
25
|
+
api.send(key).must_equal key
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'with class configuration' do
|
30
|
+
before do
|
31
|
+
@config = {
|
32
|
+
:api_key => 'ak',
|
33
|
+
:format => 'of',
|
34
|
+
:endpoint => 'ep',
|
35
|
+
:user_agent => 'ua',
|
36
|
+
:method => 'hm',
|
37
|
+
:proxy => 'pr',
|
38
|
+
:adapter => 'ad'
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should override module configuration' do
|
43
|
+
api = GamesRadarApi.client
|
44
|
+
@config.each do |key,value|
|
45
|
+
api.send("#{key}=",value)
|
46
|
+
end
|
47
|
+
|
48
|
+
@keys.each do |key|
|
49
|
+
api.send("#{key}").must_equal @config[key]
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative '../../../spec/spec_helper'
|
2
|
+
|
3
|
+
describe 'Configuration' do
|
4
|
+
|
5
|
+
after do
|
6
|
+
GamesRadarApi.reset
|
7
|
+
end
|
8
|
+
|
9
|
+
GamesRadarApi::Configuration::VALID_CONFIG_KEYS.each do |key|
|
10
|
+
describe "#{key}" do
|
11
|
+
it 'should return the default value' do
|
12
|
+
GamesRadarApi.send(key).must_equal GamesRadarApi::Configuration.const_get("DEFAULT_#{key.upcase}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
GamesRadarApi::Configuration::VALID_CONFIG_KEYS.each do |key|
|
18
|
+
it "should set the #{key}" do
|
19
|
+
GamesRadarApi.configure do |config|
|
20
|
+
config.send("#{key}=",key)
|
21
|
+
GamesRadarApi.send(key).must_equal key
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative '../lib/games_radar_api'
|
2
|
+
|
3
|
+
require 'minitest/autorun'
|
4
|
+
require 'turn'
|
5
|
+
|
6
|
+
Turn.config do |c|
|
7
|
+
c.format = :pretty
|
8
|
+
c.trace = nil
|
9
|
+
c.natural = true
|
10
|
+
c.verbose = true
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_client
|
14
|
+
GamesRadarApi.client(:api_key=>'f6eef8a6796344dfabb4ef3826e0ccc6')
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: games_radar_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Cube Websites
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: faraday_middleware
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.8'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.8'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: faraday
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0.7'
|
38
|
+
- - <
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.9'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0.7'
|
49
|
+
- - <
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0.9'
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: multi_xml
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.5.1
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 0.5.1
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: hashie
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.4.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 0.4.0
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: turn
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ~>
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 0.9.6
|
92
|
+
type: :development
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ~>
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 0.9.6
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: rake
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ~>
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: 0.9.2.2
|
108
|
+
type: :development
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ~>
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 0.9.2.2
|
116
|
+
description: Allows interaction with the Games Radar API
|
117
|
+
email:
|
118
|
+
- mail@cubewebsites.com
|
119
|
+
executables: []
|
120
|
+
extensions: []
|
121
|
+
extra_rdoc_files: []
|
122
|
+
files:
|
123
|
+
- .gitignore
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- games_radar_api.gemspec
|
129
|
+
- lib/faraday/raise_http_exception.rb
|
130
|
+
- lib/games_radar_api.rb
|
131
|
+
- lib/games_radar_api/api.rb
|
132
|
+
- lib/games_radar_api/client.rb
|
133
|
+
- lib/games_radar_api/client/cheats.rb
|
134
|
+
- lib/games_radar_api/client/developers.rb
|
135
|
+
- lib/games_radar_api/client/franchises.rb
|
136
|
+
- lib/games_radar_api/client/games.rb
|
137
|
+
- lib/games_radar_api/client/genres.rb
|
138
|
+
- lib/games_radar_api/client/guides.rb
|
139
|
+
- lib/games_radar_api/client/news.rb
|
140
|
+
- lib/games_radar_api/client/platforms.rb
|
141
|
+
- lib/games_radar_api/client/publishers.rb
|
142
|
+
- lib/games_radar_api/client/screenshots.rb
|
143
|
+
- lib/games_radar_api/client/videos.rb
|
144
|
+
- lib/games_radar_api/configuration.rb
|
145
|
+
- lib/games_radar_api/connection.rb
|
146
|
+
- lib/games_radar_api/error.rb
|
147
|
+
- lib/games_radar_api/request.rb
|
148
|
+
- lib/games_radar_api/version.rb
|
149
|
+
- spec/lib/games_radar_api/client/cheats_spec.rb
|
150
|
+
- spec/lib/games_radar_api/client/developers_spec.rb
|
151
|
+
- spec/lib/games_radar_api/client/franchises_spec.rb
|
152
|
+
- spec/lib/games_radar_api/client/games_spec.rb
|
153
|
+
- spec/lib/games_radar_api/client/genres_spec.rb
|
154
|
+
- spec/lib/games_radar_api/client/guides_spec.rb
|
155
|
+
- spec/lib/games_radar_api/client/news_spec.rb
|
156
|
+
- spec/lib/games_radar_api/client/platforms_spec.rb
|
157
|
+
- spec/lib/games_radar_api/client/publishers_spec.rb
|
158
|
+
- spec/lib/games_radar_api/client/screenshots_spec.rb
|
159
|
+
- spec/lib/games_radar_api/client/videos_spec.rb
|
160
|
+
- spec/lib/games_radar_api/client_spec.rb
|
161
|
+
- spec/lib/games_radar_api/configuration_spec.rb
|
162
|
+
- spec/lib/games_radar_api/games_radar_api_spec.rb
|
163
|
+
- spec/spec_helper.rb
|
164
|
+
homepage: https://github.com/cubewebsites/games_radar_api
|
165
|
+
licenses: []
|
166
|
+
post_install_message:
|
167
|
+
rdoc_options: []
|
168
|
+
require_paths:
|
169
|
+
- lib
|
170
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
178
|
+
requirements:
|
179
|
+
- - ! '>='
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
182
|
+
requirements: []
|
183
|
+
rubyforge_project:
|
184
|
+
rubygems_version: 1.8.24
|
185
|
+
signing_key:
|
186
|
+
specification_version: 3
|
187
|
+
summary: This gem is created for developers to easily access all features of the Games
|
188
|
+
Radar API
|
189
|
+
test_files:
|
190
|
+
- spec/lib/games_radar_api/client/cheats_spec.rb
|
191
|
+
- spec/lib/games_radar_api/client/developers_spec.rb
|
192
|
+
- spec/lib/games_radar_api/client/franchises_spec.rb
|
193
|
+
- spec/lib/games_radar_api/client/games_spec.rb
|
194
|
+
- spec/lib/games_radar_api/client/genres_spec.rb
|
195
|
+
- spec/lib/games_radar_api/client/guides_spec.rb
|
196
|
+
- spec/lib/games_radar_api/client/news_spec.rb
|
197
|
+
- spec/lib/games_radar_api/client/platforms_spec.rb
|
198
|
+
- spec/lib/games_radar_api/client/publishers_spec.rb
|
199
|
+
- spec/lib/games_radar_api/client/screenshots_spec.rb
|
200
|
+
- spec/lib/games_radar_api/client/videos_spec.rb
|
201
|
+
- spec/lib/games_radar_api/client_spec.rb
|
202
|
+
- spec/lib/games_radar_api/configuration_spec.rb
|
203
|
+
- spec/lib/games_radar_api/games_radar_api_spec.rb
|
204
|
+
- spec/spec_helper.rb
|