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/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: Delete, Get, Head, Options, Patch, Post, Put

Instance Method Summary collapse

Instance Method Details

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

Set specified options in order to make a http request.

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 from for everything else.



30
31
32
# File 'lib/ethon/easy/http.rb', line 30

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