0.0
No commit activity in last 3 years
No release in over 3 years
A simple wrapper for the awesome GiantBomb.com API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

= 2.6
= 1.7.6

Runtime

= 0.7.15
= 1.1.0
= 0.8.3
 Project Readme

bomb_defuser

A simple wrapper for the awesome GiantBomb.com API.

Does bomb_defuser helps your daily work with Ruby? So, please recommend me in Work With Rails and thanks for your kindness! :)

How?

First, install the gem:

$ [sudo] gem install bomb_defuser

Then, add it as a dependency of your code using your favorite way (a simple require or mechanisms like the Bundler gem).

Using it is really simple.

First, you need an API key. Then, configure bomb_defuser to use it:

BombDefuser::Configuration.api_key = "my api key"

Now to the real data consumption. There are two kinds of entities: a Resource (single entity) and a ResourceList (list of entities).

An example of Resource is a Game. To get data about a particular game you can do the following:

>> BombDefuser::Game.details(17280)
=> <#Hashie::Mash name="BioShock" ...>

An example of a ResourceList is a GameList. To get a list of games you can do the following:

>> BombDefuser::GameList.fetch
=> [<#Hashie::Mash name="BioShock" ...>, <#Hashie::Mash name="Civilization V" ...>, ...]

As you can see, the gem makes use of Hashie’s Mash, which basically is a Hash with attribute accessors for all keys, meaning you can use the dot notation to access values:

>> game = BombDefuser::Game.details(17280)
=> <#Hashie::Mash name="BioShock" ...>
>> game.name
=> "BioShock"

For a Resource, the return will always be a Mash instance. For a ResourceList, it will be an Array of Mash instances.

A Resource has one method (details) which receives the entity id.

A ResourceList has one method (fetch) which receives two numeric parameters regarding pagination: the first one is the current page and the second one is the amount of elements per page.

The GameList can also send a “platforms” parameter, which is an Array containing the ids of the gaming platforms that will be used to filter the results:

>> BombDefuser::GameList.platforms = [35, 129]
=> [35, 129]
>> BombDefuser::GameList.fetch
=> [<#Hashie::Mash name="Uncharted" ...>, <#Hashie::Mash name="God of War" ...>, ...]

The other lists do not feature additional filters at the moment.

For further reference, please check the official API documentation.

Available endpoints

Resources:

  • Company
  • Game
  • Genre
  • Platform
  • Theme

Resource lists:

  • Companies
  • Games
  • Genres
  • Platforms
  • Themes

Additional configuration

Besides the API key, the Configuration class allows you to configure an adapter to make HTTP requests (you can use the included CurbAdapter. and its specs as an example of implementation) and a logger (STDOUT by default).

Next steps

Currently you can browse the collections and get details about each type of resource, but you can’t do arbitrary searches (like finding games by name). This is the next logical step and will soon be implemented.

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don’t break it in a
    future version unintentionally.
  • Commit, do not mess with rakefile, version, or history.
    (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

License

sentinel is released under the MIT license. See MIT LICENSE.