thegamesdb 1.1.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/master.yml +26 -0
- data/.github/workflows/rubocop.yml +20 -0
- data/.rubocop.yml +39 -0
- data/CHANGELOG.md +42 -0
- data/Gemfile +2 -0
- data/README.md +313 -52
- data/Rakefile +3 -0
- data/lib/thegamesdb.rb +115 -215
- data/lib/thegamesdb/developers.rb +17 -0
- data/lib/thegamesdb/games.rb +130 -0
- data/lib/thegamesdb/genres.rb +13 -0
- data/lib/thegamesdb/images.rb +7 -0
- data/lib/thegamesdb/platforms.rb +106 -0
- data/lib/thegamesdb/publishers.rb +15 -0
- data/lib/thegamesdb/version.rb +3 -1
- data/test/client_test.rb +16 -0
- data/test/developers_test.rb +16 -0
- data/test/games_test.rb +92 -42
- data/test/genres_test.rb +16 -0
- data/test/platform_test.rb +85 -51
- data/test/publishers_test.rb +16 -0
- data/test/test_helper.rb +3 -2
- data/thegamesdb.gemspec +14 -9
- metadata +23 -8
- data/.travis.yml +0 -24
- data/lib/thegamesdb/config.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f764717699d2e66db9ff42a82e6077ca5499fb2e2e27215276492c135bad22ad
|
4
|
+
data.tar.gz: ef3c70003d768e26fcb5f6f21a1ca42279a8671b83c12072624a2881da026207
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0467cf3be3a2e1838f04c50536a985776ff96cb4e13616ac9560cacb02f298cc952972ea59322563d3ade61dc6847e4fb7facf2b8fc57f87aaa60fa6a3c1f15d
|
7
|
+
data.tar.gz: 8d6d965a417ca7a64b85a8c41932ea683ce879acb01eb515c91c5e52d28454c265fa2d179fdb6e74bb3aeafb3dbf4f5c553c5fceaf93fc8285081158ad57590a
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Tests
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
pull_request:
|
7
|
+
branches:
|
8
|
+
- master
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
env:
|
12
|
+
GAMESDB_API_KEY: ${{ secrets.GAMESDB_API_KEY }}
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
17
|
+
ruby: [ '2.5', '2.6', '2.7', 'jruby', 'truffleruby' ]
|
18
|
+
name: Ruby ${{ matrix.ruby }}
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v2
|
21
|
+
- uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
- run: |
|
25
|
+
bundle install
|
26
|
+
bundle exec rake test
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: Rubocop
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
pull_request:
|
7
|
+
branches:
|
8
|
+
- master
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
build:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: 2.7
|
18
|
+
- run: |
|
19
|
+
bundle install
|
20
|
+
bundle exec rubocop
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5
|
3
|
+
Lint/DuplicateBranch: # (new in 1.3)
|
4
|
+
Enabled: true
|
5
|
+
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
|
6
|
+
Enabled: true
|
7
|
+
Lint/EmptyBlock: # (new in 1.1)
|
8
|
+
Enabled: true
|
9
|
+
Lint/EmptyClass: # (new in 1.3)
|
10
|
+
Enabled: true
|
11
|
+
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
|
12
|
+
Enabled: true
|
13
|
+
Lint/ToEnumArguments: # (new in 1.1)
|
14
|
+
Enabled: true
|
15
|
+
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
|
16
|
+
Enabled: true
|
17
|
+
Style/ArgumentsForwarding: # (new in 1.1)
|
18
|
+
Enabled: true
|
19
|
+
Style/CollectionCompact: # (new in 1.2)
|
20
|
+
Enabled: true
|
21
|
+
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
|
22
|
+
Enabled: true
|
23
|
+
Style/NegatedIfElseCondition: # (new in 1.2)
|
24
|
+
Enabled: true
|
25
|
+
Style/NilLambda: # (new in 1.3)
|
26
|
+
Enabled: true
|
27
|
+
Style/RedundantArgument: # (new in 1.4)
|
28
|
+
Enabled: true
|
29
|
+
Style/SwapValues: # (new in 1.1)
|
30
|
+
Enabled: true
|
31
|
+
Style/WordArray:
|
32
|
+
EnforcedStyle: brackets
|
33
|
+
Layout/EndAlignment:
|
34
|
+
AutoCorrect: true
|
35
|
+
Style/StringLiterals:
|
36
|
+
EnforcedStyle: single_quotes
|
37
|
+
Metrics/BlockLength:
|
38
|
+
Exclude:
|
39
|
+
- 'test/**/*'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,47 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.0.0
|
4
|
+
|
5
|
+
Refactored code and functionality. The library was refactored in a way you need to instantiate a client with the API key to use it (more info in "Breaking changes"). 100% of the documented API is now supported and implemented.
|
6
|
+
|
7
|
+
The base API Response includes the `remaining_monthly_allowance` for your API key, `extra_allowance` and `allowance_refresh_timer`. These values are updated on the client instance on every request so you can use `client.remaining_monthly_client` to check how many requests the API key has left.
|
8
|
+
|
9
|
+
### New APIs
|
10
|
+
|
11
|
+
- `developers`
|
12
|
+
- `games_update`
|
13
|
+
- `genres`
|
14
|
+
- `platforms_by_name`
|
15
|
+
- `platforms_images`
|
16
|
+
- `publishers`
|
17
|
+
|
18
|
+
|
19
|
+
### Breaking changes:
|
20
|
+
|
21
|
+
- Dropped support for Ruby 2.4. The gem might still work on Ruby 2.4, but it's not being regularly tested for any version lower than 2.5.
|
22
|
+
|
23
|
+
- You now need to instantiate the Gamesdb::Client class passing in the api_key. E.g:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
> client = Gamesdb::Client.new(ENV['GAMESDB_API_KEY'])
|
27
|
+
|
28
|
+
|
29
|
+
> client = Gamesdb::Client.new('my_api_key')
|
30
|
+
> client.platforms
|
31
|
+
...
|
32
|
+
```
|
33
|
+
|
34
|
+
- Changes in methods:
|
35
|
+
|
36
|
+
- `platform_by_id` changes to `platforms_by_id`.
|
37
|
+
- `game_by_id` changes to `games_by_id`.
|
38
|
+
- `game_images` changes to `games_images`.
|
39
|
+
These APIs now support a string of comma delimited ids as parameters as well as the id Integer.
|
40
|
+
|
41
|
+
|
42
|
+
## 1.2.0
|
43
|
+
- Raise ArgumentError if api key isn't present
|
44
|
+
|
3
45
|
## 1.1.2
|
4
46
|
* Internal changes: update API endpoint url (adds `v1`), update tests
|
5
47
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,22 +1,40 @@
|
|
1
|
-
# Gamesdb
|
1
|
+
# Gamesdb 🎮 🕹
|
2
2
|
A Ruby gem to interact with [TheGamesDB](http://thegamesdb.net) API.
|
3
3
|
|
4
4
|
The Legacy API has been shutdown. The gem is now using the new API and you need to [request an API key](https://forums.thegamesdb.net/viewforum.php?f=10) to use it.
|
5
5
|
|
6
|
-
|
6
|
+
![Build Status](https://github.com/picandocodigo/gamesdb/workflows/Tests/badge.svg?branch=master)
|
7
7
|
[![Gem Version](https://badge.fury.io/rb/thegamesdb.svg)](https://badge.fury.io/rb/thegamesdb)
|
8
8
|
[![Maintainability](https://api.codeclimate.com/v1/badges/2dcf3cdcbe37adcea569/maintainability)](https://codeclimate.com/github/picandocodigo/gamesdb/maintainability)
|
9
|
-
[![Test Coverage](https://api.codeclimate.com/v1/badges/2dcf3cdcbe37adcea569/test_coverage)](https://codeclimate.com/github/picandocodigo/gamesdb/test_coverage)
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
* [Installation and Quick Start](#installation-and-quick-start)
|
11
|
+
* [General Usage](#usage)
|
12
|
+
* [Games](#games)
|
13
|
+
* [Games/ByGameID](#gamesbygameid)
|
14
|
+
* [Games/ByGameName](#gamesbygamename)
|
15
|
+
* [Games/ByGamePlaformID](#gamesbyplatformid)
|
16
|
+
* [Games/Images](#gamesimages)
|
17
|
+
* [Games/Updates](#gamesupdates)
|
18
|
+
* [Platforms](#platforms)
|
19
|
+
* [Platforms](#platforms-1)
|
20
|
+
* [Platforms/ByPlatformID](#platformsbyplatformid)
|
21
|
+
* [Platforms/ByPlatformName](#platformsbyplatformname)
|
22
|
+
* [Platforms/Images](#platformsimages)
|
23
|
+
* [Genres](#genres)
|
24
|
+
* [Developers](#developers)
|
25
|
+
* [Publishers](#publishers)
|
26
|
+
* [RubyDoc](https://www.rubydoc.info/gems/thegamesdb)
|
27
|
+
* [Development](#development)
|
28
|
+
* [Contributing](#contributing)
|
29
|
+
|
30
|
+
|
31
|
+
## Installation and Quick Start
|
32
|
+
|
33
|
+
This gem requires Ruby version 2.5 or more. Add this line to your application's Gemfile:
|
16
34
|
|
17
35
|
gem 'thegamesdb'
|
18
36
|
|
19
|
-
And
|
37
|
+
And run:
|
20
38
|
|
21
39
|
$ bundle install
|
22
40
|
|
@@ -24,85 +42,211 @@ Or install it in your system with:
|
|
24
42
|
|
25
43
|
$ gem install thegamesdb
|
26
44
|
|
27
|
-
|
45
|
+
To use this library, you'll need to request an API Key [here](https://forums.thegamesdb.net/viewforum.php?f=10). Once you have an API key, you can instantiate a Client:
|
28
46
|
|
29
|
-
```
|
30
|
-
|
47
|
+
```ruby
|
48
|
+
> client = Gamesdb::Client.new('<API_KEY>')
|
49
|
+
> response = client.platforms
|
31
50
|
```
|
32
51
|
|
33
|
-
|
52
|
+
**API Key allowances**
|
34
53
|
|
35
|
-
|
54
|
+
The base API Response includes the `remaining_monthly_allowance` for your API key, `extra_allowance` and `allowance_refresh_timer`. These values are updated on the client instance on every request so you can use `client.remaining_monthly_client` to check how many requests the API key has left.
|
36
55
|
|
37
|
-
|
38
|
-
GAMESDB_API_KEY='your_api_key' rake test
|
39
|
-
```
|
56
|
+
## Usage
|
40
57
|
|
41
|
-
|
42
|
-
```
|
43
|
-
GAMESDB_API_KEY='your_api_key' rake test TEST=test/platform_test.rb
|
44
|
-
```
|
58
|
+
The full documentation for the API is available [here](API Documentation: https://api.thegamesdb.net/). Here are the endpoints available on the gem:
|
45
59
|
|
46
|
-
|
60
|
+
### Games
|
47
61
|
|
48
|
-
## Endpoints available
|
49
62
|
|
50
|
-
|
63
|
+
#### Games/ByGameID
|
64
|
+
- **[RubyDoc](https://www.rubydoc.info/github/picandocodigo/gamesdb/master/Gamesdb/Games#games_by_id-instance_method)**
|
65
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Games/GamesByGameID)**
|
51
66
|
|
52
|
-
|
67
|
+
Usage:
|
53
68
|
|
54
|
-
|
69
|
+
```ruby
|
70
|
+
> client.games_by_id(6177)
|
71
|
+
=> {
|
72
|
+
:id=>6177,
|
73
|
+
:game_title=>"Super Turrican",
|
74
|
+
:release_date=>"1993-05-01",
|
75
|
+
:platform=>6,
|
76
|
+
:players=>1,
|
77
|
+
:overview=>"Super Turrican is the next generation installment of the famous Turrican Series. Once again it is up to the U.S.S. Freedom Forces to get into their Turrican Assault Suits and drive back the forces of \"The Machine\".\r\n\r\nSimilar to it's predecessors, Super Turican features large levels that are crammed with secrets and can be explored freely and in any direction. To get rid of the numerous enemies, Turrican can use three upgradeable shots: A spreadshot, a powerful laser and a rebound that bounces off of walls. Additionally, there is a Freeze-Beam that can be used to temporarily freeze enemies. It is fully rotatable, and therefor also a great help in discovering secret capsules. These capsules contain powerups and can often be used to reach secret areas. Last but not least, Turrican has the ability to transform into an energy wheel (as long as he has enough special energy), which enables him to lay mines and even makes him invincible.",
|
78
|
+
:last_updated=>"2018-07-11 21:05:25",
|
79
|
+
:rating=>"T - Teen",
|
80
|
+
:coop=>"No",
|
81
|
+
:youtube=>nil,
|
82
|
+
:os=>nil,
|
83
|
+
:processor=>nil,
|
84
|
+
:ram=>nil,
|
85
|
+
:hdd=>nil,
|
86
|
+
:video=>nil,
|
87
|
+
:sound=>nil,
|
88
|
+
:developers=>[2976],
|
89
|
+
:genres=>[8],
|
90
|
+
:publishers=>[454],
|
91
|
+
:alternates=>nil
|
92
|
+
}
|
93
|
+
```
|
55
94
|
|
56
|
-
|
95
|
+
Supports both an Array of ids or comma delimited list:
|
57
96
|
|
58
97
|
```ruby
|
59
|
-
>
|
60
|
-
=>
|
98
|
+
> client.games_by_id("6177, 6178")
|
99
|
+
=> [
|
100
|
+
{:id=>6177, :game_title=>"Super Turrican", :release_date=>"1993-05-01", :platform=>6, :players=>1, :overview=>"Super Turrican is the next generation installment of the famous Turrican Series. Once again it is up to the U.S.S. Freedom Forces to get into their Turrican Assault Suits and drive back the forces of \"The Machine\".\r\n\r\nSimilar to it's predecessors, Super Turican features large levels that are crammed with secrets and can be explored freely and in any direction. To get rid of the numerous enemies, Turrican can use three upgradeable shots: A spreadshot, a powerful laser and a rebound that bounces off of walls. Additionally, there is a Freeze-Beam that can be used to temporarily freeze enemies. It is fully rotatable, and therefor also a great help in discovering secret capsules. These capsules contain powerups and can often be used to reach secret areas. Last but not least, Turrican has the ability to transform into an energy wheel (as long as he has enough special energy), which enables him to lay mines and even makes him invincible.", :last_updated=>"2018-07-11 21:05:25", :rating=>"T - Teen", :coop=>"No", :youtube=>nil, :os=>nil, :processor=>nil, :ram=>nil, :hdd=>nil, :video=>nil, :sound=>nil, :developers=>[2976], :genres=>[8], :publishers=>[454], :alternates=>nil},
|
101
|
+
{:id=>6178, :game_title=>"Super Turrican 2", :release_date=>"1995-11-01", :platform=>6, :players=>1, :overview=>"Twice the Firepower, Twice the burn.\r\n\r\nIf you haven’t played Super Turrican, chances are you won’t last past the intro sequence here... As an intergalactic hero-wannabe commissioned to crush a venomous mutant armada, you are thrust into a chaotic world even more violent than the original. This time there are more enemies to torch (and be torched by)-including the most heinous level bosses on 16-bit-and enough Mode7 graphic levels to make you wish mommy were there to hold your hand. But she’ll be busy cleaning up your charred carcass.\r\n\r\nSuper Turrican 2. Feel the burn.", :last_updated=>"2019-01-24 13:38:26", :rating=>"T - Teen", :coop=>"No", :youtube=>"", :os=>nil, :processor=>nil, :ram=>nil, :hdd=>nil, :video=>nil, :sound=>nil, :developers=>[2976], :genres=>[8], :publishers=>[43], :alternates=>nil}
|
102
|
+
]
|
61
103
|
```
|
62
104
|
|
63
|
-
|
105
|
+
#### Games/ByGameName
|
106
|
+
|
107
|
+
- **[RubyDoc](https://www.rubydoc.info/github/picandocodigo/gamesdb/master/Gamesdb/Games#games_by_name-instance_method)**
|
108
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Games/GamesByGameName)**
|
64
109
|
|
65
110
|
Usage:
|
66
111
|
|
67
112
|
```ruby
|
68
|
-
>
|
69
|
-
=> [
|
70
|
-
]
|
113
|
+
> client.games_by_name("Mario Kart")
|
114
|
+
=> [
|
115
|
+
{:id=>266, :game_title=>"Mario Kart 64", :release_date=>"1997-02-10", :platform=>3, :developers=>[6037]},
|
116
|
+
{:id=>47050, :game_title=>"Mario Kart 64", :release_date=>"2016-12-29", :platform=>38, :developers=>[6037]},
|
117
|
+
{:id=>55187, :game_title=>"Mario Kart 64 (VC)", :release_date=>"2007-01-29", :platform=>9, :developers=>[6041]},
|
118
|
+
{:id=>64547, :game_title=>"Mario Kart 64 [Not for Resale]", :release_date=>"1997-02-10", :platform=>3, :developers=>nil},
|
119
|
+
{:id=>12733, :game_title=>"Mario Kart 7", :release_date=>"2011-12-04", :platform=>4912, :developers=>[7160]},
|
120
|
+
{:id=>17444, :game_title=>"Mario Kart 8", :release_date=>"2014-05-30", :platform=>38, :developers=>[6037]},
|
121
|
+
{:id=>42294, :game_title=>"Mario Kart 8 Deluxe", :release_date=>"2017-04-28", :platform=>4971, :developers=>[6037]},
|
122
|
+
{:id=>10750, :game_title=>"Mario Kart Arcade GP", :release_date=>"2005-10-12", :platform=>23, :developers=>[5804]}, ...
|
123
|
+
]
|
71
124
|
```
|
72
|
-
|
125
|
+
#### Games/ByPlatformID
|
126
|
+
|
127
|
+
- **[RubyDoc](https://www.rubydoc.info/github/picandocodigo/gamesdb/master/Gamesdb/Games#games_by_platform_id-instance_method)**
|
128
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Games/GamesByPlatformID)**
|
73
129
|
|
74
130
|
Usage:
|
75
131
|
|
76
132
|
```ruby
|
77
|
-
|
78
|
-
=> [
|
133
|
+
> client.games_by_platform_id(7)
|
134
|
+
=> [
|
135
|
+
{:name=>"Donkey Kong", :id=>5, :release_date=>"1982-01-01", :developers=>[6037]},
|
136
|
+
{:name=>"Bionic Commando", :id=>76, :release_date=>"1988-12-06", :developers=>[1436]},
|
137
|
+
{:name=>"Super Mario Bros. 3", :id=>112, :release_date=>"1990-02-12", :developers=>[6055]},
|
138
|
+
{:name=>"The Legend of Zelda", :id=>113, :release_date=>"1987-07-01", :developers=>[6055]},
|
139
|
+
{:name=>"Kirby's Adventure", :id=>121, :release_date=>"1993-03-26", :developers=>[3694]},
|
140
|
+
{:name=>"Metroid", :id=>123, :release_date=>"1987-08-15", :developers=>[6051]},
|
141
|
+
{:name=>"Mega Man 5", :id=>125, :release_date=>"1992-12-04", :developers=>[1436]},
|
142
|
+
{:name=>"Kid Icarus", :id=>130, :release_date=>"1986-12-18", :developers=>[6037]},
|
143
|
+
{:name=>"Lemmings", :id=>133, :release_date=>"1991-02-14", :developers=>[2404]},
|
144
|
+
{:name=>"Castlevania", :id=>135, :release_date=>"1987-05-01", :developers=>[4765]},
|
145
|
+
{:name=>"Super Mario Bros.", :id=>140, :release_date=>"1985-09-13", :developers=>[6042]}, ...
|
79
146
|
]
|
80
147
|
```
|
81
148
|
|
82
149
|
Supports comma delimited list:
|
83
150
|
|
84
151
|
```ruby
|
85
|
-
|
152
|
+
> client.games_by_platform_id("4950,4948")
|
86
153
|
```
|
87
154
|
|
88
|
-
|
155
|
+
#### Games/Images
|
156
|
+
|
157
|
+
- **[RubyDoc](https://www.rubydoc.info/github/picandocodigo/gamesdb/master/Gamesdb/Games#games_images-instance_method)**
|
158
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Games/GamesImages)**
|
159
|
+
|
160
|
+
Usage:
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
> client.games_images(121)
|
164
|
+
=> {
|
165
|
+
:base_url=>"https://cdn.thegamesdb.net/images/original/",
|
166
|
+
:logo=>"clearlogo/121.png",
|
167
|
+
:boxart=>{
|
168
|
+
:front=>{:url=>"boxart/front/121-1.jpg", :resolution=>"1536x2100", :width=>"1536", :height=>"2100"},
|
169
|
+
:back=>{:url=>"boxart/back/121-1.jpg", :resolution=>"1539x2100", :width=>"1539", :height=>"2100"}
|
170
|
+
},
|
171
|
+
:screenshot=>[
|
172
|
+
{:id=>104578, :type=>"screenshot", :side=>nil, :filename=>"screenshots/121-1.jpg", :resolution=>nil},
|
173
|
+
{:id=>104580, :type=>"screenshot", :side=>nil, :filename=>"screenshots/121-2.jpg", :resolution=>nil}
|
174
|
+
],
|
175
|
+
:fanart=>[
|
176
|
+
{:url=>"fanart/121-1.jpg", :resolution=>"1920x1080", :width=>"1920", :height=>"1080"},
|
177
|
+
{:url=>"fanart/121-2.jpg", :resolution=>"1920x1080", :width=>"1920", :height=>"1080"}
|
178
|
+
]
|
179
|
+
}
|
180
|
+
```
|
181
|
+
|
182
|
+
#### Games/Updates
|
183
|
+
|
184
|
+
- **[RubyDoc](https://www.rubydoc.info/github/picandocodigo/gamesdb/master/Gamesdb/Games#games_update-instance_method)**
|
185
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Games/GamesUpdates)**
|
89
186
|
|
90
187
|
Usage:
|
91
188
|
|
92
189
|
```ruby
|
93
|
-
>
|
94
|
-
|
190
|
+
> client.games_update(1000)
|
191
|
+
=> {:updates=> [
|
192
|
+
{"edit_id"=>1001, "game_id"=>60054, "timestamp"=>"2018-07-02 05:54:36", "type"=>"publisher", "value"=>"Semi Secret Software"},
|
193
|
+
{"edit_id"=>1002, "game_id"=>60054, "timestamp"=>"2018-07-02 05:54:36", "type"=>"youtube", "value"=>""},
|
194
|
+
{"edit_id"=>1003, "game_id"=>60054, "timestamp"=>"2018-07-02 05:54:36", "type"=>"platform", "value"=>"4916"},
|
195
|
+
{"edit_id"=>1004, "game_id"=>60054, "timestamp"=>"2018-07-02 05:54:36", "type"=>"genre", "value"=>"|Action|"},
|
196
|
+
{"edit_id"=>1005, "game_id"=>60054, "timestamp"=>"2018-07-02 05:54:36", "type"=>"rating", "value"=>"E10+ - Everyone 10+"},
|
197
|
+
{"edit_id"=>1006, "game_id"=>60054, "timestamp"=>"2018-07-02 05:57:09", "type"=>"series", "value"=>"series/60054-1.jpg"},
|
198
|
+
{"edit_id"=>1007, "game_id"=>55249, "timestamp"=>"2018-07-02 05:57:17", "type"=>"boxart", "value"=>"boxart/front/55249-1.jpg"},
|
199
|
+
{"edit_id"=>1008, "game_id"=>60054, "timestamp"=>"2018-07-02 05:57:26", "type"=>"boxart", "value"=>"boxart/front/60054-1.jpg"},
|
200
|
+
{"edit_id"=>1009, "game_id"=>60055, "timestamp"=>"2018-07-02 05:57:37", "type"=>"game", "value"=>"[NEW]"},
|
201
|
+
{"edit_id"=>1010, "game_id"=>60055, "timestamp"=>"2018-07-02 05:57:37", "type"=>"game_title", "value"=>"Star Breaker"},
|
202
|
+
...
|
203
|
+
],
|
204
|
+
:previous_page=>nil,
|
205
|
+
:next_page=>2
|
206
|
+
}
|
95
207
|
```
|
96
|
-
|
208
|
+
|
209
|
+
Pages:
|
210
|
+
|
211
|
+
```ruby
|
212
|
+
>response = client.games_update(1000, page: 100)
|
213
|
+
=> {:updates=> [
|
214
|
+
{"edit_id"=>11073, "game_id"=>36224, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[1044]},
|
215
|
+
{"edit_id"=>11074, "game_id"=>36229, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[1044]},
|
216
|
+
{"edit_id"=>11075, "game_id"=>36230, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[1044]},
|
217
|
+
{"edit_id"=>11076, "game_id"=>36252, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[47]},
|
218
|
+
{"edit_id"=>11077, "game_id"=>36284, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[1044]},
|
219
|
+
{"edit_id"=>11078, "game_id"=>36379, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[1044]},
|
220
|
+
{"edit_id"=>11079, "game_id"=>36740, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[171]},
|
221
|
+
{"edit_id"=>11080, "game_id"=>36757, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[731]},
|
222
|
+
{"edit_id"=>11081, "game_id"=>36777, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[309]},
|
223
|
+
{"edit_id"=>11082, "game_id"=>36785, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[731]},
|
224
|
+
...
|
225
|
+
],
|
226
|
+
:previous_page=>99,
|
227
|
+
:next_page=>101
|
228
|
+
}
|
229
|
+
>next_page = client.games_update(1000, page: response[:next_page])
|
230
|
+
=> {:updates=> [
|
231
|
+
{"edit_id"=>11173, "game_id"=>48037, "timestamp"=>"2018-07-27 23:10:44", "type"=>"publishers", "value"=>[1044]},
|
232
|
+
],
|
233
|
+
:previous_page=>100,
|
234
|
+
:next_page=>102
|
235
|
+
}
|
236
|
+
```
|
237
|
+
|
97
238
|
|
98
239
|
### Platforms
|
99
240
|
|
100
|
-
|
241
|
+
#### Platforms
|
242
|
+
|
243
|
+
- **[RubyDoc](https://www.rubydoc.info/github/picandocodigo/gamesdb/master/Gamesdb/Platforms#platforms-instance_method)**
|
244
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Platforms/Platforms)**
|
101
245
|
|
102
246
|
Usage:
|
103
247
|
```ruby
|
104
|
-
|
105
|
-
|
248
|
+
> client.platforms
|
249
|
+
=> [
|
106
250
|
{:name=>"3DO", :id=>25, :slug=>"3do"},
|
107
251
|
{:name=>"Acorn Archimedes", :id=>4944, :slug=>"acorn-archimedes"},
|
108
252
|
{:name=>"Acorn Electron", :id=>4954, :slug=>"acorn-electron"},
|
@@ -113,28 +257,145 @@ Gamesdb.platforms
|
|
113
257
|
{:name=>"Android", :id=>4916, :slug=>"android"},
|
114
258
|
...
|
115
259
|
```
|
116
|
-
|
260
|
+
|
261
|
+
#### Platforms/ByPlatformID
|
262
|
+
|
263
|
+
- **[RubyDoc](https://www.rubydoc.info/github/picandocodigo/gamesdb/master/Gamesdb/Platforms#platforms_by_id-instance_method)**
|
264
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Platforms/PlatformsByPlatformID)**
|
117
265
|
|
118
266
|
Usage:
|
119
267
|
```ruby
|
120
|
-
>
|
121
|
-
=> {
|
268
|
+
> client.platform_by_id(7)
|
269
|
+
=> {
|
270
|
+
:id=>7,
|
271
|
+
:name=>"Nintendo Entertainment System (NES)",
|
272
|
+
:alias=>"nintendo-entertainment-system-nes",
|
273
|
+
:icon=>"nintendo-entertainment-system-nes-1336524652.png",
|
274
|
+
:console=>"7.png",
|
275
|
+
:controller=>"7.png",
|
276
|
+
:developer=>"Nintendo",
|
277
|
+
:manufacturer=>"Nintendo",
|
278
|
+
:media=>"Cartridge",
|
279
|
+
:cpu=>"Ricoh 2A03",
|
280
|
+
:memory=>"2KB RAM",
|
281
|
+
:graphics=>"RP2C02",
|
282
|
+
:sound=>"Pulse Code Modulation",
|
283
|
+
:maxcontrollers=>"2",
|
284
|
+
:display=>"RGB",
|
285
|
+
:overview=>"The Nintendo Entertainment System (also abbreviated as NES or simply called Nintendo) is an 8-bit video game console that was released by Nintendo in North America during 1985, in Europe during 1986 and Australia in 1987. In most of Asia, including Japan (where it was first launched in 1983), China, Vietnam, Singapore, the Middle East and Hong Kong, it was released as the Family Computer, commonly shortened as either the romanized contraction Famicom, or abbreviated to FC. In South Korea, it was known as the Hyundai Comboy, and was distributed by Hynix which then was known as Hyundai Electronics.\r\n\r\nAs the best-selling gaming console of its time, the NES helped revitalize the US video game industry following the video game crash of 1983, and set the standard for subsequent consoles of its generation. With the NES, Nintendo introduced a now-standard business model of licensing third-party developers, authorizing them to produce and distribute software for Nintendo's platform.",
|
286
|
+
:youtube=>nil
|
287
|
+
}
|
122
288
|
```
|
123
289
|
|
124
|
-
|
125
|
-
|
290
|
+
#### Platforms/ByPlatformName
|
291
|
+
|
292
|
+
- **[RubyDoc](https://www.rubydoc.info/github/picandocodigo/gamesdb/master/Gamesdb/Platforms#platforms_by_name-instance_method)**
|
293
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Platforms/PlatformsByPlatformName)**
|
294
|
+
|
295
|
+
Usage:
|
296
|
+
```ruby
|
297
|
+
> client.platforms_by_name("Nintendo")
|
298
|
+
=> [
|
299
|
+
{:id=>4912, :name=>"Nintendo 3DS", :alias=>"nintendo-3ds", :icon=>"nintendo-3ds-1344286647.png", :console=>"4912.png", :controller=>nil, :developer=>"Nintendo", :manufacturer=>"Nintendo", :media=>"Cartridge", :cpu=>"Nintendo ARM", :memory=>"128 MB FCRAM", :graphics=>"PICA200 by Digital Media Professionals", :sound=>nil, :maxcontrollers=>"1", :display=>"800 × 240 px (effectively 400 × 240 WQVGA per eye)", :overview=>"...", :youtube=>nil},
|
300
|
+
{:id=>3, :name=>"Nintendo 64", :alias=>"nintendo-64", :icon=>"nintendo-64-1336524631.png", :console=>"3.png", :controller=>"3.png", :developer=>"Nintendo", :manufacturer=>"Nintendo", :media=>"Cartridge", :cpu=>"93.75 MHz NEC VR4300", :memory=>"4 MB RDRAM (8 MB with Expansion Pack)", :graphics=>"62.5 MHz SGI RCP", :sound=>"48 kHz with 16-bit audio", :maxcontrollers=>"4", :display=>"320 x 240 or 640 x 480 (supported by Expansion Pack)", :overview=>"...", :youtube=>"Up9jO2l2wqo"},
|
301
|
+
{:id=>8, :name=>"Nintendo DS", :alias=>"nintendo-ds", :icon=>"nintendo-ds-1336524642.png", :console=>"8.png", :controller=>nil, :developer=>"Nintendo", :manufacturer=>"Foxconn", :media=>"Cartridge", :cpu=>"ARM9", :memory=>"4 MB RAM", :graphics=>"ARM946E-S", :sound=>"ARM7TDMI", :maxcontrollers=>"1", :display=>"256 × 192", :overview=>"...", :youtube=>nil},
|
302
|
+
{:id=>7, :name=>"Nintendo Entertainment System (NES)", :alias=>"nintendo-entertainment-system-nes", :icon=>"nintendo-entertainment-system-nes-1336524652.png", :console=>"7.png", :controller=>"7.png", :developer=>"Nintendo", :manufacturer=>"Nintendo", :media=>"Cartridge", :cpu=>"Ricoh 2A03", :memory=>"2KB RAM", :graphics=>"RP2C02", :sound=>"Pulse Code Modulation", :maxcontrollers=>"2", :display=>"RGB", :overview=>"..."}, (...)
|
303
|
+
]
|
304
|
+
```
|
305
|
+
|
306
|
+
#### Platforms/Images
|
307
|
+
|
308
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Platforms/PlatformsImages)**
|
309
|
+
|
310
|
+
Usage:
|
311
|
+
```ruby
|
312
|
+
> client.platform_images(7)
|
313
|
+
=> [
|
314
|
+
{"id"=>22, "type"=>"banner", "filename"=>"platform/banners/7-1.png"},
|
315
|
+
{"id"=>38, "type"=>"fanart", "filename"=>"platform/fanart/7-1.jpg"},
|
316
|
+
{"id"=>39, "type"=>"fanart", "filename"=>"platform/fanart/7-2.jpg"},
|
317
|
+
{"id"=>60, "type"...
|
318
|
+
```
|
319
|
+
|
320
|
+
Using a filter for type:
|
321
|
+
```ruby
|
322
|
+
> client.platform_images(7, filter: 'boxart')
|
323
|
+
=> [{"id"=>222, "type"=>"boxart", "filename"=>"platform/boxart/7-2.jpg"}]
|
324
|
+
```
|
126
325
|
|
127
326
|
### Genres
|
128
327
|
|
129
|
-
- [
|
328
|
+
- **[RubyDoc](https://www.rubydoc.info/github/picandocodigo/gamesdb/master/Gamesdb/Genres#genres-instance_method)**
|
329
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Genres/Genres)**
|
330
|
+
|
331
|
+
Usage:
|
332
|
+
|
333
|
+
```ruby
|
334
|
+
> client.genres
|
335
|
+
=> [
|
336
|
+
{"id"=>1, "name"=>"Action"},
|
337
|
+
{"id"=>2, "name"=>"Adventure"},
|
338
|
+
{"id"=>20, "name"=>"Board"},
|
339
|
+
{"id"=>3, "name"=>"Construction and Management Simulation"},
|
340
|
+
{"id"=>21, "name"=>"Education"},
|
341
|
+
...
|
342
|
+
]
|
343
|
+
|
344
|
+
```
|
130
345
|
|
131
346
|
### Developers
|
132
347
|
|
133
|
-
- [ ]
|
348
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Developers/Developers)**
|
349
|
+
|
350
|
+
Usage:
|
351
|
+
|
352
|
+
```ruby
|
353
|
+
> client.developers
|
354
|
+
=> [
|
355
|
+
{"id"=>142, "name"=>"?"},
|
356
|
+
{"id"=>9916, "name"=>".dat"},
|
357
|
+
{"id"=>2, "name"=>".theprodukkt"},
|
358
|
+
{"id"=>9898, "name"=>"[adult swim] games"},
|
359
|
+
{"id"=>9899, "name"=>"[bracket]games"},
|
360
|
+
{"id"=>9900, "name"=>"[erka:es]"},
|
361
|
+
{"id"=>10472, "name"=>"[RON]"},
|
362
|
+
{"id"=>9901, "name"=>"][ Games Inc"},
|
363
|
+
{"id"=>145, "name"=>"@nifty"},
|
364
|
+
...
|
365
|
+
]
|
366
|
+
```
|
134
367
|
|
135
368
|
### Publishers
|
136
369
|
|
137
|
-
- [ ]
|
370
|
+
- **[Swagger API Documentation](https://api.thegamesdb.net/#/Publishers/Publishers)**
|
371
|
+
|
372
|
+
Usage:
|
373
|
+
|
374
|
+
```ruby
|
375
|
+
> client.publishers
|
376
|
+
=> [
|
377
|
+
{"id"=>2374, "name"=>".GEARS Studios"},
|
378
|
+
{"id"=>2090, "name"=>"1-Pup Games"},
|
379
|
+
{"id"=>4045, "name"=>"10 out of 10"},
|
380
|
+
{"id"=>5898, "name"=>"10Ants Hill"},
|
381
|
+
{"id"=>3542, "name"=>"10tons Ltd."},
|
382
|
+
{"id"=>1188, "name"=>"11 bit studios"},
|
383
|
+
...
|
384
|
+
]
|
385
|
+
```
|
386
|
+
|
387
|
+
## Development
|
388
|
+
|
389
|
+
Run all tests:
|
390
|
+
|
391
|
+
```
|
392
|
+
GAMESDB_API_KEY='your_api_key' rake test
|
393
|
+
```
|
394
|
+
|
395
|
+
Run a single test:
|
396
|
+
```
|
397
|
+
GAMESDB_API_KEY='your_api_key' rake test TEST=test/platform_test.rb
|
398
|
+
```
|
138
399
|
|
139
400
|
## Contributing
|
140
401
|
|