Module: SparkApi::Request
- Included in:
- Client
- Defined in:
- lib/spark_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
-
#delete(path, options = {}) ⇒ Object
Perform an HTTP DELETE request.
-
#get(path, options = {}) ⇒ Object
Perform an HTTP GET request.
-
#post(path, body = nil, options = {}) ⇒ Object
Perform an HTTP POST request.
-
#put(path, body = nil, options = {}) ⇒ Object
Perform an HTTP PUT request.
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:
SparkApi::ClientError or subclass if the request failed.
53 54 55 |
# File 'lib/spark_api/request.rb', line 53 def delete(path, ={}) request(:delete, path, nil, ) 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:
SparkApi::ClientError or subclass if the request failed.
15 16 17 |
# File 'lib/spark_api/request.rb', line 15 def get(path, ={}) request(:get, path, nil, ) end |
#post(path, body = nil, 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:
SparkApi::ClientError or subclass if the request failed.
28 29 30 |
# File 'lib/spark_api/request.rb', line 28 def post(path, body = nil, ={}) request(:post, path, body, ) end |
#put(path, body = nil, 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:
SparkApi::ClientError or subclass if the request failed.
41 42 43 |
# File 'lib/spark_api/request.rb', line 41 def put(path, body = nil, ={}) request(:put, path, body, ) end |