echosign 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +91 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +87 -0
- data/Rakefile +12 -0
- data/echosign.gemspec +36 -0
- data/features/support/env.rb +8 -0
- data/fixtures/agreement.pdf +0 -0
- data/fixtures/vcr_cassettes/agreement_combined_pdf.yml +1465 -0
- data/fixtures/vcr_cassettes/agreement_document_file.yml +1465 -0
- data/fixtures/vcr_cassettes/agreement_documents.yml +42 -0
- data/fixtures/vcr_cassettes/agreement_form_data.yml +44 -0
- data/fixtures/vcr_cassettes/agreement_info.yml +50 -0
- data/fixtures/vcr_cassettes/agreement_signing_urls.yml +42 -0
- data/fixtures/vcr_cassettes/audit_trail_pdf.yml +1643 -0
- data/fixtures/vcr_cassettes/cancel_agreement.yml +46 -0
- data/fixtures/vcr_cassettes/create_agreement.yml +50 -0
- data/fixtures/vcr_cassettes/create_reminder.yml +47 -0
- data/fixtures/vcr_cassettes/create_transient_document.yml +716 -0
- data/fixtures/vcr_cassettes/create_user.yml +50 -0
- data/fixtures/vcr_cassettes/create_widget.yml +48 -0
- data/fixtures/vcr_cassettes/get_agreements.yml +46 -0
- data/fixtures/vcr_cassettes/get_library_document.yml +45 -0
- data/fixtures/vcr_cassettes/get_library_document_data.yml +1191 -0
- data/fixtures/vcr_cassettes/get_library_document_file.yml +42 -0
- data/fixtures/vcr_cassettes/get_library_documents.yml +47 -0
- data/fixtures/vcr_cassettes/get_token.yml +44 -0
- data/fixtures/vcr_cassettes/get_user.yml +46 -0
- data/fixtures/vcr_cassettes/get_users.yml +43 -0
- data/fixtures/vcr_cassettes/get_widget.yml +49 -0
- data/fixtures/vcr_cassettes/get_widget_document_file.yml +2682 -0
- data/fixtures/vcr_cassettes/get_widget_documents.yml +44 -0
- data/fixtures/vcr_cassettes/get_widgets.yml +50 -0
- data/fixtures/vcr_cassettes/library_combined_document.yml +2197 -0
- data/fixtures/vcr_cassettes/library_document_audit_trail.yml +1570 -0
- data/fixtures/vcr_cassettes/personalize_widget.yml +47 -0
- data/fixtures/vcr_cassettes/update_widget_status.yml +46 -0
- data/lib/echosign.rb +11 -0
- data/lib/echosign/agreement.rb +34 -0
- data/lib/echosign/agreement/client.rb +118 -0
- data/lib/echosign/agreement/fileinfo.rb +20 -0
- data/lib/echosign/agreement/form_field_location.rb +20 -0
- data/lib/echosign/agreement/phone_info.rb +19 -0
- data/lib/echosign/agreement/recipient.rb +22 -0
- data/lib/echosign/agreement/recipient_security_option.rb +20 -0
- data/lib/echosign/agreement/request.rb +144 -0
- data/lib/echosign/agreement/request_form_field.rb +15 -0
- data/lib/echosign/agreement/url_file_info.rb +18 -0
- data/lib/echosign/client.rb +82 -0
- data/lib/echosign/credentials.rb +33 -0
- data/lib/echosign/library_documents/client.rb +83 -0
- data/lib/echosign/library_documents/request.rb +78 -0
- data/lib/echosign/mega_sign.rb +32 -0
- data/lib/echosign/mega_sign/client.rb +119 -0
- data/lib/echosign/mega_sign/request.rb +144 -0
- data/lib/echosign/refresh.rb +25 -0
- data/lib/echosign/reminder.rb +17 -0
- data/lib/echosign/request.rb +165 -0
- data/lib/echosign/user.rb +29 -0
- data/lib/echosign/validatable.rb +54 -0
- data/lib/echosign/version.rb +3 -0
- data/lib/echosign/widget.rb +176 -0
- data/lib/echosign/widget/client.rb +127 -0
- data/lib/echosign/widget/counter_signer_info.rb +19 -0
- data/lib/echosign/widget/request.rb +135 -0
- data/lib/echosign/widget/widget_completion_info.rb +25 -0
- data/lib/echosign/widget/widget_personalization.rb +21 -0
- data/lib/echosign/widget/widget_security_option.rb +22 -0
- data/lib/echosign/widget/widget_signer_security_option.rb +18 -0
- data/lib/echosign/widget/widget_status.rb +20 -0
- data/lib/echosign/widget/widget_vaulting_info.rb +16 -0
- data/spec/lib/agreement/client_spec.rb +157 -0
- data/spec/lib/client_spec.rb +78 -0
- data/spec/lib/library_documents/client_spec.rb +71 -0
- data/spec/lib/request_spec.rb +18 -0
- data/spec/lib/shared_client.rb +22 -0
- data/spec/lib/user_spec.rb +6 -0
- data/spec/lib/validatable_spec.rb +110 -0
- data/spec/lib/version_spec.rb +7 -0
- data/spec/lib/widget/client_spec.rb +154 -0
- data/spec/spec_helper.rb +22 -0
- metadata +307 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
module Echosign
|
2
|
+
class RequestFormField < Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Validates RequestFormField params
|
7
|
+
#
|
8
|
+
# @param [Hash] params SYMBOL-referenced Hash containing exactly one of the following:
|
9
|
+
# @return [Echosign::RequestFormField]
|
10
|
+
def initialize(params)
|
11
|
+
require_keys([:locations, :name], params)
|
12
|
+
merge!(params)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Echosign
|
2
|
+
class UrlFileInfo < Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Validates UrlFileInfo parameters
|
7
|
+
#
|
8
|
+
# @param [Hash] params SYMBOL-referenced Hash
|
9
|
+
# @option params [String] :url A publicly accessible URL for retrieving the raw file content. HTTP authentication is supported using standard embedded syntax - i.e. http://username:password@your.server.com/path/to/file (REQUIRED)
|
10
|
+
# @option params [String] :mimeType The mime type of the referenced file, used to determine if the file can be accepted and the necessary conversion steps can be performed.
|
11
|
+
# @option params [String] :name The original system file name of the document being sent - used to name attachments, and to infer the mime type if one is not explicitly specified
|
12
|
+
def initialize(params)
|
13
|
+
require_keys([:url], params)
|
14
|
+
merge! params
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'echosign/agreement/client'
|
2
|
+
require 'echosign/library_documents/client'
|
3
|
+
require 'echosign/widget/client'
|
4
|
+
|
5
|
+
|
6
|
+
module Echosign
|
7
|
+
|
8
|
+
class Client
|
9
|
+
|
10
|
+
attr_reader :token
|
11
|
+
# Initializes the Client object
|
12
|
+
#
|
13
|
+
# @param credentials [Echosign::Credentials] Initialized Echosign::Credentials
|
14
|
+
# @return [Echosign::Client] Initialized Echosign::Client
|
15
|
+
def initialize(credentials)
|
16
|
+
@token = Echosign::Request.get_token_from_refresh(credentials)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Creates a user for the current application
|
20
|
+
#
|
21
|
+
# @param user [Echosign::User]
|
22
|
+
# @return [String] User ID of new Echosign user
|
23
|
+
def create_user(user)
|
24
|
+
user_response = Echosign::Request.create_user(user, token)
|
25
|
+
user_response.fetch("userId")
|
26
|
+
end
|
27
|
+
|
28
|
+
# Creates a reminder
|
29
|
+
#
|
30
|
+
# @param reminder [Echosign::Reminder]
|
31
|
+
# @return [String] Reminder ID
|
32
|
+
def create_reminder(reminder)
|
33
|
+
reminder_response = Echosign::Request.create_reminder(token, reminder)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Creates a transient document for later referral
|
37
|
+
#
|
38
|
+
# @param file_name [String]
|
39
|
+
# @param mime_type [String]
|
40
|
+
# @param file_handle [File]
|
41
|
+
# @return [String] Transient document ID
|
42
|
+
def create_transient_document(file_name, mime_type, file_handle)
|
43
|
+
transient_document_response = Echosign::Request.create_transient_document(token, file_name, file_handle, mime_type)
|
44
|
+
transient_document_response.fetch("transientDocumentId")
|
45
|
+
end
|
46
|
+
|
47
|
+
# Retrieve a PDF audit file for an agreement
|
48
|
+
#
|
49
|
+
# @param agreement_id [String] (REQUIRED)
|
50
|
+
# @param file_path [String] File path to save the document. If no file path is given, nothing is saved to disk.
|
51
|
+
# @return [String] Raw bytes from document file
|
52
|
+
def audit_trail_pdf(agreement_id, file_path=nil)
|
53
|
+
response = Echosign::Request.audit_trail_pdf(token, agreement_id)
|
54
|
+
unless file_path.nil?
|
55
|
+
file = File.new(file_path, 'wb')
|
56
|
+
file.write(response)
|
57
|
+
file.close
|
58
|
+
end
|
59
|
+
response
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
# Gets all the users in an account that the caller has permissions to access.
|
64
|
+
#
|
65
|
+
# @param user_email [String] The email address of the user whose details are being requested (REQUIRED)
|
66
|
+
# @return [Hash] User info hash
|
67
|
+
def get_users(user_email)
|
68
|
+
Echosign::Request.get_users(token, user_email)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Gets all the users in an account that the caller has permissions to access.
|
72
|
+
#
|
73
|
+
# @param user_id [String]
|
74
|
+
# @return [Hash] User info hash
|
75
|
+
def get_user(user_id)
|
76
|
+
Echosign::Request.get_user(token, user_id)
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
end # class Client
|
81
|
+
|
82
|
+
end # module Echosign
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Echosign
|
2
|
+
class Credentials < Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Builds a Credentials object
|
7
|
+
#
|
8
|
+
# @param app_id [String] Application key
|
9
|
+
# @param app_secret [String] Application secret
|
10
|
+
# @param api_key [String] API Key
|
11
|
+
# @param email [String] User email
|
12
|
+
# @param password [String] User password
|
13
|
+
# @return [Echosign::Credentials] Echosign credentials
|
14
|
+
def initialize(app_id, app_secret, api_key, email, password)
|
15
|
+
|
16
|
+
merge!(
|
17
|
+
{
|
18
|
+
applicationCredentials: {
|
19
|
+
applicationId: app_id,
|
20
|
+
applicationSecret: app_secret
|
21
|
+
},
|
22
|
+
userCredentials: {
|
23
|
+
apiKey: api_key,
|
24
|
+
email: email,
|
25
|
+
password: password
|
26
|
+
}
|
27
|
+
}
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module Echosign
|
2
|
+
|
3
|
+
class Client
|
4
|
+
|
5
|
+
# Retrieves library documents metadata for a user.
|
6
|
+
#
|
7
|
+
# @param user_id [String] The ID of the user whose library documents are being requested.
|
8
|
+
# @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.
|
9
|
+
# @return [Hash] Library documents metadata
|
10
|
+
def get_library_documents(user_id=nil, user_email=nil)
|
11
|
+
Echosign::Request.get_library_documents(token, user_id, user_email)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Retrieves library document metadata
|
15
|
+
#
|
16
|
+
# @param library_document_id [String] (REQUIRED)
|
17
|
+
# @return [Hash] Library document metadata
|
18
|
+
def get_library_document(library_document_id)
|
19
|
+
Echosign::Request.get_library_document(token, library_document_id)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Retrieves library document files metadata
|
23
|
+
#
|
24
|
+
# @param library_document_id [String] (REQUIRED)
|
25
|
+
# @return [Hash] Library document files metadata
|
26
|
+
def get_library_document_files(library_document_id)
|
27
|
+
Echosign::Request.get_library_document_files(token, library_document_id)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Retrieves library document file data
|
31
|
+
#
|
32
|
+
# @param library_document_id (REQUIRED)
|
33
|
+
# @param file_id [String] (REQUIRED)
|
34
|
+
# @param file_path [String] File path for saving the document. If none is given, nothing will be saved to disk.
|
35
|
+
# @return [String] Raw library document file data
|
36
|
+
def get_library_document_file(library_document_id, file_id, file_path=nil)
|
37
|
+
response = Echosign::Request.get_library_document_file(token, library_document_id, file_id)
|
38
|
+
unless file_path.nil?
|
39
|
+
file = File.new(file_path, 'wb')
|
40
|
+
file.write(response)
|
41
|
+
file.close
|
42
|
+
end
|
43
|
+
response
|
44
|
+
end
|
45
|
+
|
46
|
+
# Retrieves library document audit trail file
|
47
|
+
#
|
48
|
+
# @param library_document_id (REQUIRED)
|
49
|
+
# @param file_path [String] File path for saving the document. If none is given, nothing will be saved to disk.
|
50
|
+
# @return [String] Raw library document file data
|
51
|
+
def library_document_audit_trail(library_document_id, file_path=nil)
|
52
|
+
response = Echosign::Request.library_document_audit_trail(token, library_document_id)
|
53
|
+
unless file_path.nil?
|
54
|
+
file = File.new(file_path, 'wb')
|
55
|
+
file.write(response)
|
56
|
+
file.close
|
57
|
+
end
|
58
|
+
response
|
59
|
+
end
|
60
|
+
|
61
|
+
# Retrieves library combined document file
|
62
|
+
#
|
63
|
+
# @param library_document_id (REQUIRED)
|
64
|
+
# @param file_path [String] File path for saving the document. If none is given, nothing will be saved to disk.
|
65
|
+
# @param auditReport [Boolean] When set to YES attach an audit report to the library document PDF. Default value will be false.
|
66
|
+
# @return [String] Raw library combined document file data
|
67
|
+
def library_combined_document(library_document_id, file_path=nil, auditReport=false)
|
68
|
+
response = Echosign::Request.library_combined_document(token, library_document_id, auditReport)
|
69
|
+
unless file_path.nil?
|
70
|
+
file = File.new(file_path, 'wb')
|
71
|
+
file.write(response)
|
72
|
+
file.close
|
73
|
+
end
|
74
|
+
response
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Echosign::Request
|
2
|
+
|
3
|
+
# Retrieves library documents for a user.
|
4
|
+
#
|
5
|
+
# @param token [String] Auth Token
|
6
|
+
# @param user_id [String] The ID of the user whose library documents are being requested.
|
7
|
+
# @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.
|
8
|
+
# @return [Hash] Library documents metadata
|
9
|
+
def self.get_library_documents(token, user_id=nil, user_email=nil)
|
10
|
+
headers = { 'Access-Token' => token }
|
11
|
+
headers.merge!('X-User-Id' => user_id) unless user_id.nil?
|
12
|
+
headers.merge!('X-User-Email' => user_email) unless user_email.nil?
|
13
|
+
endpoint = ENDPOINT.fetch(:libraryDocument)
|
14
|
+
response = get(endpoint, headers)
|
15
|
+
JSON.parse(response.body)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Retrieves library document metadata for a user.
|
19
|
+
#
|
20
|
+
# @param token [String] Auth Token
|
21
|
+
# @param library_document_id [String]
|
22
|
+
# @return [Hash] Library document metadata
|
23
|
+
def self.get_library_document(token, library_document_id)
|
24
|
+
headers = { 'Access-Token' => token }
|
25
|
+
endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}"
|
26
|
+
response = get(endpoint, headers)
|
27
|
+
JSON.parse(response.body)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Retrieves library document file
|
31
|
+
#
|
32
|
+
# @param token [String] Auth Token
|
33
|
+
# @param library_document_id [String] (REQUIRED)
|
34
|
+
# @return [Hash] Library document files metadata
|
35
|
+
def self.get_library_document_files(token, library_document_id)
|
36
|
+
headers = { 'Access-Token' => token }
|
37
|
+
endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}/documents"
|
38
|
+
response = get(endpoint, headers)
|
39
|
+
JSON.parse(response.body)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Retrieves library document file data
|
43
|
+
#
|
44
|
+
# @param token [String] Auth Token
|
45
|
+
# @param library_document_id [String] (REQUIRED)
|
46
|
+
# @param file_id [String] (REQUIRED)
|
47
|
+
# @return [String] Library document file data
|
48
|
+
def self.get_library_document_file(token, library_document_id, file_id)
|
49
|
+
headers = { 'Access-Token' => token }
|
50
|
+
endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}/documents/#{file_id}"
|
51
|
+
response = get(endpoint, headers)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Retrieves library document file data
|
55
|
+
#
|
56
|
+
# @param token [String] Auth Token
|
57
|
+
# @param library_document_id [String] (REQUIRED)
|
58
|
+
# @return [String] Library document file data
|
59
|
+
def self.library_document_audit_trail(token, library_document_id)
|
60
|
+
headers = { 'Access-Token' => token }
|
61
|
+
endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}/auditTrail"
|
62
|
+
response = get(endpoint, headers)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Retrieves library combined document file
|
66
|
+
#
|
67
|
+
# @param token [String] Auth Token
|
68
|
+
# @param library_document_id [String] (REQUIRED)
|
69
|
+
# @return [String] Raw library combined document file data
|
70
|
+
def self.library_combined_document(token, library_document_id, auditReport)
|
71
|
+
headers = { 'Access-Token' => token }
|
72
|
+
endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}/combinedDocument"
|
73
|
+
endpoint << add_query(endpoint, "auditReport=#{auditReport}")
|
74
|
+
response = get(endpoint, headers)
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'echosign/agreement/fileinfo'
|
2
|
+
require 'echosign/agreement/url_file_info'
|
3
|
+
require 'echosign/agreement/recipient'
|
4
|
+
|
5
|
+
module Echosign
|
6
|
+
class MegaSign < Hash
|
7
|
+
|
8
|
+
include Validatable
|
9
|
+
|
10
|
+
attr_accessor :user_id, :user_email
|
11
|
+
|
12
|
+
# Creates an MegaSign object for submission
|
13
|
+
#
|
14
|
+
# @param [String] user_id ID of the user whom this megasign is made for
|
15
|
+
# @param [String] user_email Email of the user whom this megasign is made for
|
16
|
+
# @param [Hash] params SYMBOL-referenced Hash containing:
|
17
|
+
# @option params [Array] :fileInfos A list of one or more files (or references to files) that will be sent out for signature. If more than one file is provided, they will be combined into one PDF before being sent out. Note: Only one of the four parameters in every FileInfo object must be specified. Populate the array with instances of {Echosign::Fileinfo Echosign::Fileinfo} (REQUIRED)
|
18
|
+
# @option params [Array] :recipientSetInfos A list of one or more recipients. For regular (non-MegaSign) documents, there is no limit on the number of electronic signatures in a single document. Written signatures are limited to four per document. This limit includes the sender if the sender's signature is also required. Populate the array with instances of {Echosign::Recipient Echosign::Recipient} (REQUIRED)
|
19
|
+
# @option params [String] :signatureFlow ['SENDER_SIGNATURE_NOT_REQUIRED' or 'SENDER_SIGNS_LAST' or 'SENDER_SIGNS_FIRST' or 'SEQUENTIAL' or 'PARALLEL']: Selects the workflow you would like to use - whether the sender needs to sign before the recipient, after the recipient, or not at all. The possible values for this variable are SENDER_SIGNATURE_NOT_REQUIRED, SENDER_SIGNS_LAST, SENDER_SIGNS_FIRST, SEQUENTIAL or PARALLEL. (REQUIRED)
|
20
|
+
# @option params [String] :signatureType ['ESIGN' or 'WRITTEN']: Specifies the type of signature you would like to request - written or eSignature. The possible values are ESIGN or WRITTEN (REQUIRED)
|
21
|
+
# @option params [String] :name The name of the megasign that will be used to identify it, in emails and on the website. (REQUIRED)
|
22
|
+
# @return [Echosign::MegaSign]
|
23
|
+
def initialize(user_id=nil, user_email=nil, params)
|
24
|
+
@user_id = user_id
|
25
|
+
@user_email = user_email
|
26
|
+
#TODO (cthomas) barf if user_id or user_email are blank
|
27
|
+
require_keys([:signatureType, :recipientSetInfos, :signatureFlow, :fileInfos, :name], params)
|
28
|
+
merge!({ megaSignCreationInfo: params })
|
29
|
+
end
|
30
|
+
|
31
|
+
end # class MegaSign
|
32
|
+
end # module Echosign
|
@@ -0,0 +1,119 @@
|
|
1
|
+
module Echosign
|
2
|
+
|
3
|
+
class Client
|
4
|
+
|
5
|
+
# Creates an mega_sign
|
6
|
+
#
|
7
|
+
# @param mega_sign [Echosign::Agreement]
|
8
|
+
# @return [String] Agreement ID
|
9
|
+
def create_mega_sign(mega_sign)
|
10
|
+
mega_sign_response = Echosign::Request.create_mega_sign(mega_sign, token, mega_sign.user_id, mega_sign.user_email)
|
11
|
+
puts mega_sign_response.inspect
|
12
|
+
mega_sign_response.fetch("mega_signId")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Gets list of mega_signs
|
16
|
+
#
|
17
|
+
# @param mega_sign [Echosign::Agreement]
|
18
|
+
# @return [String] Agreement ID
|
19
|
+
def get_mega_signs
|
20
|
+
get_mega_signs_response = Echosign::Request.get_mega_signs(token)
|
21
|
+
get_mega_signs_response.fetch("userAgreementList")
|
22
|
+
end
|
23
|
+
|
24
|
+
# Gets detailed info on an mega_sign
|
25
|
+
#
|
26
|
+
# @param mega_sign_id [String] ID of mega_sign to retrieve info on.
|
27
|
+
# @return [Hash] Detailed mega_sign info
|
28
|
+
def mega_sign_info(mega_sign_id)
|
29
|
+
Echosign::Request.mega_sign_info(token, mega_sign_id)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Cancel mega_sign
|
33
|
+
#
|
34
|
+
# @param mega_sign_id [String] (REQUIRED)
|
35
|
+
# @param notify_signer [Boolean] Whether to notify the signer by email of the cancellation. Default is false.
|
36
|
+
# @param comment [String] Comment regarding this cancellation.
|
37
|
+
# @return [String] Result of the operation
|
38
|
+
def cancel_mega_sign(mega_sign_id, notify_signer=false, comment=nil)
|
39
|
+
request_body = {
|
40
|
+
"value" => "CANCEL",
|
41
|
+
"notifySigner" => notify_signer
|
42
|
+
}
|
43
|
+
request_body.merge!(comment: comment) unless comment.nil?
|
44
|
+
|
45
|
+
mega_sign_status_response = Echosign::Request.update_mega_sign_status(token, mega_sign_id, request_body)
|
46
|
+
mega_sign_status_response.fetch('result')
|
47
|
+
end
|
48
|
+
|
49
|
+
# All documents relating to an mega_sign
|
50
|
+
#
|
51
|
+
# @param mega_sign_id [String] (REQUIRED)
|
52
|
+
# @param recipient_email [String] The email address of the participant to be used to retrieve documents. (REQUIRED)
|
53
|
+
# @param format [String] Content format of the supported documents. It can have two possible values ORIGINAL or CONVERTED_PDF. (REQUIRED)
|
54
|
+
# @param version_id [String] Version of the mega_sign as provided by mega_sign_info(). If not provided, the latest version of the mega_sign is used.
|
55
|
+
# @return [Array] Documents relating to mega_sign.
|
56
|
+
def mega_sign_documents(mega_sign_id, recipient_email, format, version_id=nil)
|
57
|
+
result = Echosign::Request.mega_sign_documents(token, mega_sign_id, recipient_email, format, version_id)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Retrieve a document file from an mega_sign
|
61
|
+
#
|
62
|
+
# @param mega_sign_id [String] (REQUIRED)
|
63
|
+
# @param document_id [String] (REQUIRED)
|
64
|
+
# @param file_path [String] File path to save the document. If no file path is given, nothing is saved to disk.
|
65
|
+
# @return [String] Raw bytes from document file
|
66
|
+
def mega_sign_document_file(mega_sign_id, document_id, file_path=nil)
|
67
|
+
response = Echosign::Request.mega_sign_document_file(token, mega_sign_id, document_id)
|
68
|
+
unless file_path.nil?
|
69
|
+
file = File.new(file_path, 'wb')
|
70
|
+
file.write(response)
|
71
|
+
file.close
|
72
|
+
end
|
73
|
+
response
|
74
|
+
end
|
75
|
+
|
76
|
+
# Retrieves the URL for the eSign page for the current signer(s) of an mega_sign
|
77
|
+
#
|
78
|
+
# @param mega_sign_id [String] (REQUIRED)
|
79
|
+
# @return [Hash] URL information for the eSign page of the mega_sign
|
80
|
+
def mega_sign_signing_urls(mega_sign_id)
|
81
|
+
response = Echosign::Request.mega_sign_signing_urls(token, mega_sign_id)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Gets a single combined PDF document for the documents associated with an mega_sign.
|
85
|
+
#
|
86
|
+
# @param mega_sign_id [String] (REQUIRED)
|
87
|
+
# @param file_path [String] File path to save the document. If no file path is given, nothing is saved to disk.
|
88
|
+
# @param versionId [String] The version identifier of mega_sign as provided by get_mega_sign. If not provided then latest version will be used
|
89
|
+
# @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
|
90
|
+
# @param attachSupportingDocuments [Boolean] When set to YES, attach corresponding supporting documents to the signed mega_sign PDF. Default value of this parameter is true.
|
91
|
+
# @param auditReport [Boolean] When set to YES, attach an audit report to the signed mega_sign PDF. Default value is false
|
92
|
+
# @return [String] Raw bytes from document file
|
93
|
+
def mega_sign_combined_pdf(mega_sign_id, file_path=nil, versionId=nil, participantEmail=nil, attachSupportingDocuments=true, auditReport=false)
|
94
|
+
response = Echosign::Request.mega_sign_combined_pdf(token, mega_sign_id, versionId, participantEmail, attachSupportingDocuments, auditReport)
|
95
|
+
unless file_path.nil?
|
96
|
+
file = File.new(file_path, 'wb')
|
97
|
+
file.write(response)
|
98
|
+
file.close
|
99
|
+
end
|
100
|
+
response
|
101
|
+
end
|
102
|
+
|
103
|
+
# Retrieves library document audit trail file
|
104
|
+
#
|
105
|
+
# @param mega_sign_id [String] (REQUIRED)
|
106
|
+
# @param file_path [String] File path where to save the CSV file. If no file path is given, nothing is saved to disk.
|
107
|
+
# @return [String] Raw bytes representing CSV file
|
108
|
+
def mega_sign_form_data(mega_sign_id, file_path=nil)
|
109
|
+
response = Echosign::Request.mega_sign_form_data(token, mega_sign_id)
|
110
|
+
unless file_path.nil?
|
111
|
+
file = File.new(file_path, 'wb')
|
112
|
+
file.write(response)
|
113
|
+
file.close
|
114
|
+
end
|
115
|
+
response
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
end
|