Class: DocumentCloud::Client
- Inherits:
-
Object
- Object
- DocumentCloud::Client
- Includes:
- API::CreateProject, API::Destroy, API::Document, API::Entities, API::Projects, API::Search, API::Update, API::UpdateProject, API::Upload, API::Utils, Configurable
- Defined in:
- lib/document_cloud/client.rb
Constant Summary
Constants included from API::UpdateProject
API::UpdateProject::PROJECT_PATH
Constants included from API::CreateProject
API::CreateProject::PROJECTS_PATH
Constants included from API::Projects
Constants included from API::Entities
API::Entities::DOCUMENT_PATH, API::Entities::ENTITIES_PATH
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::UpdateProject
Methods included from API::Utils
#build_object, #build_objects, #parse_json
Methods included from API::CreateProject
Methods included from API::Projects
Methods included from API::Entities
Methods included from API::Destroy
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.
27 28 29 30 31 |
# File 'lib/document_cloud/client.rb', line 27 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
49 50 51 |
# File 'lib/document_cloud/client.rb', line 49 def delete(path) RestClient.delete request_base+path end |
#get(path, params = {}) ⇒ Object
Perform HTTP GET request
34 35 36 |
# File 'lib/document_cloud/client.rb', line 34 def get(path, params={}) RestClient.get request_base+path, {params: params} end |
#post(path, params = {}) ⇒ Object
Perform HTTP POST request
39 40 41 |
# File 'lib/document_cloud/client.rb', line 39 def post(path, params={}) RestClient.post request_base+path, params end |
#put(path, params = {}) ⇒ Object
Perform HTTP PUT request
44 45 46 |
# File 'lib/document_cloud/client.rb', line 44 def put(path, params={}) RestClient.put request_base+path, params end |