Module: Ethon::Easy::Http

Included in:
Ethon::Easy
Defined in:
lib/ethon/easy/http.rb,
lib/ethon/easy/http/get.rb,
lib/ethon/easy/http/put.rb,
lib/ethon/easy/http/head.rb,
lib/ethon/easy/http/post.rb,
lib/ethon/easy/http/patch.rb,
lib/ethon/easy/http/custom.rb,
lib/ethon/easy/http/delete.rb,
lib/ethon/easy/http/options.rb,
lib/ethon/easy/http/putable.rb,
lib/ethon/easy/http/postable.rb,
lib/ethon/easy/http/actionable.rb

Overview

This module contains logic about making valid HTTP requests.

Defined Under Namespace

Modules: Actionable, Postable, Putable Classes: Custom, Delete, Get, Head, Options, Patch, Post, Put

Instance Method Summary collapse

Instance Method Details

#http_request(url, action_name, options = {}) ⇒ void

This method returns an undefined value.

Set specified options in order to make a HTTP request. Look at Options to see what you can provide in the options hash.

Examples:

Set options for HTTP request.

easy.http_request("www.google.com", :get, {})

Parameters:

  • url (String)

    The url.

  • action_name (String)

    The HTTP action name.

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

    The options hash.

Options Hash (options):

  • :params (Hash)

    Params hash which is attached to the url.

  • :body (Hash)

    Body hash which becomes the request body. It is a PUT body for PUT requests and a POST for everything else.

  • :headers (Hash)

    Request headers.

See Also:



39
40
41
# File 'lib/ethon/easy/http.rb', line 39

def http_request(url, action_name, options = {})
  fabricate(url, action_name, options).setup(self)
end