Project

endow

0.0
No commit activity in last 3 years
No release in over 3 years
A library to assist in consuming API endpoints.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

Endow

A library to assist in consuming API endpoints.

Installation

Add this line to your application's Gemfile:

gem 'endow'

And then execute:

$ bundle

Or install it yourself as:

$ gem install endow

Usage

Setting URI Content (URI Parameters)

Restful URIs sometimes use templated URI parameters, a la Rails, ie. /people/:id or people/:person_id/things. To set the content of the URI parmeters use the #set_uri_content method. You must implement the #endpoint_template method as opposed to the endpoint method when using URI parameters.

class SomeEndpoint < Endow::Endpoint
  def initialize( attributes )
    @attributes = attributes

    set_uri_content( attributes.slice( :person_id ))
    set_content( attributes.slice( :thing ))
  end

  def endpoint_template
    'people/:person_id/things'
  end

  def http_verb
    :post
  end
end