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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 477e3d9d2b073a86b77e82e6032a49f7c196e9eb9493ddbe233d5d1a569a4a95
4
- data.tar.gz: 968a97e6b32aa648e40c443aca798c80eae9bec40275a350a2e762215a78fbcf
3
+ metadata.gz: 12c293f7e4d38a962ebdafd40e21165cb71650c9aee29fa81b70ba0917295f5b
4
+ data.tar.gz: 9788fcbbdf42b1aca4f4f50f20af5e6dbba5dc429e15c5e0da086a4b3c624eb8
5
5
  SHA512:
6
- metadata.gz: c6a757afd1711766e6de821fd4f7470751ba757e2b001db9ed013619ea106d7ac02ffd29f151324469cb474f58e019e585a983c448fc4165bffbb7fcf1768835
7
- data.tar.gz: 90a01c2548018e0c3f6366bf13494fe67d9425e3230ec893684fb9ec09ad2ccb32fef56e578dc74a783fe942dc59669670e23f92cbedf9b633e5a783c127a140
6
+ metadata.gz: b07a86d3b08940ce014eefd42d40d3de159c192365ce9d5561180ef71a4afb981e19dc681947d37e3cdfbd2972c06da1e5bcf68fed962fa8bee62e679acb27b7
7
+ data.tar.gz: 86c4ce64e7033b456603294a166b385492463e714bbfb22fe4aaedffd596fa2770149286592a0098032e8653cfb73b8be5c6c160c615c38047e754dc55ab37d7
@@ -4,9 +4,10 @@ env:
4
4
  language: ruby
5
5
  rvm:
6
6
  - 2.3.8
7
- - 2.4.7
8
- - 2.5.6
9
- - 2.6.4
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
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.2
4
+ * Internal changes: update API endpoint url (adds `v1`), update tests
5
+
3
6
  ## 1.1.1
4
7
  * Adds `platform_id` parameter to `games_by_name`
5
8
  * Adds `page` parameter to `games_by_name`
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:
@@ -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
- # TODO: check (and test) that we support ',' delimited list
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
- # == Returns:
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)
@@ -1,4 +1,4 @@
1
1
  # Gem version
2
2
  module Gamesdb
3
- VERSION = '1.1.1'.freeze
3
+ VERSION = '1.1.2'.freeze
4
4
  end
@@ -110,8 +110,7 @@ describe 'Gamesdb - games', :vcr do
110
110
  end
111
111
 
112
112
  it 'should return an empty array' do
113
- @images.must_be_kind_of Array
114
- @images.must_equal []
113
+ @images.must_be_kind_of Hash
115
114
  end
116
115
  end
117
116
  end
@@ -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 109
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 'platform_games pages' do
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.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: 2019-09-11 00:00:00.000000000 Z
11
+ date: 2020-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler