Class: Doccy::Documents

Inherits:
Object
  • Object
show all
Defined in:
lib/doccy/documents.rb

Class Method Summary collapse

Class Method Details

.create(auth_token, template_id, document_params) ⇒ Object



5
6
7
8
9
10
# File 'lib/doccy/documents.rb', line 5

def self.create(auth_token, template_id, document_params)
  # options = { query: { auth_token: auth_token, document: document_params} }
  options = { body: { auth_token: auth_token, document: document_params} }

  response = HTTParty.post("#{Doccy::Config.url}/templates/#{template_id}/documents.json", options)
end

.download(auth_token, template_id, document_id, original = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/doccy/documents.rb', line 18

def self.download(auth_token, template_id, document_id, original=nil)
  if original
    options = { query: { auth_token: auth_token, original: true} }
  else
    options = { query: { auth_token: auth_token} }
  end

  response = HTTParty.get("#{Doccy::Config.url}/templates/#{template_id}/documents/#{document_id}/download.json", options)
end

.get(auth_token, template_id, document_id) ⇒ Object



12
13
14
15
16
# File 'lib/doccy/documents.rb', line 12

def self.get(auth_token, template_id, document_id)
  options = { query: { auth_token: auth_token} }

  response = HTTParty.get("#{Doccy::Config.url}/templates/#{template_id}/documents/#{document_id}.json", options)
end