Quickly build Ruby clients for RESTful HTTP APIs
This is presently an experimental project, only being used to consume a rudimentary API. As such, the gems constraints are as follows:
- makes no use of API keys
- JSON only
- RESTful GET actions only (index/show, list/read)
Add this line to your application's Gemfile:
gem 'hapi', github: 'bchase/hapi'
And then execute:
$ bundle
module MTG
class Card < Hapi::REST::Collection
def self.service
@@service ||= Hapi::Service.new 'https://api.deckbrew.com/mtg'
end
end
end
cards = MTG::Card.index page: 1
card = cards.first
name = card.name
image = card.editions.last.image_url- Fork it ( http://github.com/bchase/hapi/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request