Module: HTTPalooza::API

Included in:
Lineup
Defined in:
lib/httpalooza/api.rb

Instance Method Summary collapse

Instance Method Details

#delete(url, options = {}, &block) ⇒ Object

Peform an HTTP DELETE request with the assembled Lineup.

options [Hash] the request options

Parameters:

  • url (String)

    the URL to request.

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

    a customizable set of options

Options Hash (options):

  • :headers (Hash)

    request headers

  • :params (Hash)

    URL parameters

  • :payload (String)

    the request body



43
44
45
# File 'lib/httpalooza/api.rb', line 43

def delete(url, options = {}, &block)
  run! Request.new(url, :delete, options.slice(:headers, :params, :payload), &block)
end

#get(url, options = {}, &block) ⇒ Object

Peform an HTTP GET request with the assembled Lineup.

options [Hash] the request options

Parameters:

  • url (String)

    the URL to request.

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

    a customizable set of options

Options Hash (options):

  • :headers (Hash)

    request headers

  • :params (Hash)

    URL parameters

  • :payload (String)

    the request body



10
11
12
# File 'lib/httpalooza/api.rb', line 10

def get(url, options = {}, &block)
  run! Request.new(url, :get, options.slice(:headers, :params, :payload), &block)
end

#head(url, options = {}, &block) ⇒ Object

Peform an HTTP HEAD request with the assembled Lineup.

options [Hash] the request options

Parameters:

  • url (String)

    the URL to request.

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

    a customizable set of options

Options Hash (options):

  • :headers (Hash)

    request headers

  • :params (Hash)

    URL parameters

  • :payload (String)

    the request body



54
55
56
# File 'lib/httpalooza/api.rb', line 54

def head(url, options = {}, &block)
  run! Request.new(url, :head, options.slice(:headers, :params, :payload), &block)
end

#post(url, options = {}, &block) ⇒ Object

Peform an HTTP POST request with the assembled Lineup.

options [Hash] the request options

Parameters:

  • url (String)

    the URL to request.

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

    a customizable set of options

Options Hash (options):

  • :headers (Hash)

    request headers

  • :params (Hash)

    URL parameters

  • :payload (String)

    the request body



21
22
23
# File 'lib/httpalooza/api.rb', line 21

def post(url, options = {}, &block)
  run! Request.new(url, :post, options.slice(:headers, :params, :payload), &block)
end

#put(url, options = {}, &block) ⇒ Object

Peform an HTTP PUT request with the assembled Lineup.

options [Hash] the request options

Parameters:

  • url (String)

    the URL to request.

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

    a customizable set of options

Options Hash (options):

  • :headers (Hash)

    request headers

  • :params (Hash)

    URL parameters

  • :payload (String)

    the request body



32
33
34
# File 'lib/httpalooza/api.rb', line 32

def put(url, options = {}, &block)
  run! Request.new(url, :put, options.slice(:headers, :params, :payload), &block)
end