Gamesdb

A Ruby gem to interact with TheGamesDB API.

The Legacy API has been shutdown. The gem is now using the new API and you need to request an API key to use it.

Build Status Gem Version Maintainability Test Coverage

Installation

This gem requires Ruby version 2.3 or more.

Add this line to your application's Gemfile:

gem 'thegamesdb'

And then run:

$ bundle install

Or install it in your system with:

$ gem install thegamesdb

Request an API Key here. Set the API key in your env variables:

GAMESDB_API_KEY='your_api_key'

Development

Run all tests:

GAMESDB_API_KEY='your_api_key' rake test

Run a single test:

GAMESDB_API_KEY='your_api_key' rake test TEST=test/platform_test.rb

Usage

Endpoints available

API Documentation: https://api.thegamesdb.net/

Games

Usage:

> Gamesdb.game_by_id(6177)
 => {: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} 

Usage:

> Gamesdb.games_by_name("Mario Kart")
 => [{:id=>266, :game_title=>"Mario Kart 64", :release_date=>"1997-02-10", :platform=>3, :developers=>[6037]}, {:id=>47050, :game_title=>"Mario Kart 64", :release_date=>"2016-12-29", :platform=>38, :developers=>[6037]}, {:id=>55187, :game_title=>"Mario Kart 64 (VC)", :release_date=>"2007-01-29", :platform=>9, :developers=>[6041]}, {:id=>64547, :game_title=>"Mario Kart 64 [Not for Resale]", :release_date=>"1997-02-10", :platform=>3, :developers=>nil}, {:id=>12733, :game_title=>"Mario Kart 7", :release_date=>"2011-12-04", :platform=>4912, :developers=>[7160]}, {:id=>17444, :game_title=>"Mario Kart 8", :release_date=>"2014-05-30", :platform=>38, :developers=>[6037]}, {:id=>42294, :game_title=>"Mario Kart 8 Deluxe", :release_date=>"2017-04-28", :platform=>4971, :developers=>[6037]}, {:id=>10750, :game_title=>"Mario Kart Arcade GP", :release_date=>"2005-10-12", :platform=>23, :developers=>[5804]}, ...
 ] 

Usage:

Gamesdb.games_by_platform_id(7)
 => [{: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]}, ...
 ]
  • [x] /Games/Images

Usage:

> Gamesdb.game_images(121)
 => {:base_url=>"https://cdn.thegamesdb.net/images/original/", :logo=>"clearlogo/121.png", :boxart=>{:front=>{:url=>"boxart/front/121-1.jpg", :resolution=>"1536x2100", :width=>"1536", :height=>"2100"}, :back=>{:url=>"boxart/back/121-1.jpg", :resolution=>"1539x2100", :width=>"1539", :height=>"2100"}}, :screenshot=>[{:id=>104578, :type=>"screenshot", :side=>nil, :filename=>"screenshots/121-1.jpg", :resolution=>nil}, {:id=>104580, :type=>"screenshot", :side=>nil, :filename=>"screenshots/121-2.jpg", :resolution=>nil}], :fanart=>[{:url=>"fanart/121-1.jpg", :resolution=>"1920x1080", :width=>"1920", :height=>"1080"}, {:url=>"fanart/121-2.jpg", :resolution=>"1920x1080", :width=>"1920", :height=>"1080"}]}
  • [ ] /Games/Updates

Platforms

Usage:

Gamesdb.platforms                                                                           
 => [
 {:name=>"3DO", :id=>25, :slug=>"3do"},
 {:name=>"Acorn Archimedes", :id=>4944, :slug=>"acorn-archimedes"},
 {:name=>"Acorn Electron", :id=>4954, :slug=>"acorn-electron"},
 {:name=>"Action Max", :id=>4976, :slug=>"action-max"},
 {:name=>"Amiga", :id=>4911, :slug=>"amiga"},
 {:name=>"Amiga CD32", :id=>4947, :slug=>"amiga-cd32"},
 {:name=>"Amstrad CPC", :id=>4914, :slug=>"amstrad-cpc"},
 {:name=>"Android", :id=>4916, :slug=>"android"},
 ...

Usage:

> Gamesdb.platform_by_id(7)
 => {: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=>"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.", :youtube=>nil}
  • [ ] /Platforms/ByPlatformName
  • [ ] /Platforms/Images

Genres

  • [ ] /Genres

Developers

  • [ ] /Developers

Publishers

  • [ ] /Publishers

Contributing

  1. Fork it ( http://github.com/picandocodogio/gamesdb/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write your tests and run GAMESDB_API_KEY='your_api_key' rake test (make sure they pass)
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request