A ruby DSL for consuming RESTful APIs
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gemspec
.gitignore
.rspec
.rvmrc
Gemfile
Gemfile.lock
README.md
Rakefile

README.md

restafari

A ruby DSL for consuming RESTful APIs

usage

  @require "restafari"
  class MyClass
    @include Restafari::Action

    action :sign_in, "/path", {
      default: "value"
    }
  end

Now, from your code, you simply do:

  result = MyClass.sign_in

  result[:success] == true #you can access the response body via hash-like
  result.success == true #or as a method

You can also hook into the request and add your own filters(i.e for signing and other global params)

  Restafari.config.before_request do |params|
    params[:test] = true
  end

this will add the "test" parameter to each request.