Class: DocumentCloud::Client

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

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::Destroy

#destroy

Methods included from API::Utils

#build_object, #parse_json

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.



19
20
21
22
23
# File 'lib/document_cloud/client.rb', line 19

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



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