Class RestClient::Request
In: lib/restclient/exceptions.rb
lib/restclient/request.rb
Parent: Object

This class is used internally by RestClient to send the request, but you can also call it directly if you‘d like to use a method not supported by the main API. For example:

  RestClient::Request.execute(:method => :head, :url => 'http://example.com')

Mandatory parameters:

  • :method
  • :url

Optional parameters (have a look at ssl and/or uri for some explanations):

  • :headers a hash containing the request headers
  • :cookies will replace possible cookies in the :headers
  • :user and :password for basic auth, will be replaced by a user/password available in the :url
  • :block_response call the provided block with the HTTPResponse as parameter
  • :raw_response return a low-level RawResponse instead of a Response
  • :max_redirects maximum number of redirections (default to 10)
  • :verify_ssl enable ssl verification, possible values are constants from OpenSSL::SSL
  • :timeout and :open_timeout
  • :ssl_client_cert, :ssl_client_key, :ssl_ca_file

Methods

Constants

Redirect = RestClient::Redirect
Unauthorized = RestClient::Unauthorized
RequestFailed = RestClient::RequestFailed

Attributes

args  [R] 
cookies  [R] 
headers  [R] 
max_redirects  [R] 
method  [R] 
open_timeout  [R] 
password  [R] 
payload  [R] 
processed_headers  [R] 
raw_response  [R] 
ssl_ca_file  [R] 
ssl_client_cert  [R] 
ssl_client_key  [R] 
timeout  [R] 
url  [R] 
user  [R] 
verify_ssl  [R] 

Public Class methods

Public Instance methods

Extract the query parameters for get request and append them to the url

Return a hash of headers whose keys are capitalized strings

[Validate]