Module: FlexmlsApi::Request

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

Overview

HTTP request wrapper. Performs all the api session mumbo jumbo so that the models don’t have to.

Instance Method Summary collapse

Instance Method Details

#delete(path, options = {}) ⇒ Object

Perform an HTTP DELETE request

  • path - Path of an api resource, excluding version and endpoint (domain) information

  • options - Resource request options as specified being supported via and api resource

:returns:

Hash of the json results as documented in the api.

:raises:

FlexmlsApi::ClientError or subclass if the request failed.


52
53
54
# File 'lib/flexmls_api/request.rb', line 52

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

#get(path, options = {}) ⇒ Object

Perform an HTTP GET request

  • path - Path of an api resource, excluding version and endpoint (domain) information

  • options - Resource request options as specified being supported via and api resource

:returns:

Hash of the json results as documented in the api.

:raises:

FlexmlsApi::ClientError or subclass if the request failed.


14
15
16
# File 'lib/flexmls_api/request.rb', line 14

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

#post(path, body = {}, options = {}) ⇒ Object

Perform an HTTP POST request

  • path - Path of an api resource, excluding version and endpoint (domain) information

  • body - Hash for post body data

  • options - Resource request options as specified being supported via and api resource

:returns:

Hash of the json results as documented in the api.

:raises:

FlexmlsApi::ClientError or subclass if the request failed.


27
28
29
# File 'lib/flexmls_api/request.rb', line 27

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

#put(path, body = {}, options = {}) ⇒ Object

Perform an HTTP PUT request

  • path - Path of an api resource, excluding version and endpoint (domain) information

  • body - Hash for post body data

  • options - Resource request options as specified being supported via and api resource

:returns:

Hash of the json results as documented in the api.

:raises:

FlexmlsApi::ClientError or subclass if the request failed.


40
41
42
# File 'lib/flexmls_api/request.rb', line 40

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