Module: HTTP::Client

Defined in:
lib/http/client.rb

Defined Under Namespace

Classes: Error, Multipart, Request, Response

Constant Summary collapse

VERSION =
'0.6.1'
GET =
Net::HTTP::Get
HEAD =
Net::HTTP::Head
PUT =
Net::HTTP::Put
POST =
Net::HTTP::Post
DELETE =
Net::HTTP::Delete
OPTIONS =
Net::HTTP::Options
TRACE =
Net::HTTP::Trace
SSL_VERIFY_NONE =
OpenSSL::SSL::VERIFY_NONE
SSL_VERIFY_PEER =
OpenSSL::SSL::VERIFY_PEER

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.open_timeoutObject

Returns the value of attribute open_timeout.



26
27
28
# File 'lib/http/client.rb', line 26

def open_timeout
  @open_timeout
end

.read_timeoutObject

Returns the value of attribute read_timeout.



26
27
28
# File 'lib/http/client.rb', line 26

def read_timeout
  @read_timeout
end

.ssl_timeoutObject

Returns the value of attribute ssl_timeout.



26
27
28
# File 'lib/http/client.rb', line 26

def ssl_timeout
  @ssl_timeout
end

Class Method Details

.delete(uri, args = {}) ⇒ HTTP::Client::Response

Creates a DELETE request and executes it, returning the response.

Parameters:

  • uri (String or URI)

    Remote URI.

  • args (Hash) (defaults to: {})

    Options, see HTTP::Client::Request#initialize.

Returns:

See Also:



425
# File 'lib/http/client.rb', line 425

def delete uri, args = {}; Request.new(DELETE, uri, args).execute; end

.get(uri, args = {}) ⇒ HTTP::Client::Response

Creates a GET request and executes it, returning the response.

Parameters:

  • uri (String or URI)

    Remote URI.

  • args (Hash) (defaults to: {})

    Options, see HTTP::Client::Request#initialize.

Returns:

See Also:



398
# File 'lib/http/client.rb', line 398

def get uri, args = {}; Request.new(GET, uri, args).execute; end

.options(uri, args = {}) ⇒ HTTP::Client::Response

Creates a OPTIONS request and executes it, returning the response.

Parameters:

  • uri (String or URI)

    Remote URI.

  • args (Hash) (defaults to: {})

    Options, see HTTP::Client::Request#initialize.

Returns:

See Also:



434
# File 'lib/http/client.rb', line 434

def options uri, args = {}; Request.new(OPTIONS, uri, args).execute; end

.post(uri, args = {}) ⇒ HTTP::Client::Response

Creates a POST request and executes it, returning the response.

Parameters:

  • uri (String or URI)

    Remote URI.

  • args (Hash) (defaults to: {})

    Options, see HTTP::Client::Request#initialize.

Returns:

See Also:



416
# File 'lib/http/client.rb', line 416

def post  uri, args = {}; Request.new(POST, uri, args).execute; end

.put(uri, args = {}) ⇒ HTTP::Client::Response

Creates a PUT request and executes it, returning the response.

Parameters:

  • uri (String or URI)

    Remote URI.

  • args (Hash) (defaults to: {})

    Options, see HTTP::Client::Request#initialize.

Returns:

See Also:



407
# File 'lib/http/client.rb', line 407

def put uri, args = {}; Request.new(PUT, uri, args).execute; end

.trace(uri, args = {}) ⇒ HTTP::Client::Response

Creates a TRACE request and executes it, returning the response.

Parameters:

  • uri (String or URI)

    Remote URI.

  • args (Hash) (defaults to: {})

    Options, see HTTP::Client::Request#initialize.

Returns:

See Also:



443
# File 'lib/http/client.rb', line 443

def trace uri, args = {}; Request.new(TRACE, uri, args).execute; end