class ClickSign::Document
Attributes
auto_close[R]
deadline_at[R]
filename[R]
finished_at[R]
key[R]
locale[R]
metadata[R]
original_file_url[R]
path[R]
raw_data[R]
remind_interval[R]
sequence_enabled[R]
signable_group[R]
status[R]
updated_at[R]
uploaded_at[R]
Public Class Methods
build_payload(**args)
click to toggle source
# File lib/click_sign/document.rb, line 97 def self.build_payload(**args) payload = {} if args[:file].present? data_type = File.extname(args[:file]).gsub('.','') payload['content_base64'] = "data:application/#{data_type};base64,#{Base64.encode64(args[:file].read)}" end payload['path'] = "/#{args[:name]}" if args[:name].present? payload['deadline_at'] = args[:deadline_at] if args[:deadline_at].present? payload['auto_close'] = args[:auto_close] if args[:auto_close].present? payload['locale'] = args[:locale] if args[:locale].present? payload['sequence_enabled'] = args[:sequence_enabled] if args[:sequence_enabled].present? payload['remind_interval'] = args[:remind_interval] if args[:remind_interval].present? {document: payload} end
cancel!(document_key: nil)
click to toggle source
# File lib/click_sign/document.rb, line 68 def self.cancel! document_key: nil response = ClickSign::Service.patch( url: ['documents', document_key, 'cancel'], ) if response.success? return ClickSign::Document.new(response.body['document']) end end
configure(**args)
click to toggle source
# File lib/click_sign/document.rb, line 47 def self.configure(**args) document_key = args.delete(:document_key) payload = build_payload args response = ClickSign::Service.patch( url: ['documents', document_key], payload: payload ) if response.success? return ClickSign::Document.new(response.body['document']) end end
create(**args)
click to toggle source
<CLASS METHODS>
# File lib/click_sign/document.rb, line 27 def self.create(**args) payload = build_payload(args) response = ClickSign::Service.post( url: 'documents', payload: payload ) if response.created? return ClickSign::Document.new(response.body['document']) end end
delete!(document_key: nil)
click to toggle source
# File lib/click_sign/document.rb, line 86 def self.delete! document_key: nil response = ClickSign::Service.delete( url: ['documents', document_key], ) if response.success? true else false end end
duplicate!(document_key: nil)
click to toggle source
# File lib/click_sign/document.rb, line 77 def self.duplicate! document_key: nil response = ClickSign::Service.post( url: ['documents', document_key, 'duplicate'], ) if response.created? return ClickSign::Document.new(response.body['document']) end end
find(document_key: nil)
click to toggle source
# File lib/click_sign/document.rb, line 38 def self.find document_key: nil response = ClickSign::Service.get( url: ['documents', document_key] ) if response.success? return ClickSign::Document.new(response.body['document']) end end
finish!(document_key: nil)
click to toggle source
# File lib/click_sign/document.rb, line 59 def self.finish! document_key: nil response = ClickSign::Service.patch( url: ['documents', document_key, 'finish'], ) if response.success? return ClickSign::Document.new(response.body['document']) end end
new(args)
click to toggle source
# File lib/click_sign/document.rb, line 7 def initialize(args) @raw_data = args @key = args['key'] if args['key'].present? @path = args['path'] if args['path'].present? @filename = args['filename'] if args['filename'].present? @uploaded_at = args['uploaded_at'] if args['uploaded_at'].present? @updated_at = args['updated_at'] if args['updated_at'].present? @finished_at = args['finished_at'] if args['finished_at'].present? @deadline_at = args['deadline_at'] if args['deadline_at'].present? @status = args['status'] if args['status'].present? @auto_close = args['auto_close'] if args['auto_close'].present? @locale = args['locale'] if args['locale'].present? @metadata = args['metadata'] if args['metadata'].present? @sequence_enabled = args['sequence_enabled'] if args['sequence_enabled'].present? @signable_group = args['signable_group'] if args['signable_group'].present? @remind_interval = args['remind_interval'] if args['remind_interval'].present? @original_file_url = args['downloads']['original_file_url'] if args['downloads'].present? end
Public Instance Methods
add_signer(signer_key: nil, sign_as: nil, group: nil)
click to toggle source
<INSTANCE METHODS>
# File lib/click_sign/document.rb, line 117 def add_signer signer_key: nil, sign_as: nil, group: nil ClickSign::List.create document_key: self.key, signer_key: signer_key, sign_as: sign_as, group: nil end
cancel!()
click to toggle source
# File lib/click_sign/document.rb, line 140 def cancel! ClickSign::Document.cancel! document_key: self.key end
delete!()
click to toggle source
# File lib/click_sign/document.rb, line 148 def delete! ClickSign::Document.delete! document_key: self.key end
duplicate!()
click to toggle source
# File lib/click_sign/document.rb, line 144 def duplicate! ClickSign::Document.duplicate! document_key: self.key end
edit(deadline_at: nil, auto_close: nil, locale: nil, sequence_enabled: nil, remind_interval: nil)
click to toggle source
# File lib/click_sign/document.rb, line 125 def edit deadline_at: nil, auto_close: nil, locale: nil, sequence_enabled: nil, remind_interval: nil ClickSign::Document.configure( document_key: self.key, deadline_at: deadline_at, auto_close: auto_close, locale: locale, sequence_enabled: sequence_enabled, remind_interval: remind_interval ).attributes end
finish!()
click to toggle source
# File lib/click_sign/document.rb, line 136 def finish! ClickSign::Document.finish! document_key: self.key end
remove_signer(list_key: nil)
click to toggle source
# File lib/click_sign/document.rb, line 121 def remove_signer list_key: nil ClickSign::List.delete list_key: list_key end