Luchadeer
The bombingest Giant Bomb API client library for Ruby.
Features
- Supports all resources exposed by the Giant Bomb API. For a full list, see the documentation.
- Caches API responses.
- Fully unit-tested.
- fully.recursive.dot.syntax, no random hash[:syntax] cutoff point
- Fetch full details for partial objects (e.g. embedded results) with object.detail.
- Use convenience methods on a default client per-thread, or use an alternate syntax for full control of the client object.
Configuration
Get your API key here. If you have a premium account, your API key should give you access to subscriber-only video resources, as well as links to HD-quality videos.
Luchadeer.configure(api_key: 'my_api_key') # default client for this thread
Luchadeer::Client.new(api_key: 'my_api_key')
Usage
# Resources by name
# (you can omit the search query if you like)
Luchadeer::Game.search 'persona 4'
my_client.games 'persona 4'
Luchadeer::Video.search 'unprofessional'
my_client.videos 'unprofessional'
# Resources by ID
Luchadeer::Game.find 21373
my_client.game 21373
Luchadeer::RatingBoard.find 3
my_client.rating_board 3
# Custom searches (some random examples, mix and match as you like)
Luchadeer.search(page: 1, limit: 50, query: 'valkyria')
Luchadeer.search do |s|
s.query = 'valkyria'
s.page = 1
s.limit = 50
end
search = Luchadeer::Search.new
search.page(1).limit(50).sort('name', :desc) # default is :asc
search.resources [Luchadeer::Game, Luchadeer::Character] # strings work too
search.query 'valkyria'
results = search.fetch
TODO
- Add custom filtering to search (i.e., the 'filter' request parameter).
- Make the caching layer more flexible - more options besides in-memory store. Add a null store, too.
- 'ghost' object pattern - lazy-load details for partial models when they're accessed, instead of requiring manual '.detail' invocation