Project

restafari

0.0
No commit activity in last 3 years
No release in over 3 years
Helper class to work with the restful apis
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

 Project Readme

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.