thegamesdb 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -3
- data/CHANGELOG.md +3 -0
- data/README.md +7 -0
- data/lib/thegamesdb.rb +4 -12
- data/lib/thegamesdb/version.rb +1 -1
- data/test/games_test.rb +1 -2
- data/test/platform_test.rb +19 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12c293f7e4d38a962ebdafd40e21165cb71650c9aee29fa81b70ba0917295f5b
|
4
|
+
data.tar.gz: 9788fcbbdf42b1aca4f4f50f20af5e6dbba5dc429e15c5e0da086a4b3c624eb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b07a86d3b08940ce014eefd42d40d3de159c192365ce9d5561180ef71a4afb981e19dc681947d37e3cdfbd2972c06da1e5bcf68fed962fa8bee62e679acb27b7
|
7
|
+
data.tar.gz: 86c4ce64e7033b456603294a166b385492463e714bbfb22fe4aaedffd596fa2770149286592a0098032e8653cfb73b8be5c6c160c615c38047e754dc55ab37d7
|
data/.travis.yml
CHANGED
@@ -4,9 +4,10 @@ env:
|
|
4
4
|
language: ruby
|
5
5
|
rvm:
|
6
6
|
- 2.3.8
|
7
|
-
- 2.4.
|
8
|
-
- 2.5.
|
9
|
-
- 2.6.
|
7
|
+
- 2.4.9
|
8
|
+
- 2.5.7
|
9
|
+
- 2.6.5
|
10
|
+
- 2.7.0
|
10
11
|
- truffleruby
|
11
12
|
- ruby-head
|
12
13
|
install: bundle install
|
@@ -18,3 +19,6 @@ script:
|
|
18
19
|
- bundle exec rake test
|
19
20
|
after_script:
|
20
21
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
22
|
+
allow_failures:
|
23
|
+
- rvm: ruby-head
|
24
|
+
- rvm: truffleruby
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -78,6 +78,13 @@ Gamesdb.games_by_platform_id(7)
|
|
78
78
|
=> [{:name=>"Donkey Kong", :id=>5, :release_date=>"1982-01-01", :developers=>[6037]}, {:name=>"Bionic Commando", :id=>76, :release_date=>"1988-12-06", :developers=>[1436]}, {:name=>"Super Mario Bros. 3", :id=>112, :release_date=>"1990-02-12", :developers=>[6055]}, {:name=>"The Legend of Zelda", :id=>113, :release_date=>"1987-07-01", :developers=>[6055]}, {:name=>"Kirby's Adventure", :id=>121, :release_date=>"1993-03-26", :developers=>[3694]}, {:name=>"Metroid", :id=>123, :release_date=>"1987-08-15", :developers=>[6051]}, {:name=>"Mega Man 5", :id=>125, :release_date=>"1992-12-04", :developers=>[1436]}, {:name=>"Kid Icarus", :id=>130, :release_date=>"1986-12-18", :developers=>[6037]}, {:name=>"Lemmings", :id=>133, :release_date=>"1991-02-14", :developers=>[2404]}, {:name=>"Castlevania", :id=>135, :release_date=>"1987-05-01", :developers=>[4765]}, {:name=>"Super Mario Bros.", :id=>140, :release_date=>"1985-09-13", :developers=>[6042]}, ...
|
79
79
|
]
|
80
80
|
```
|
81
|
+
|
82
|
+
Supports comma delimited list:
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
Gamesdb.games_by_platform_id("4950,4948")
|
86
|
+
```
|
87
|
+
|
81
88
|
- [x] /Games/Images
|
82
89
|
|
83
90
|
Usage:
|
data/lib/thegamesdb.rb
CHANGED
@@ -5,16 +5,16 @@ require 'json'
|
|
5
5
|
|
6
6
|
# Client for TheGamesDB API (thegamesdb.net)
|
7
7
|
module Gamesdb
|
8
|
-
BASE_URL = 'https://api.thegamesdb.net/'.freeze
|
8
|
+
BASE_URL = 'https://api.thegamesdb.net/v1/'.freeze
|
9
9
|
IMAGES_BASE_URL = 'https://legacy.thegamesdb.net/banners/'.freeze
|
10
10
|
|
11
11
|
# Method for listing platform's games
|
12
|
-
#
|
13
|
-
# https://api.thegamesdb.net/#/operations/Games/GamesByPlatformID
|
12
|
+
#
|
13
|
+
# See: https://api.thegamesdb.net/#/operations/Games/GamesByPlatformID
|
14
14
|
#
|
15
15
|
# Parameters: platform id (int), page (int)
|
16
16
|
#
|
17
|
-
#
|
17
|
+
# = Returns:
|
18
18
|
# Array of Hashes with games info
|
19
19
|
#
|
20
20
|
def self.games_by_platform_id(platform_id, page = 1)
|
@@ -237,14 +237,6 @@ module Gamesdb
|
|
237
237
|
games
|
238
238
|
end
|
239
239
|
|
240
|
-
def self.process_game(game)
|
241
|
-
game[:id] = game[:id].to_i
|
242
|
-
game[:name] = game.delete(:GameTitle)
|
243
|
-
game[:title] = game[:name]
|
244
|
-
game[:platform] = game.delete(:Platform)
|
245
|
-
game
|
246
|
-
end
|
247
|
-
|
248
240
|
def self.symbolize_keys(hash)
|
249
241
|
hash.keys.each do |key|
|
250
242
|
hash[key.to_sym] = hash.delete(key)
|
data/lib/thegamesdb/version.rb
CHANGED
data/test/games_test.rb
CHANGED
data/test/platform_test.rb
CHANGED
@@ -8,7 +8,7 @@ describe 'GamesDB - platforms', :vcr do
|
|
8
8
|
|
9
9
|
it 'should get gaming platforms' do
|
10
10
|
@platforms.count.wont_be :<, 0
|
11
|
-
@platforms.count.must_equal
|
11
|
+
@platforms.count.must_equal 110
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should have a valid name' do
|
@@ -39,7 +39,7 @@ describe 'GamesDB - platforms', :vcr do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
describe '
|
42
|
+
describe 'games by platform' do
|
43
43
|
before do
|
44
44
|
platforms = Gamesdb.platforms
|
45
45
|
@first_page = Gamesdb.games_by_platform_id(platforms[0][:id])
|
@@ -58,6 +58,23 @@ describe 'GamesDB - platforms', :vcr do
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
describe 'games by platform parameters' do
|
62
|
+
before do
|
63
|
+
@games1 = Gamesdb.games_by_platform_id(4950)
|
64
|
+
@games2 = Gamesdb.games_by_platform_id(4948)
|
65
|
+
@games3 = Gamesdb.games_by_platform_id("4950,4948")
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'supports comma separated list' do
|
69
|
+
@games1.count.must_equal 20
|
70
|
+
@games2.count.must_equal 1
|
71
|
+
@games3.count.must_equal 20
|
72
|
+
|
73
|
+
(@games3 - @games1).must_equal @games2
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
61
78
|
describe 'platform' do
|
62
79
|
describe 'assigning basic info' do
|
63
80
|
before do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thegamesdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Briano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|