Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A wrapper for RestClient providing a User Agent style cookie jar and OpenID authentication.
branch: master

This branch is 4 commits behind chef:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/opscode
script
spec
.gitignore
LICENSE
NOTICE
README.rdoc
Rakefile

README.rdoc

Opscode::REST

This is a wrapper around the excellent RestClient gem. It provides for some basic User-Agent style functionality (like a simple cookie jar), does JSON inflation, and handles redirects like a web browser. In addition, it knows how to do OpenID authentication with Opscode-style OpenID providers (used mainly for API level authentication, unattended by human beings.)

To use:

r = Opscode::REST
r.get("http://localhost") # Requests application/json from localhost

# Send a PUT with :one => 'two' form-encoded.
r.put("http://localhost", { :payload => { :one => 'two' }})

# Send a PUT with a JSON hash
r.put("http://localhost", { :payload => { :one => 'two'}.to_json })

# Post is just like PUT

# Delete is just like GET

# Authenticate to a Chef Server as 'adam' with the secret 'monkey'.
#
# First argument is the openid consumer, second is your openid, followed by your password.
r.authenticate(
  'http://localhost:4000/openid/consumer/start',    
  'http://localhost:4001/openid/server/node/adam', 
  'monkey'
)

See the RDOC for more information.

Opscode::REST::Resource

This behaves exactly like RestClient::Resource. The difference is that we utilize the Opscode::REST wrapper under the hood, and it supports the authentication method from above.

Something went wrong with that request. Please try again.