Skip to content

chatura-atapattu/rested

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rested

DESCRIPTION:

Ruby library built on top of httpclient for working with RESTful APIs.

DOCUMENTATION:

Documentation is available online at at rdoc.info

FEATURES:

SYNOPSIS:

class Foo < Rested::Entity
  base_url    "http://api.example.com/entities/"
  endpoint    "foo"
  user        "[email protected]"
  pass        "foobar"

  field     :id, :baz, :bar
end

foo = Foo.find(1)
foo.baz = "frobnicator"
foo.save!

moe = Foo.new
moe.bar = "curly"
moe.save!
puts "new id is #{moe.id}"

# to upload a file
moe.add_file("param_name", "/path/to/file")
moe.save!

# non-entity based example

class Baz < Rested::Base
  base_url    "http://api.example.com/methods/"
  user        "[email protected]"
  pass        "foobar"

  def self.search(terms)
    params = {}
    params["terms"] = terms
    ret = post("/search", params)
    ret["search_results"]
  end

end

REQUIREMENTS:

  • httpclient

  • json

INSTALL:

With gemcutter:

sudo gem install rested

Without gemcutter:

git clone git://github.com/chetan/rested.git
cd rested
sudo rake install

LICENSE:

(The MIT License)

Copyright © 2010 Better Advertising, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Simple RESTful API client library

Resources

Stars

Watchers

Forks

Packages

No packages published