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,127 @@
|
|
1
|
+
module Echosign
|
2
|
+
|
3
|
+
class Client
|
4
|
+
|
5
|
+
# Creates a widget and returns the Javascript snippet and URL to access the widget and widgetID in response to the client
|
6
|
+
#
|
7
|
+
# @param widget [Echosign::Widget]
|
8
|
+
# @return [Hash]
|
9
|
+
def create_widget(widget)
|
10
|
+
Echosign::Request.create_widget(token, widget)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Personalize the widget to a signable document for a specific known user
|
14
|
+
#
|
15
|
+
# @param widget_id
|
16
|
+
# @param personalization [Echosign::WidgetPersonalization]
|
17
|
+
# @return [Hash] Operation result
|
18
|
+
def personalize_widget(widget_id, personalization)
|
19
|
+
Echosign::Request.personalize_widget(token, widget_id, personalization)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Enables or Disables a widget
|
23
|
+
#
|
24
|
+
# @param widget_id
|
25
|
+
# @param status [Echosign::WidgetStatus]
|
26
|
+
# @return [Hash] Widget status
|
27
|
+
def update_widget_status(widget_id, status)
|
28
|
+
Echosign::Request.update_widget_status(token, widget_id, status)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Retrieves widgets for a user
|
32
|
+
#
|
33
|
+
# @param user_id [String] The ID of the user whose widgets are being requested
|
34
|
+
# @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
|
35
|
+
# @return [Hash] Widgets info
|
36
|
+
def get_widgets(user_id=nil, user_email=nil)
|
37
|
+
Echosign::Request.get_widgets(token, user_id, user_email)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Retrieves the details of a widget
|
41
|
+
#
|
42
|
+
# @param widget_id
|
43
|
+
# @return [Hash] Detailed widget info
|
44
|
+
def get_widget(widget_id)
|
45
|
+
Echosign::Request.get_widget(token, widget_id)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Retrieves the IDs of the documents associated with widget.
|
49
|
+
#
|
50
|
+
# @param widget_id [String]
|
51
|
+
# @param version_id [String] The version identifier of widget as provided by get_widget. If not provided then latest version will be used.
|
52
|
+
# @param participant_email [String] The email address of the participant to be used to retrieve documents
|
53
|
+
# @return [Hash] Info about widget documents
|
54
|
+
def get_widget_documents(widget_id, version_id=nil, participant_email=nil)
|
55
|
+
Echosign::Request.get_widget_documents(token, widget_id, version_id, participant_email)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Retrieves the file stream of a document of a widget
|
59
|
+
#
|
60
|
+
# @param widget_id [String]
|
61
|
+
# @param document_id [String]
|
62
|
+
# @param file_path [String] File path where to save the document. If none is given, nothing will be saved to file.
|
63
|
+
# @return [String] Raw file stream
|
64
|
+
def get_widget_document_file(widget_id, document_id, file_path=nil)
|
65
|
+
response = Echosign::Request.get_widget_document_file(token, widget_id, document_id)
|
66
|
+
unless file_path.nil?
|
67
|
+
file = File.new(file_path, 'wb')
|
68
|
+
file.write(response)
|
69
|
+
file.close
|
70
|
+
end
|
71
|
+
response
|
72
|
+
end
|
73
|
+
|
74
|
+
# Retrieves the audit trail of a widget identified by widgetId
|
75
|
+
#
|
76
|
+
# @note SEEMINGLY NOT YET IMPLEMENTED SERVER-SIDE
|
77
|
+
# @param widget_id [String]
|
78
|
+
# @param file_path [String] File path where to save the document. If none is given, nothing will be saved to file.
|
79
|
+
# @return [String] Raw file stream
|
80
|
+
def get_widget_audit_trail(widget_id, file_path=nil)
|
81
|
+
response = Echosign::Request.get_widget_audit_trail(token, widget_id)
|
82
|
+
unless file_path.nil?
|
83
|
+
file = File.new(file_path, 'wb')
|
84
|
+
file.write(response)
|
85
|
+
file.close
|
86
|
+
end
|
87
|
+
response
|
88
|
+
end
|
89
|
+
|
90
|
+
# Gets a single combined PDF document for the documents associated with a widget.
|
91
|
+
#
|
92
|
+
# @note SEEMINGLY NOT YET IMPLEMENTED SERVER-SIDE
|
93
|
+
# @param widget_id [String]
|
94
|
+
# @param file_path [String] File path where to save the document. If none is given, nothing will be saved to file.
|
95
|
+
# @return [String] Raw file stream
|
96
|
+
def get_widget_combined_pdf(widget_id, file_path=nil)
|
97
|
+
response = Echosign::Request.get_widget_combined_pdf(token, widget_id)
|
98
|
+
unless file_path.nil?
|
99
|
+
file = File.new(file_path, 'wb')
|
100
|
+
file.write(response)
|
101
|
+
file.close
|
102
|
+
end
|
103
|
+
response
|
104
|
+
end
|
105
|
+
|
106
|
+
# Retrieves data entered by the user into interactive form fields at the time they signed the widget
|
107
|
+
#
|
108
|
+
# @note SEEMINGLY NOT YET IMPLEMENTED SERVER-SIDE
|
109
|
+
# @param widget_id [String]
|
110
|
+
# @param file_path [String] File path where to save the document. If none is given, nothing will be saved to file.
|
111
|
+
# @return [String] Raw file stream
|
112
|
+
def get_widget_form_data(widget_id, file_path=nil)
|
113
|
+
response = Echosign::Request.get_widget_form_data(token, widget_id)
|
114
|
+
unless file_path.nil?
|
115
|
+
file = File.new(file_path, 'wb')
|
116
|
+
file.write(response)
|
117
|
+
file.close
|
118
|
+
end
|
119
|
+
response
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Echosign
|
2
|
+
class CounterSignerInfo < Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Initialization object
|
7
|
+
#
|
8
|
+
# @param [Hash] params SYMBOL-referenced Hash containing:
|
9
|
+
# @option params [String] :email Email of the recipient (REQUIRED)
|
10
|
+
# @option params [String] :role ['SIGNER' or 'APPROVER']: Specify the role of recipient (REQUIRED)
|
11
|
+
|
12
|
+
# @option params [Array] :securityOptions Populate with instances of {Echosign::WidgetSignerSecurityOption Echosign::WidgetSignerSecurityOption} Security options that apply to the counter signers
|
13
|
+
def initialize(params)
|
14
|
+
require_keys([:email, :role], params)
|
15
|
+
merge!(params)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
module Echosign::Request
|
2
|
+
|
3
|
+
# Creates a widget and returns the Javascript snippet and URL to access the widget and widgetID in response to the client
|
4
|
+
#
|
5
|
+
# @param token [String] Auth token
|
6
|
+
# @param widget [Echosign::Widget]
|
7
|
+
# @return [Hash]
|
8
|
+
def self.create_widget(token, widget)
|
9
|
+
endpoint = ENDPOINT.fetch(:widget)
|
10
|
+
headers = { 'Access-Token' => token}
|
11
|
+
headers.merge!('X-User-Id' => widget.user_id) unless widget.user_id.nil?
|
12
|
+
headers.merge!('X-User-Email' => widget.user_email) unless widget.user_email.nil?
|
13
|
+
response = post(endpoint, widget, headers)
|
14
|
+
JSON.parse(response.body)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Performs REST PUT /agreement/:id operation
|
18
|
+
#
|
19
|
+
# @param token [String] Auth Token
|
20
|
+
# @param widget_id [String]
|
21
|
+
# @param personalization [Echosign::WidgetPersonalization]
|
22
|
+
# @return [Hash] Response body
|
23
|
+
def self.personalize_widget(token, widget_id, personalization)
|
24
|
+
headers = { 'Access-Token' => token }
|
25
|
+
endpoint = "#{ENDPOINT.fetch(:widget)}/#{widget_id}/personalize"
|
26
|
+
|
27
|
+
begin
|
28
|
+
response = HTTParty.put(
|
29
|
+
endpoint,
|
30
|
+
personalization.to_json,
|
31
|
+
headers
|
32
|
+
)
|
33
|
+
rescue Exception => error
|
34
|
+
raise_error(error)
|
35
|
+
end
|
36
|
+
|
37
|
+
JSON.parse(response.body)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Performs REST PUT /agreement/:id operation
|
41
|
+
#
|
42
|
+
# @param token [String] Auth Token
|
43
|
+
# @param widget_id [String]
|
44
|
+
# @param status [Echosign::WidgetStatus]
|
45
|
+
# @return [Hash] Response body
|
46
|
+
def self.update_widget_status(token, widget_id, status)
|
47
|
+
headers = { 'Access-Token' => token }
|
48
|
+
endpoint = "#{ENDPOINT.fetch(:widget)}/#{widget_id}/status"
|
49
|
+
|
50
|
+
begin
|
51
|
+
response = HTTParty.put(
|
52
|
+
endpoint,
|
53
|
+
status.to_json,
|
54
|
+
headers
|
55
|
+
)
|
56
|
+
rescue Exception => error
|
57
|
+
raise_error(error)
|
58
|
+
end
|
59
|
+
|
60
|
+
JSON.parse(response.body)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Performs GET /widgets operation
|
64
|
+
#
|
65
|
+
# @param token [String] Auth Token
|
66
|
+
# @param user_id [String]
|
67
|
+
# @param user_email [String]
|
68
|
+
# @return [Hash] Response body
|
69
|
+
def self.get_widgets(token, user_id=nil, user_email=nil)
|
70
|
+
headers = { 'Access-Token' => token }
|
71
|
+
headers.merge!('X-User-Id' => user_id) unless user_id.nil?
|
72
|
+
headers.merge!('X-User-Email' => user_email) unless user_email.nil?
|
73
|
+
endpoint = "#{ENDPOINT.fetch(:widget)}"
|
74
|
+
response = get(endpoint, headers)
|
75
|
+
JSON.parse(response.body)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Performs GET /widget operation
|
79
|
+
#
|
80
|
+
# @param widget_id [String]
|
81
|
+
# @return [Hash] Response body
|
82
|
+
def self.get_widget(token, widget_id)
|
83
|
+
headers = { 'Access-Token' => token }
|
84
|
+
endpoint = "#{ENDPOINT.fetch(:widget)}/#{widget_id}"
|
85
|
+
response = get(endpoint, headers)
|
86
|
+
JSON.parse(response.body)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Performs GET /widget/:id/documents operation
|
90
|
+
#
|
91
|
+
# @param widget_id [String]
|
92
|
+
# @return [Hash] Response body
|
93
|
+
def self.get_widget_documents(token, widget_id, version_id=nil, participant_email=nil)
|
94
|
+
headers = { 'Access-Token' => token }
|
95
|
+
endpoint = "#{ENDPOINT.fetch(:widget)}/#{widget_id}/documents"
|
96
|
+
endpoint << add_query(endpoint, "versionId=#{version_id}") unless version_id.nil?
|
97
|
+
endpoint << add_query(endpoint, "participantEmail=#{participant_email}") unless participant_email.nil?
|
98
|
+
response = get(endpoint, headers)
|
99
|
+
JSON.parse(response.body)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Performs GET /widget/:id/documents/:id operation
|
103
|
+
#
|
104
|
+
# @param widget_id [String]
|
105
|
+
# @return [Hash] Response body
|
106
|
+
def self.get_widget_document_file(token, widget_id, document_id)
|
107
|
+
headers = { 'Access-Token' => token }
|
108
|
+
endpoint = "#{ENDPOINT.fetch(:widget)}/#{widget_id}/documents/#{document_id}"
|
109
|
+
response = get(endpoint, headers)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Performs GET /widget/:id/auditTrail
|
113
|
+
#
|
114
|
+
# @param widget_id [String]
|
115
|
+
# @return [Hash] Response body
|
116
|
+
def self.get_widget_audit_trail(token, widget_id)
|
117
|
+
headers = { 'Access-Token' => token }
|
118
|
+
endpoint = "#{ENDPOINT.fetch(:widget)}/#{widget_id}/auditTrail"
|
119
|
+
response = get(endpoint, headers)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Performs GET /widget/:id/formData
|
123
|
+
#
|
124
|
+
# @param widget_id [String]
|
125
|
+
# @return [Hash] Response body
|
126
|
+
def self.get_widget_form_data(token, widget_id)
|
127
|
+
headers = { 'Access-Token' => token }
|
128
|
+
endpoint = "#{ENDPOINT.fetch(:widget)}/#{widget_id}/formData"
|
129
|
+
response = get(endpoint, headers)
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Echosign
|
2
|
+
class WidgetCompletionInfo < Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Widget initialization object
|
7
|
+
#
|
8
|
+
# @param [Hash] params SYMBOL-referenced Hash containing:
|
9
|
+
# @option params [String] :url A publicly accessible url to which the user will be sent after successfully completing the widget. If the URL you provide includes information that allows you to identify the specific transaction, such as your own unique identifier, you can use the browser request to this URL as a callback to notify you that this transaction is completed. In addition, EchoSign will append a documentKey parameter to the URL which will contain the EchoSign DocumentKey for this signed widget, but only if the sender is the same as the API key user. Your application can use this value to get the form data for this widget. (REQUIRED)
|
10
|
+
# @option params [Boolean] :deframe If deframe is false, the success page will be shown inside the widget frame. If deframe is true, the success page will be shown in the full browser window. Note that if this widget is loaded through javascript returned from this end point, browser security restrictions do not permit automatic redirection in the full browser window, so if deframe is true the user will instead just see a link to the success page. We recommend this scenario be avoided - in other words, setting deframe to false is recommended for this case.
|
11
|
+
# @option params [Fixnum] :delay The delay (in seconds) before the user is taken to the success page. If this value is greater than 0, the user will first see the standard EchoSign success message, and then after a delay will be redirected to your success page. Note that this parameter has no effect for widgets loaded with javascript when deframe is true
|
12
|
+
def initialize(params)
|
13
|
+
require_keys([:url])
|
14
|
+
merge!(
|
15
|
+
{
|
16
|
+
:deframe => deframe,
|
17
|
+
:delay => delay,
|
18
|
+
:url => url,
|
19
|
+
}
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Echosign
|
2
|
+
class WidgetPersonalization < Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Initialization object
|
7
|
+
#
|
8
|
+
# @option params [String] :email (string): The email address of the person who will be receiving this widget (REQUIRED)
|
9
|
+
# expiration (date, optional): Expiration date for the personalization of this widget. After this date, the identity of the signer will not be assumed by EchoSign.,
|
10
|
+
# @option params [String] :expiration Expiration date for the personalization of this widget. After this date, the identity of the signer will not be assumed by EchoSign.
|
11
|
+
# @option params [String] :comment Comment describing how the API caller established the signer's identity - will appear in the audit trail.
|
12
|
+
# @option params [Boolean] :reusable Should the intended signer be allowed to sign this widget more than once
|
13
|
+
# @option params [Boolean] :allowManualVerification Not used at this time,
|
14
|
+
# @return [Echosign::Validatable]
|
15
|
+
def initialize(params)
|
16
|
+
require_keys([:email], params)
|
17
|
+
merge!(params)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Echosign
|
2
|
+
class WidgetSecurityOption < Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Widget initialization object
|
7
|
+
#
|
8
|
+
# @param [Hash] params SYMBOL-referenced Hash containing:
|
9
|
+
# @option params [String] :passwordProtection Specifies if signers are required to enter a password to have access to sign the widget. The possible values are NONE, EXTERNAL_USERS, INTERNAL_USERS, or ALL_USERS
|
10
|
+
# @option params [String] :kbaProtection Signers need to pass Knowledge Based Authentication before they gain access to view and sign the widget. The possible values are NONE, EXTERNAL_USERS, INTERNAL_USERS, or ALL_USERS
|
11
|
+
# @option params [String] :webIdentityProtection Specifies if signers are required to provide their web identity, before they gain access to view and sign the widget. The possible values are NONE, EXTERNAL_USERS, INTERNAL_USERS, or ALL_USERS
|
12
|
+
# @option params [Boolean] :protectOpen If set to true, the document is always be encrypted with this password every time it is sent by email. Recipients need to provide the password to be able to view the PDF files
|
13
|
+
# @option params [String] :internalPassword The secondary password that will be used to protect signing the widget for internal signers. Note that EchoSign will never show this password to anyone, so you will need to separately communicate it to any relevant parties. This password is applied only if password protection is specified for internal signers or all signers
|
14
|
+
# @option params [String] :externalPassword The secondary password that will be used to protect signing the widget for external signers. Note that EchoSign will never show this password to anyone, so you will need to separately communicate it to any relevant parties. This password is applied only if password protection is specified for external signers or all signers
|
15
|
+
# @option params [String] :openPassword The secondary password that will be used to secure the PDF document. Note that EchoSign will never show this password to anyone, so you will need to separately communicate it to any relevant parties. This password is used only if protectOpen field is set to true
|
16
|
+
def initialize(params)
|
17
|
+
merge!(params)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Echosign
|
2
|
+
class WidgetSignerSecurityOption < Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Initialization object
|
7
|
+
#
|
8
|
+
# @param [Hash] params SYMBOL-referenced Hash containing:
|
9
|
+
# @option params [String] :authenticationMethod ['INHERITED_FROM_DOCUMENT' or 'KBA' or 'PASSWORD' or 'WEB_IDENTITY' or 'PHONE' or 'NONE']: The authentication method for the recipients to have access to view and sign the widget. PHONE authentication is only applicable to counter signers but not to widget signer
|
10
|
+
# @option params [String] :password The password required for the recipient to view and sign the widget
|
11
|
+
# @option params [Array] :phoneInfos Populated with instances of [Echosign::PhoneInfo] The phoneInfo required for the counter signer to view and sign the widget if authentication method is PHONE. Not applicable to widget signer
|
12
|
+
def initialize(params)
|
13
|
+
require_keys([:authenticationMethod], params)
|
14
|
+
merge!(params)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Echosign
|
2
|
+
class WidgetStatus< Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Status object
|
7
|
+
#
|
8
|
+
# @option [Hash] params
|
9
|
+
# @option params [String] :value The status to which the widget is to be updated. The possible values for this variable are ENABLE and DISABLE (REQUIRED)
|
10
|
+
# @option params [String] :message Display this custom message to the user when the widget is accessed. Note that this can contain wiki markup to include clickable links in the message. This is required if redirectUrl is not provided. Both message and redirectUrl can not be specified
|
11
|
+
# @option params [String] :redirectUrl Redirect the user to this URL when the widget is accessed. This is required if message is not provided. Both message and redirectUrl can not be specified
|
12
|
+
# @return [Echosign::WidgetStatus]
|
13
|
+
def initialize(params)
|
14
|
+
require_keys([:value], params)
|
15
|
+
require_exactly_one([:message, :redirectUrl], params)
|
16
|
+
merge!(params)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Echosign
|
2
|
+
class WidgetVaultingInfo < Hash
|
3
|
+
|
4
|
+
include Validatable
|
5
|
+
|
6
|
+
# Initialization object
|
7
|
+
#
|
8
|
+
# @param [Hash] params SYMBOL-referenced Hash containing:
|
9
|
+
# @option params [Boolean] :enabled For accounts set up for document vaulting and the option to enable per agreement, this determines whether the document is to be vaulted
|
10
|
+
def initialize(params)
|
11
|
+
require_keys([:enabled], params)
|
12
|
+
merge!(params)
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,157 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'lib/shared_client.rb'
|
4
|
+
|
5
|
+
describe Echosign::Client do
|
6
|
+
include_context "shared client"
|
7
|
+
|
8
|
+
describe '.create_agreement' do
|
9
|
+
|
10
|
+
let(:url_file_info) do
|
11
|
+
{
|
12
|
+
url: 'http://findgoplayers.com/resume.pdf',
|
13
|
+
mimeType: 'application/pdf',
|
14
|
+
name: 'resume.pdf'
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:file_info) do
|
19
|
+
{
|
20
|
+
documentURL: Echosign::UrlFileInfo.new(url_file_info)
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:file_infos) do
|
25
|
+
[ Echosign::Fileinfo.new(file_info) ]
|
26
|
+
end
|
27
|
+
|
28
|
+
let(:agreement_user_id) { nil }
|
29
|
+
let(:agreement_user_email) { nil }
|
30
|
+
|
31
|
+
let(:agreement_info) do
|
32
|
+
{
|
33
|
+
fileInfos: [ file_infos ],
|
34
|
+
recipients: [ Echosign::Recipient.new({ role: 'SIGNER', email: 'goishi.san@gmail.com'})],
|
35
|
+
signatureFlow: "SENDER_SIGNS_LAST",
|
36
|
+
signatureType: "ESIGN",
|
37
|
+
name: "Rumplestiltskin Contract"
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
let(:agreement) { Echosign::Agreement.new(agreement_user_id, agreement_user_email, agreement_info) }
|
42
|
+
|
43
|
+
it 'returns the agreement_id' do
|
44
|
+
VCR.use_cassette('create_agreement', :record => :once) do
|
45
|
+
agreement_id = client.create_agreement(agreement)
|
46
|
+
expect(agreement_id).to_not be_nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '.get_agreements' do
|
52
|
+
it 'returns all agreements' do
|
53
|
+
VCR.use_cassette('get_agreements', :record => :once) do
|
54
|
+
response = client.get_agreements
|
55
|
+
expect(response).to_not be_nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '.agreement_info' do
|
61
|
+
let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
|
62
|
+
it 'returns detailed agreement info' do
|
63
|
+
VCR.use_cassette('agreement_info', :record => :once) do
|
64
|
+
response = client.agreement_info(agreement_id)
|
65
|
+
expect(response).to_not be_nil
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe '.agreement_form_data' do
|
71
|
+
let(:agreement_id) { "2AAABLblqZhDvfdYluvps8mSzQXnXr074OVtMYTwTVtljZYFJNi43iuzYeBaPUUOMTSlGXrt04Sw*" }
|
72
|
+
it 'returns CSV data' do
|
73
|
+
VCR.use_cassette('agreement_form_data', :record => :once) do
|
74
|
+
response = client.agreement_form_data(agreement_id)
|
75
|
+
expect(response).to_not be_nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '.cancel_agreement' do
|
81
|
+
let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
|
82
|
+
|
83
|
+
it 'returns the result of the operation' do
|
84
|
+
VCR.use_cassette('cancel_agreement', :record => :once) do
|
85
|
+
result = client.cancel_agreement(agreement_id, true, 'Just because')
|
86
|
+
expect(result).to_not be_nil
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '.agreement_documents' do
|
92
|
+
let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
|
93
|
+
let(:recipient_email) { 'goishi.san@gmail.com' }
|
94
|
+
let(:format) { 'CONVERTED_PDF' }
|
95
|
+
let(:version_id) { nil }
|
96
|
+
|
97
|
+
it 'returns information about documents for this agreement' do
|
98
|
+
VCR.use_cassette('agreement_documents', :record => :once) do
|
99
|
+
result = client.agreement_documents(agreement_id, recipient_email, format, version_id)
|
100
|
+
expect(result).to_not be_nil
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe '.agreement_document_file' do
|
106
|
+
let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
|
107
|
+
let(:document_id) { "2AAABLblqZhDcteEO9jy6gSat9d_3XgpPVpxhetoDCpU4L9PoolGv_3mqgKL1DhIGTXTHhqAHlHk*" }
|
108
|
+
|
109
|
+
it 'returns a document file from the selected agreement' do
|
110
|
+
VCR.use_cassette('agreement_document_file', :record => :once) do
|
111
|
+
result = client.agreement_document_file(agreement_id, document_id)
|
112
|
+
expect(result).to be_a String
|
113
|
+
expect(result).to_not be_nil
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
describe '.audit_trail_pdf' do
|
119
|
+
let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
|
120
|
+
|
121
|
+
it 'returns a pdf file for an audit trail on the agreement' do
|
122
|
+
VCR.use_cassette('audit_trail_pdf', :record => :once) do
|
123
|
+
result = client.audit_trail_pdf(agreement_id)
|
124
|
+
expect(result).to be_a String
|
125
|
+
expect(result).to_not be_nil
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe '.agreement_combined_pdf' do
|
131
|
+
let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
|
132
|
+
|
133
|
+
it 'returns a combined pdf file ' do
|
134
|
+
VCR.use_cassette('agreement_combined_pdf', :record => :once) do
|
135
|
+
result = client.agreement_combined_pdf(agreement_id)
|
136
|
+
expect(result).to be_a String
|
137
|
+
expect(result).to_not be_nil
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe '.agreement_signing_urls' do
|
143
|
+
let(:agreement_id) { "2AAABLblqZhDdfTP0uM4EIz2UE2Mq27D7PXGl7Uk3e5nO4RtzlkN8GMANmeVwUVRWGGuUGCQoRQc*" }
|
144
|
+
|
145
|
+
it 'returns URL information for the agreement' do
|
146
|
+
VCR.use_cassette('agreement_signing_urls', :record => :once) do
|
147
|
+
result = client.agreement_signing_urls(agreement_id)
|
148
|
+
expect(result).to be_a Hash
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
|