Class: Echosign::Client
- Inherits:
-
Object
- Object
- Echosign::Client
- Defined in:
- lib/echosign/client.rb,
lib/echosign/widget/client.rb,
lib/echosign/agreement/client.rb,
lib/echosign/mega_sign/client.rb,
lib/echosign/library_documents/client.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#agreement_combined_pdf(agreement_id, file_path = nil, versionId = nil, participantEmail = nil, attachSupportingDocuments = true, auditReport = false) ⇒ String
Gets a single combined PDF document for the documents associated with an agreement.
-
#agreement_document_file(agreement_id, document_id, file_path = nil) ⇒ String
Retrieve a document file from an agreement.
-
#agreement_documents(agreement_id, recipient_email, format, version_id = nil) ⇒ Array
All documents relating to an agreement.
-
#agreement_form_data(agreement_id, file_path = nil) ⇒ String
Retrieves library document audit trail file.
-
#agreement_info(agreement_id) ⇒ Hash
Gets detailed info on an agreement.
-
#agreement_signing_urls(agreement_id) ⇒ Hash
Retrieves the URL for the eSign page for the current signer(s) of an agreement.
-
#audit_trail_pdf(agreement_id, file_path = nil) ⇒ String
Retrieve a PDF audit file for an agreement.
-
#cancel_agreement(agreement_id, notify_signer = false, comment = nil) ⇒ String
Cancel agreement.
-
#cancel_mega_sign(mega_sign_id, notify_signer = false, comment = nil) ⇒ String
Cancel mega_sign.
-
#create_agreement(agreement) ⇒ String
Creates an agreement.
-
#create_mega_sign(mega_sign) ⇒ String
Creates an mega_sign.
-
#create_reminder(reminder) ⇒ String
Creates a reminder.
-
#create_transient_document(file_name, mime_type, file_handle) ⇒ String
Creates a transient document for later referral.
-
#create_user(user) ⇒ String
Creates a user for the current application.
-
#create_widget(widget) ⇒ Hash
Creates a widget and returns the Javascript snippet and URL to access the widget and widgetID in response to the client.
-
#get_agreements ⇒ Hash
Gets list of agreements.
-
#get_library_document(library_document_id) ⇒ Hash
Retrieves library document metadata.
-
#get_library_document_file(library_document_id, file_id, file_path = nil) ⇒ String
Retrieves library document file data.
-
#get_library_document_files(library_document_id) ⇒ Hash
Retrieves library document files metadata.
-
#get_library_documents(user_id = nil, user_email = nil) ⇒ Hash
Retrieves library documents metadata for a user.
-
#get_mega_signs ⇒ Hash
Gets list of mega_signs.
-
#get_user(user_id) ⇒ Hash
Gets all the users in an account that the caller has permissions to access.
-
#get_users(user_email) ⇒ Hash
Gets all the users in an account that the caller has permissions to access.
-
#get_widget(widget_id) ⇒ Hash
Retrieves the details of a widget.
-
#get_widget_audit_trail(widget_id, file_path = nil) ⇒ String
Retrieves the audit trail of a widget identified by widgetId.
-
#get_widget_combined_pdf(widget_id, file_path = nil) ⇒ String
Gets a single combined PDF document for the documents associated with a widget.
-
#get_widget_document_file(widget_id, document_id, file_path = nil) ⇒ String
Retrieves the file stream of a document of a widget.
-
#get_widget_documents(widget_id, version_id = nil, participant_email = nil) ⇒ Hash
Retrieves the IDs of the documents associated with widget.
-
#get_widget_form_data(widget_id, file_path = nil) ⇒ String
Retrieves data entered by the user into interactive form fields at the time they signed the widget.
-
#get_widgets(user_id = nil, user_email = nil) ⇒ Hash
Retrieves widgets for a user.
-
#initialize(token) ⇒ Echochamber::Client
constructor
Initializes the Client object.
-
#library_combined_document(library_document_id, file_path = nil, auditReport = false) ⇒ String
Retrieves library combined document file.
-
#library_document_audit_trail(library_document_id, file_path = nil) ⇒ String
Retrieves library document audit trail file.
-
#mega_sign_combined_pdf(mega_sign_id, file_path = nil, versionId = nil, participantEmail = nil, attachSupportingDocuments = true, auditReport = false) ⇒ String
Gets a single combined PDF document for the documents associated with an mega_sign.
-
#mega_sign_document_file(mega_sign_id, document_id, file_path = nil) ⇒ String
Retrieve a document file from an mega_sign.
-
#mega_sign_documents(mega_sign_id, recipient_email, format, version_id = nil) ⇒ Array
All documents relating to an mega_sign.
-
#mega_sign_form_data(mega_sign_id, file_path = nil) ⇒ String
Retrieves library document audit trail file.
-
#mega_sign_info(mega_sign_id) ⇒ Hash
Gets detailed info on an mega_sign.
-
#mega_sign_signing_urls(mega_sign_id) ⇒ Hash
Retrieves the URL for the eSign page for the current signer(s) of an mega_sign.
-
#personalize_widget(widget_id, personalization) ⇒ Hash
Personalize the widget to a signable document for a specific known user.
-
#update_widget_status(widget_id, status) ⇒ Hash
Enables or Disables a widget.
Constructor Details
#initialize(token) ⇒ Echochamber::Client
Initializes the Client object
13 14 15 16 |
# File 'lib/echosign/client.rb', line 13 def initialize(token) @token = token @base_uri = nil end |
Instance Attribute Details
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/echosign/client.rb', line 7 def token @token end |
Instance Method Details
#agreement_combined_pdf(agreement_id, file_path = nil, versionId = nil, participantEmail = nil, attachSupportingDocuments = true, auditReport = false) ⇒ String
Gets a single combined PDF document for the documents associated with an agreement.
97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/echosign/agreement/client.rb', line 97 def agreement_combined_pdf(agreement_id, file_path = nil, versionId = nil, participantEmail = nil, attachSupportingDocuments = true, auditReport = false) response = request(:agreement_combined_pdf, agreement_id, versionId, participantEmail, attachSupportingDocuments, auditReport) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#agreement_document_file(agreement_id, document_id, file_path = nil) ⇒ String
Retrieve a document file from an agreement
66 67 68 69 70 71 72 73 74 |
# File 'lib/echosign/agreement/client.rb', line 66 def agreement_document_file(agreement_id, document_id, file_path = nil) response = request(:agreement_document_file, agreement_id, document_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#agreement_documents(agreement_id, recipient_email, format, version_id = nil) ⇒ Array
All documents relating to an agreement
56 57 58 |
# File 'lib/echosign/agreement/client.rb', line 56 def agreement_documents(agreement_id, recipient_email, format, version_id = nil) result = request(:agreement_documents, agreement_id, recipient_email, format, version_id) end |
#agreement_form_data(agreement_id, file_path = nil) ⇒ String
Retrieves library document audit trail file
115 116 117 118 119 120 121 122 123 |
# File 'lib/echosign/agreement/client.rb', line 115 def agreement_form_data(agreement_id, file_path = nil) response = request(:agreement_form_data, agreement_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#agreement_info(agreement_id) ⇒ Hash
Gets detailed info on an agreement
26 27 28 |
# File 'lib/echosign/agreement/client.rb', line 26 def agreement_info(agreement_id) request(:agreement_info, agreement_id) end |
#agreement_signing_urls(agreement_id) ⇒ Hash
Retrieves the URL for the eSign page for the current signer(s) of an agreement
80 81 82 |
# File 'lib/echosign/agreement/client.rb', line 80 def agreement_signing_urls(agreement_id) response = request(:agreement_signing_urls, agreement_id) end |
#audit_trail_pdf(agreement_id, file_path = nil) ⇒ String
Retrieve a PDF audit file for an agreement
51 52 53 54 55 56 57 58 59 |
# File 'lib/echosign/client.rb', line 51 def audit_trail_pdf(agreement_id, file_path = nil) response = request(:audit_trail_pdf, agreement_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#cancel_agreement(agreement_id, notify_signer = false, comment = nil) ⇒ String
Cancel agreement
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/echosign/agreement/client.rb', line 36 def cancel_agreement(agreement_id, notify_signer = false, comment = nil) request_body = { "value" => "CANCEL", "notifySigner" => notify_signer } request_body[:comment] = comment unless comment.nil? agreement_status_response = request(:update_agreement_status, agreement_id, request_body) agreement_status_response.fetch('result') end |
#cancel_mega_sign(mega_sign_id, notify_signer = false, comment = nil) ⇒ String
Cancel mega_sign
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/echosign/mega_sign/client.rb', line 35 def cancel_mega_sign(mega_sign_id, notify_signer = false, comment = nil) request_body = { "value" => "CANCEL", "notifySigner" => notify_signer } request_body[:comment] = comment unless comment.nil? mega_sign_status_response = request(:update_mega_sign_status, mega_sign_id, request_body) mega_sign_status_response.fetch('result') end |
#create_agreement(agreement) ⇒ String
Creates an agreement
7 8 9 10 11 12 |
# File 'lib/echosign/agreement/client.rb', line 7 def create_agreement(agreement) agreement_response = request(:create_agreement, agreement, agreement.user_id, agreement.user_email) return agreement_response['agreementId'] if agreement_response.has_key?('agreementId') raise "Error creating agreement - response was #{agreement_response}" end |
#create_mega_sign(mega_sign) ⇒ String
Creates an mega_sign
7 8 9 10 11 |
# File 'lib/echosign/mega_sign/client.rb', line 7 def create_mega_sign(mega_sign) mega_sign_response = request(:create_mega_sign, mega_sign, mega_sign.user_id, mega_sign.user_email) puts mega_sign_response.inspect mega_sign_response.fetch("mega_signId") end |
#create_reminder(reminder) ⇒ String
Creates a reminder
31 32 33 |
# File 'lib/echosign/client.rb', line 31 def create_reminder(reminder) reminder_response = request(:create_reminder, reminder) end |
#create_transient_document(file_name, mime_type, file_handle) ⇒ String
Creates a transient document for later referral
41 42 43 44 |
# File 'lib/echosign/client.rb', line 41 def create_transient_document(file_name, mime_type, file_handle) transient_document_response = request(:create_transient_document, file_name, file_handle, mime_type) transient_document_response.fetch("transientDocumentId") end |
#create_user(user) ⇒ String
Creates a user for the current application
22 23 24 25 |
# File 'lib/echosign/client.rb', line 22 def create_user(user) user_response = request(:create_user, user) user_response.fetch("userId") end |
#create_widget(widget) ⇒ Hash
Creates a widget and returns the Javascript snippet and URL to access the widget and widgetID in response to
the client
8 9 10 |
# File 'lib/echosign/widget/client.rb', line 8 def () request(:create_widget, ) end |
#get_agreements ⇒ Hash
Gets list of agreements
17 18 19 20 |
# File 'lib/echosign/agreement/client.rb', line 17 def get_agreements get_agreements_response = request(:get_agreements) get_agreements_response.fetch("userAgreementList") end |
#get_library_document(library_document_id) ⇒ Hash
Retrieves library document metadata
18 19 20 |
# File 'lib/echosign/library_documents/client.rb', line 18 def get_library_document(library_document_id) request(:get_library_document, library_document_id) end |
#get_library_document_file(library_document_id, file_id, file_path = nil) ⇒ String
Retrieves library document file data
36 37 38 39 40 41 42 43 44 |
# File 'lib/echosign/library_documents/client.rb', line 36 def get_library_document_file(library_document_id, file_id, file_path = nil) response = request(:get_library_document_file, library_document_id, file_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#get_library_document_files(library_document_id) ⇒ Hash
Retrieves library document files metadata
26 27 28 |
# File 'lib/echosign/library_documents/client.rb', line 26 def get_library_document_files(library_document_id) request(:get_library_document_files, library_document_id) end |
#get_library_documents(user_id = nil, user_email = nil) ⇒ Hash
Retrieves library documents metadata for a user.
10 11 12 |
# File 'lib/echosign/library_documents/client.rb', line 10 def get_library_documents(user_id = nil, user_email = nil) request(:get_library_documents, user_id, user_email) end |
#get_mega_signs ⇒ Hash
Gets list of mega_signs
16 17 18 19 |
# File 'lib/echosign/mega_sign/client.rb', line 16 def get_mega_signs get_mega_signs_response = request(:get_mega_signs) get_mega_signs_response.fetch("megaSignList") end |
#get_user(user_id) ⇒ Hash
Gets all the users in an account that the caller has permissions to access.
73 74 75 |
# File 'lib/echosign/client.rb', line 73 def get_user(user_id) request(:get_user, user_id) end |
#get_users(user_email) ⇒ Hash
Gets all the users in an account that the caller has permissions to access.
65 66 67 |
# File 'lib/echosign/client.rb', line 65 def get_users(user_email) request(:get_users, user_email) end |
#get_widget(widget_id) ⇒ Hash
Retrieves the details of a widget
45 46 47 |
# File 'lib/echosign/widget/client.rb', line 45 def () request(:get_widget, ) end |
#get_widget_audit_trail(widget_id, file_path = nil) ⇒ String
SEEMINGLY NOT YET IMPLEMENTED SERVER-SIDE
Retrieves the audit trail of a widget identified by widgetId
82 83 84 85 86 87 88 89 90 |
# File 'lib/echosign/widget/client.rb', line 82 def (, file_path = nil) response = request(:get_widget_audit_trail, ) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#get_widget_combined_pdf(widget_id, file_path = nil) ⇒ String
SEEMINGLY NOT YET IMPLEMENTED SERVER-SIDE
Gets a single combined PDF document for the documents associated with a widget.
98 99 100 101 102 103 104 105 106 |
# File 'lib/echosign/widget/client.rb', line 98 def (, file_path = nil) response = request(:get_widget_combined_pdf, ) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#get_widget_document_file(widget_id, document_id, file_path = nil) ⇒ String
Retrieves the file stream of a document of a widget
66 67 68 69 70 71 72 73 74 |
# File 'lib/echosign/widget/client.rb', line 66 def (, document_id, file_path = nil) response = request(:get_widget_document_file, , document_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#get_widget_documents(widget_id, version_id = nil, participant_email = nil) ⇒ Hash
Retrieves the IDs of the documents associated with widget.
56 57 58 |
# File 'lib/echosign/widget/client.rb', line 56 def (, version_id = nil, participant_email = nil) request(:get_widget_documents, , version_id, participant_email) end |
#get_widget_form_data(widget_id, file_path = nil) ⇒ String
SEEMINGLY NOT YET IMPLEMENTED SERVER-SIDE
Retrieves data entered by the user into interactive form fields at the time they signed the widget
114 115 116 117 118 119 120 121 122 |
# File 'lib/echosign/widget/client.rb', line 114 def (, file_path = nil) response = request(:get_widget_form_data, ) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#get_widgets(user_id = nil, user_email = nil) ⇒ Hash
Retrieves widgets for a user
37 38 39 |
# File 'lib/echosign/widget/client.rb', line 37 def (user_id = nil, user_email = nil) request(:get_widgets, user_id, user_email) end |
#library_combined_document(library_document_id, file_path = nil, auditReport = false) ⇒ String
Retrieves library combined document file
68 69 70 71 72 73 74 75 76 |
# File 'lib/echosign/library_documents/client.rb', line 68 def library_combined_document(library_document_id, file_path = nil, auditReport = false) response = request(:library_combined_document, library_document_id, auditReport) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#library_document_audit_trail(library_document_id, file_path = nil) ⇒ String
Retrieves library document audit trail file
51 52 53 54 55 56 57 58 59 |
# File 'lib/echosign/library_documents/client.rb', line 51 def library_document_audit_trail(library_document_id, file_path = nil) response = request(:library_document_audit_trail, library_document_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#mega_sign_combined_pdf(mega_sign_id, file_path = nil, versionId = nil, participantEmail = nil, attachSupportingDocuments = true, auditReport = false) ⇒ String
Gets a single combined PDF document for the documents associated with an mega_sign.
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/echosign/mega_sign/client.rb', line 96 def mega_sign_combined_pdf(mega_sign_id, file_path = nil, versionId = nil, participantEmail = nil, attachSupportingDocuments = true, auditReport = false) response = request(:mega_sign_combined_pdf, mega_sign_id, versionId, participantEmail, attachSupportingDocuments, auditReport) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#mega_sign_document_file(mega_sign_id, document_id, file_path = nil) ⇒ String
Retrieve a document file from an mega_sign
65 66 67 68 69 70 71 72 73 |
# File 'lib/echosign/mega_sign/client.rb', line 65 def mega_sign_document_file(mega_sign_id, document_id, file_path = nil) response = request(:mega_sign_document_file, mega_sign_id, document_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#mega_sign_documents(mega_sign_id, recipient_email, format, version_id = nil) ⇒ Array
All documents relating to an mega_sign
55 56 57 |
# File 'lib/echosign/mega_sign/client.rb', line 55 def mega_sign_documents(mega_sign_id, recipient_email, format, version_id = nil) result = request(:mega_sign_documents, mega_sign_id, recipient_email, format, version_id) end |
#mega_sign_form_data(mega_sign_id, file_path = nil) ⇒ String
Retrieves library document audit trail file
114 115 116 117 118 119 120 121 122 |
# File 'lib/echosign/mega_sign/client.rb', line 114 def mega_sign_form_data(mega_sign_id, file_path = nil) response = request(:mega_sign_form_data, mega_sign_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end |
#mega_sign_info(mega_sign_id) ⇒ Hash
Gets detailed info on an mega_sign
25 26 27 |
# File 'lib/echosign/mega_sign/client.rb', line 25 def mega_sign_info(mega_sign_id) request(:mega_sign_info, mega_sign_id) end |
#mega_sign_signing_urls(mega_sign_id) ⇒ Hash
Retrieves the URL for the eSign page for the current signer(s) of an mega_sign
79 80 81 |
# File 'lib/echosign/mega_sign/client.rb', line 79 def mega_sign_signing_urls(mega_sign_id) response = request(:mega_sign_signing_urls, mega_sign_id) end |
#personalize_widget(widget_id, personalization) ⇒ Hash
Personalize the widget to a signable document for a specific known user
17 18 19 |
# File 'lib/echosign/widget/client.rb', line 17 def (, personalization) request(:personalize_widget, , personalization) end |
#update_widget_status(widget_id, status) ⇒ Hash
Enables or Disables a widget
26 27 28 |
# File 'lib/echosign/widget/client.rb', line 26 def (, status) request(:update_widget_status, , status) end |