Class: DocumentCloud::Client
- Inherits:
-
Object
- Object
- DocumentCloud::Client
- Includes:
- API::Destroy, API::Document, API::Search, API::Update, API::Upload, API::Utils, Configurable
- Defined in:
- lib/document_cloud/client.rb
Constant Summary
Constants included from API::Destroy
Constants included from API::Update
Constants included from API::Document
Constants included from API::Upload
Constants included from API::Search
Instance Attribute Summary
Attributes included from Configurable
Instance Method Summary collapse
-
#delete(path) ⇒ Object
Perform HTTP DELETE request.
-
#get(path, params = {}) ⇒ Object
Perform HTTP GET request.
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
-
#post(path, params = {}) ⇒ Object
Perform HTTP POST request.
-
#put(path, params = {}) ⇒ Object
Perform HTTP PUT request.
Methods included from Configurable
Methods included from API::Destroy
Methods included from API::Utils
Methods included from API::Update
Methods included from API::Document
Methods included from API::Upload
Methods included from API::Search
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
19 20 21 22 23 |
# File 'lib/document_cloud/client.rb', line 19 def initialize(={}) DocumentCloud::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", [key] || DocumentCloud.instance_variable_get(:"@#{key}")) end end |
Instance Method Details
#delete(path) ⇒ Object
Perform HTTP DELETE request
41 42 43 |
# File 'lib/document_cloud/client.rb', line 41 def delete(path) RestClient.delete request_base+path end |
#get(path, params = {}) ⇒ Object
Perform HTTP GET request
26 27 28 |
# File 'lib/document_cloud/client.rb', line 26 def get(path, params={}) RestClient.get request_base+path, {params: params} end |
#post(path, params = {}) ⇒ Object
Perform HTTP POST request
31 32 33 |
# File 'lib/document_cloud/client.rb', line 31 def post(path, params={}) RestClient.post request_base+path, params end |
#put(path, params = {}) ⇒ Object
Perform HTTP PUT request
36 37 38 |
# File 'lib/document_cloud/client.rb', line 36 def put(path, params={}) RestClient.put request_base+path, params end |