class Echochamber::Client
Attributes
Public Class Methods
Initializes the Client
object
@param credentials [Echochamber::Credentials] Initialized Echochamber::Credentials
@return [Echochamber::Client] Initialized Echochamber::Client
# File lib/echochamber/client.rb, line 15 def initialize(credentials) @token = Echochamber::Request.get_token(credentials) end
Public Instance Methods
Gets a single combined PDF document for the documents associated with an agreement.
@param agreement_id [String] (REQUIRED) @param file_path [String] File path to save the document. If no file path is given, nothing is saved to disk. @param versionId [String] The version identifier of agreement as provided by get_agreement. If not provided then latest version will be used @param participantEmail [String] The email address of the participant to be used to retrieve documents. If none is given, the auth token will be used to determine the user @param attachSupportingDocuments [Boolean] When set to YES, attach corresponding supporting documents to the signed agreement PDF. Default value of this parameter is true. @param auditReport [Boolean] When set to YES, attach an audit report to the signed agreement PDF. Default value is false @return [String] Raw bytes from document file
# File lib/echochamber/agreement/client.rb, line 92 def agreement_combined_pdf(agreement_id, file_path=nil, versionId=nil, participantEmail=nil, attachSupportingDocuments=true, auditReport=false) response = Echochamber::Request.agreement_combined_pdf(token, agreement_id, versionId, participantEmail, attachSupportingDocuments, auditReport) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Retrieve a document file from an agreement
@param agreement_id [String] (REQUIRED) @param document_id [String] (REQUIRED) @param file_path [String] File path to save the document. If no file path is given, nothing is saved to disk. @return [String] Raw bytes from document file
# File lib/echochamber/agreement/client.rb, line 65 def agreement_document_file(agreement_id, document_id, file_path=nil) response = Echochamber::Request.agreement_document_file(token, agreement_id, document_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
All documents relating to an agreement
@param agreement_id [String] (REQUIRED) @param recipient_email [String] The email address of the participant to be used to retrieve documents. (REQUIRED) @param format [String] Content format of the supported documents. It can have two possible values ORIGINAL or CONVERTED_PDF. (REQUIRED) @param version_id [String] Version of the agreement as provided by agreement_info
(). If not provided, the latest version of the agreement is used. @return [Array] Documents relating to agreement.
# File lib/echochamber/agreement/client.rb, line 55 def agreement_documents(agreement_id, recipient_email, format, version_id=nil) result = Echochamber::Request.agreement_documents(token, agreement_id, recipient_email, format, version_id) end
Retrieves library document audit trail file
@param agreement_id [String] (REQUIRED) @param file_path [String] File path where to save the CSV file. If no file path is given, nothing is saved to disk. @return [String] Raw bytes representing CSV file
# File lib/echochamber/agreement/client.rb, line 107 def agreement_form_data(agreement_id, file_path=nil) response = Echochamber::Request.agreement_form_data(token, agreement_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Gets detailed info on an agreement
@param agreement_id [String] ID of agreement to retrieve info on. @return [Hash] Detailed agreement info
# File lib/echochamber/agreement/client.rb, line 27 def agreement_info(agreement_id) Echochamber::Request.agreement_info(token, agreement_id) end
Retrieves the URL for the eSign page for the current signer(s) of an agreement
@param agreement_id [String] (REQUIRED) @return [Hash] URL information for the eSign page of the agreement
# File lib/echochamber/agreement/client.rb, line 79 def agreement_signing_urls(agreement_id) response = Echochamber::Request.agreement_signing_urls(token, agreement_id) end
Retrieve a PDF audit file for an agreement
@param agreement_id [String] (REQUIRED) @param file_path [String] File path to save the document. If no file path is given, nothing is saved to disk. @return [String] Raw bytes from document file
# File lib/echochamber/client.rb, line 52 def audit_trail_pdf(agreement_id, file_path=nil) response = Echochamber::Request.audit_trail_pdf(token, agreement_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Cancel agreement
@param agreement_id [String] (REQUIRED) @param notify_signer [Boolean] Whether to notify the signer by email of the cancellation. Default is false. @param comment [String] Comment regarding this cancellation. @return [String] Result of the operation
# File lib/echochamber/agreement/client.rb, line 37 def cancel_agreement(agreement_id, notify_signer=false, comment=nil) request_body = { "value" => "CANCEL", "notifySigner" => notify_signer } request_body.merge!(comment: comment) unless comment.nil? agreement_status_response = Echochamber::Request.update_agreement_status(token, agreement_id, request_body) agreement_status_response.fetch('result') end
Creates an agreement
@param agreement [Echochamber::Agreement] @return [String] Agreement
ID
# File lib/echochamber/agreement/client.rb, line 9 def create_agreement(agreement) agreement_response = Echochamber::Request.create_agreement(agreement, token, agreement.user_id, agreement.user_email) agreement_response.fetch("agreementId") end
Creates a reminder
@param reminder [Echochamber::Reminder] @return [String] Reminder
ID
# File lib/echochamber/client.rb, line 32 def create_reminder(reminder) reminder_response = Echochamber::Request.create_reminder(token, reminder) end
Creates a transient document for later referral
@param file_name [String] @param mime_type [String] @param file_handle [File] @return [String] Transient document ID
# File lib/echochamber/client.rb, line 42 def create_transient_document(file_name, mime_type, file_handle) transient_document_response = Echochamber::Request.create_transient_document(token, file_name, file_handle, mime_type) transient_document_response.fetch("transientDocumentId") end
Creates a user for the current application
@param user [Echochamber::User] @return [String] User
ID of new Echosign user
# File lib/echochamber/client.rb, line 23 def create_user(user) user_response = Echochamber::Request.create_user(user, token) user_response.fetch("userId") end
Creates a widget and returns the Javascript snippet and URL to access the widget and widgetID in response to the client
@param widget [Echochamber::Widget] @return [Hash]
# File lib/echochamber/widget/client.rb, line 9 def create_widget(widget) Echochamber::Request.create_widget(token, widget) end
Gets list of agreements
@param agreement [Echochamber::Agreement] @return [String] Agreement
ID
# File lib/echochamber/agreement/client.rb, line 18 def get_agreements get_agreements_response = Echochamber::Request.get_agreements(token) get_agreements_response.fetch("userAgreementList") end
Retrieves library document metadata
@param library_document_id [String] (REQUIRED) @return [Hash] Library document metadata
# File lib/echochamber/library_documents/client.rb, line 18 def get_library_document(library_document_id) Echochamber::Request.get_library_document(token, library_document_id) end
Retrieves library document file data
@param library_document_id (REQUIRED) @param file_id [String] (REQUIRED) @param file_path [String] File path for saving the document. If none is given, nothing will be saved to disk. @return [String] Raw library document file data
# File lib/echochamber/library_documents/client.rb, line 36 def get_library_document_file(library_document_id, file_id, file_path=nil) response = Echochamber::Request.get_library_document_file(token, library_document_id, file_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Retrieves library document files metadata
@param library_document_id [String] (REQUIRED) @return [Hash] Library document files metadata
# File lib/echochamber/library_documents/client.rb, line 26 def get_library_document_files(library_document_id) Echochamber::Request.get_library_document_files(token, library_document_id) end
Retrieves library documents metadata for a user.
@param user_id [String] The ID of the user whose library documents are being requested. @param user_email [String] The email address of the user whose library documents are being requested. If both user_id and user_email are provided then user_id is given preference. If neither is specified then the user is inferred from the access token. @return [Hash] Library documents metadata
# File lib/echochamber/library_documents/client.rb, line 10 def get_library_documents(user_id=nil, user_email=nil) Echochamber::Request.get_library_documents(token, user_id, user_email) end
Gets all the users in an account that the caller has permissions to access.
@param user_id [String] @return [Hash] User
info hash
# File lib/echochamber/client.rb, line 75 def get_user(user_id) Echochamber::Request.get_user(token, user_id) end
Gets all the users in an account that the caller has permissions to access.
@param user_email [String] The email address of the user whose details are being requested (REQUIRED) @return [Hash] User
info hash
# File lib/echochamber/client.rb, line 67 def get_users(user_email) Echochamber::Request.get_users(token, user_email) end
Retrieves the details of a widget
@param widget_id @return [Hash] Detailed widget info
# File lib/echochamber/widget/client.rb, line 44 def get_widget(widget_id) Echochamber::Request.get_widget(token, widget_id) end
Retrieves the audit trail of a widget identified by widgetId
@note SEEMINGLY NOT YET IMPLEMENTED SERVER-SIDE @param widget_id [String] @param file_path [String] File path where to save the document. If none is given, nothing will be saved to file. @return [String] Raw file stream
# File lib/echochamber/widget/client.rb, line 80 def get_widget_audit_trail(widget_id, file_path=nil) response = Echochamber::Request.get_widget_audit_trail(token, widget_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Gets a single combined PDF document for the documents associated with a widget.
@note SEEMINGLY NOT YET IMPLEMENTED SERVER-SIDE @param widget_id [String] @param file_path [String] File path where to save the document. If none is given, nothing will be saved to file. @return [String] Raw file stream
# File lib/echochamber/widget/client.rb, line 96 def get_widget_combined_pdf(widget_id, file_path=nil) response = Echochamber::Request.get_widget_combined_pdf(token, widget_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Retrieves the file stream of a document of a widget
@param widget_id [String] @param document_id [String] @param file_path [String] File path where to save the document. If none is given, nothing will be saved to file. @return [String] Raw file stream
# File lib/echochamber/widget/client.rb, line 64 def get_widget_document_file(widget_id, document_id, file_path=nil) response = Echochamber::Request.get_widget_document_file(token, widget_id, document_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Retrieves the IDs of the documents associated with widget.
@param widget_id [String] @param version_id [String] The version identifier of widget as provided by get_widget. If not provided then latest version will be used. @param participant_email [String] The email address of the participant to be used to retrieve documents @return [Hash] Info about widget documents
# File lib/echochamber/widget/client.rb, line 54 def get_widget_documents(widget_id, version_id=nil, participant_email=nil) Echochamber::Request.get_widget_documents(token, widget_id, version_id, participant_email) end
Retrieves data entered by the user into interactive form fields at the time they signed the widget
@note SEEMINGLY NOT YET IMPLEMENTED SERVER-SIDE @param widget_id [String] @param file_path [String] File path where to save the document. If none is given, nothing will be saved to file. @return [String] Raw file stream
# File lib/echochamber/widget/client.rb, line 112 def get_widget_form_data(widget_id, file_path=nil) response = Echochamber::Request.get_widget_form_data(token, widget_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Retrieves widgets for a user
@param user_id [String] The ID of the user whose widgets are being requested @param user_email [String] The email address of the user whose widgets are being requested. If both user_id and user_email are provided then user_id is given preference. If neither is specified then the user is inferred from the access token @return [Hash] Widgets info
# File lib/echochamber/widget/client.rb, line 36 def get_widgets(user_id=nil, user_email=nil) Echochamber::Request.get_widgets(token, user_id, user_email) end
Retrieves library combined document file
@param library_document_id (REQUIRED) @param file_path [String] File path for saving the document. If none is given, nothing will be saved to disk. @param auditReport [Boolean] When set to YES attach an audit report to the library document PDF. Default value will be false. @return [String] Raw library combined document file data
# File lib/echochamber/library_documents/client.rb, line 67 def library_combined_document(library_document_id, file_path=nil, auditReport=false) response = Echochamber::Request.library_combined_document(token, library_document_id, auditReport) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Retrieves library document audit trail file
@param library_document_id (REQUIRED) @param file_path [String] File path for saving the document. If none is given, nothing will be saved to disk. @return [String] Raw library document file data
# File lib/echochamber/library_documents/client.rb, line 51 def library_document_audit_trail(library_document_id, file_path=nil) response = Echochamber::Request.library_document_audit_trail(token, library_document_id) unless file_path.nil? file = File.new(file_path, 'wb') file.write(response) file.close end response end
Personalize the widget to a signable document for a specific known user
@param widget_id @param personalization [Echochamber::WidgetPersonalization] @return [Hash] Operation result
# File lib/echochamber/widget/client.rb, line 18 def personalize_widget(widget_id, personalization) Echochamber::Request.personalize_widget(token, widget_id, personalization) end
Enables or Disables a widget
@param widget_id @param status [Echochamber::WidgetStatus] @return [Hash] Widget
status
# File lib/echochamber/widget/client.rb, line 27 def update_widget_status(widget_id, status) Echochamber::Request.update_widget_status(token, widget_id, status) end