Module: Lieu::Request

Included in:
Client
Defined in:
lib/lieu/request.rb

Overview

Methods for HTTP requests

Instance Method Summary collapse

Instance Method Details

#get(path, options = {}) ⇒ Hashie::Mash

Make a HTTP GET request.

Parameters:

  • path (String)

    The path, relative to api_endpoint

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

    query params for request

Returns:

  • (Hashie::Mash)


9
10
11
# File 'lib/lieu/request.rb', line 9

def get(path, options={})
  request(:get, path, options)
end

#post(path, options = {}) ⇒ Hashie::Mash

Make a HTTP POST request.

Parameters:

  • path (String)

    The path, relative to api_endpoint

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

    body params for request

Returns:

  • (Hashie::Mash)


18
19
20
21
22
23
24
# File 'lib/lieu/request.rb', line 18

def post(path, options={})
  response = request(:post, path, options)

  response.delete(:status) if response.respond_to?(:status)

  response
end