Class: DocumentCloud::Client

Inherits:
Object
  • Object
show all
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

API::Projects::PROJECTS_PATH

Constants included from API::Entities

API::Entities::DOCUMENT_PATH, API::Entities::ENTITIES_PATH

Constants included from API::Destroy

API::Destroy::DOCUMENT_PATH

Constants included from API::Update

API::Update::DOCUMENT_PATH

Constants included from API::Document

API::Document::DOCUMENT_PATH

Constants included from API::Upload

API::Upload::UPLOAD_PATH

Constants included from API::Search

API::Search::SEARCH_PATH

Instance Attribute Summary

Attributes included from Configurable

#email, #password

Instance Method Summary collapse

Methods included from Configurable

#configure, keys

Methods included from API::UpdateProject

#update_project

Methods included from API::Utils

#build_object, #build_objects, #parse_json

Methods included from API::CreateProject

#create_project

Methods included from API::Projects

#projects

Methods included from API::Entities

#entities

Methods included from API::Destroy

#destroy

Methods included from API::Update

#update

Methods included from API::Document

#document

Methods included from API::Upload

#upload

Methods included from API::Search

#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(options={})
  DocumentCloud::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[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