Class Chef::REST
In: lib/chef/rest/auth_credentials.rb
lib/chef/rest/rest_request.rb
lib/chef/rest/cookie_jar.rb
lib/chef/rest.rb
Parent: Object

Chef::REST

Chef‘s custom REST client with built-in JSON support and RSA signed header authentication.

Methods

Classes and Modules

Class Chef::REST::AuthCredentials
Class Chef::REST::CookieJar
Class Chef::REST::NoopInflater
Class Chef::REST::RESTRequest

Constants

CONTENT_ENCODING = "content-encoding".freeze
GZIP = "gzip".freeze
DEFLATE = "deflate".freeze
IDENTITY = "identity".freeze

Attributes

auth_credentials  [R] 
cookies  [RW] 
redirect_limit  [RW] 
sign_on_redirect  [RW] 
url  [RW] 

Public Class methods

Create a REST client object. The supplied url is used as the base for all subsequent requests. For example, when initialized with a base url localhost:4000, a call to get_rest with ‘nodes’ will make an HTTP GET request to localhost:4000/nodes

Public Instance methods

Runs an HTTP request to a JSON API with JSON body. File Download not supported.

Send an HTTP DELETE request to the path

Streams a download to a tempfile, then yields the tempfile to a block. After the download, the tempfile will be closed and unlinked. If you rename the tempfile, it will not be deleted. Beware that if the server streams infinite content, this method will stream it until you run out of disk space.

Send an HTTP GET request to the path

Using this method to fetch a file is considered deprecated.

Parameters

path:The path to GET
raw:Whether you want the raw body returned, or JSON inflated. Defaults
  to JSON inflated.

Send an HTTP POST request to the path

Send an HTTP PUT request to the path

Runs an HTTP request to a JSON API with raw body. File Download not supported.

Makes a streaming download request. Doesn‘t speak JSON. Streams the response body to a tempfile. If a block is given, it‘s passed to Tempfile.open(), which means that the tempfile will automatically be unlinked after the block is executed.

If no block is given, the tempfile is returned, which means it‘s up to you to unlink the tempfile when you‘re done with it.

[Validate]