Module: FileboundClient::Endpoints::Documents

Defined in:
lib/filebound_client/endpoints/documents.rb

Overview

Module for Documents resource endpoint

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

This will call macros to create resource methods on the fly



6
7
8
9
10
11
# File 'lib/filebound_client/endpoints/documents.rb', line 6

def self.included(klass)
  klass.instance_eval do
    allow_new :document
    allow_all :documents
  end
end

Instance Method Details

#document(document_id, query_params = nil) ⇒ Hash

Retrieves a single document



16
17
18
# File 'lib/filebound_client/endpoints/documents.rb', line 16

def document(document_id, query_params = nil)
  get("/documents/#{document_id}", query_params)
end

#document_add(document) ⇒ Hash

Adds a document

Raises:

  • (FileboundClientException)


89
90
91
92
# File 'lib/filebound_client/endpoints/documents.rb', line 89

def document_add(document)
  raise FileboundClientException.new('File Id is required', 0) unless document && document[:fileId].positive?
  put("/documents/#{document[:fileId]}", nil, document)
end

#document_add_eformdata(document_id, eform_data) ⇒ Hash

Adds eform data to document



48
49
50
# File 'lib/filebound_client/endpoints/documents.rb', line 48

def document_add_eformdata(document_id, eform_data)
  put("/documents/#{document_id}/eformdata", nil, eform_data)
end

#document_add_eformdetail(document_id, eform_detail) ⇒ Hash

Adds eform detail to document



56
57
58
# File 'lib/filebound_client/endpoints/documents.rb', line 56

def document_add_eformdetail(document_id, eform_detail)
  put("/documents/#{document_id}/eformdetail", nil, eform_detail)
end

#document_delete(document_id) ⇒ bool

Delete a document



97
98
99
# File 'lib/filebound_client/endpoints/documents.rb', line 97

def document_delete(document_id)
  delete("/documents/#{document_id}")
end

#document_eform_data(document_id, query_params = nil) ⇒ Hash

Returns the eform data for the document key



24
25
26
# File 'lib/filebound_client/endpoints/documents.rb', line 24

def document_eform_data(document_id, query_params = nil)
  get("/documents/#{document_id}/eformdata", query_params)
end

#document_eform_detail(document_id, query_params = nil) ⇒ Hash

Returns the eform detail for the document key



32
33
34
# File 'lib/filebound_client/endpoints/documents.rb', line 32

def document_eform_detail(document_id, query_params = nil)
  get("/documents/#{document_id}/eformdetail", query_params)
end

#document_rendition(document_id, query_params = nil) ⇒ String

Returns a rendition for the document key



40
41
42
# File 'lib/filebound_client/endpoints/documents.rb', line 40

def document_rendition(document_id, query_params = nil)
  get("/documents/#{document_id}/rendition", query_params)
end

#document_update(document, query_params = nil) ⇒ int

Updates a document



82
83
84
# File 'lib/filebound_client/endpoints/documents.rb', line 82

def document_update(document, query_params = nil)
  post("/documents/#{document[:id]}", query_params, document)
end

#document_update_eformdata(document_id, eform_data, query_params = nil) ⇒ Hash

Updates eform data for the document



65
66
67
# File 'lib/filebound_client/endpoints/documents.rb', line 65

def document_update_eformdata(document_id, eform_data, query_params = nil)
  post("/documents/#{document_id}/eformdata", query_params, eform_data)
end

#document_update_eformdetail(document_id, eform_detail, query_params = nil) ⇒ Hash

Updates eform detail for the document



74
75
76
# File 'lib/filebound_client/endpoints/documents.rb', line 74

def document_update_eformdetail(document_id, eform_detail, query_params = nil)
  put("/documents/#{document_id}/eformdetail", query_params, eform_detail)
end