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.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +3 -0
  5. data/Gemfile.lock +91 -0
  6. data/LICENSE +21 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +87 -0
  9. data/Rakefile +12 -0
  10. data/echosign.gemspec +36 -0
  11. data/features/support/env.rb +8 -0
  12. data/fixtures/agreement.pdf +0 -0
  13. data/fixtures/vcr_cassettes/agreement_combined_pdf.yml +1465 -0
  14. data/fixtures/vcr_cassettes/agreement_document_file.yml +1465 -0
  15. data/fixtures/vcr_cassettes/agreement_documents.yml +42 -0
  16. data/fixtures/vcr_cassettes/agreement_form_data.yml +44 -0
  17. data/fixtures/vcr_cassettes/agreement_info.yml +50 -0
  18. data/fixtures/vcr_cassettes/agreement_signing_urls.yml +42 -0
  19. data/fixtures/vcr_cassettes/audit_trail_pdf.yml +1643 -0
  20. data/fixtures/vcr_cassettes/cancel_agreement.yml +46 -0
  21. data/fixtures/vcr_cassettes/create_agreement.yml +50 -0
  22. data/fixtures/vcr_cassettes/create_reminder.yml +47 -0
  23. data/fixtures/vcr_cassettes/create_transient_document.yml +716 -0
  24. data/fixtures/vcr_cassettes/create_user.yml +50 -0
  25. data/fixtures/vcr_cassettes/create_widget.yml +48 -0
  26. data/fixtures/vcr_cassettes/get_agreements.yml +46 -0
  27. data/fixtures/vcr_cassettes/get_library_document.yml +45 -0
  28. data/fixtures/vcr_cassettes/get_library_document_data.yml +1191 -0
  29. data/fixtures/vcr_cassettes/get_library_document_file.yml +42 -0
  30. data/fixtures/vcr_cassettes/get_library_documents.yml +47 -0
  31. data/fixtures/vcr_cassettes/get_token.yml +44 -0
  32. data/fixtures/vcr_cassettes/get_user.yml +46 -0
  33. data/fixtures/vcr_cassettes/get_users.yml +43 -0
  34. data/fixtures/vcr_cassettes/get_widget.yml +49 -0
  35. data/fixtures/vcr_cassettes/get_widget_document_file.yml +2682 -0
  36. data/fixtures/vcr_cassettes/get_widget_documents.yml +44 -0
  37. data/fixtures/vcr_cassettes/get_widgets.yml +50 -0
  38. data/fixtures/vcr_cassettes/library_combined_document.yml +2197 -0
  39. data/fixtures/vcr_cassettes/library_document_audit_trail.yml +1570 -0
  40. data/fixtures/vcr_cassettes/personalize_widget.yml +47 -0
  41. data/fixtures/vcr_cassettes/update_widget_status.yml +46 -0
  42. data/lib/echosign.rb +11 -0
  43. data/lib/echosign/agreement.rb +34 -0
  44. data/lib/echosign/agreement/client.rb +118 -0
  45. data/lib/echosign/agreement/fileinfo.rb +20 -0
  46. data/lib/echosign/agreement/form_field_location.rb +20 -0
  47. data/lib/echosign/agreement/phone_info.rb +19 -0
  48. data/lib/echosign/agreement/recipient.rb +22 -0
  49. data/lib/echosign/agreement/recipient_security_option.rb +20 -0
  50. data/lib/echosign/agreement/request.rb +144 -0
  51. data/lib/echosign/agreement/request_form_field.rb +15 -0
  52. data/lib/echosign/agreement/url_file_info.rb +18 -0
  53. data/lib/echosign/client.rb +82 -0
  54. data/lib/echosign/credentials.rb +33 -0
  55. data/lib/echosign/library_documents/client.rb +83 -0
  56. data/lib/echosign/library_documents/request.rb +78 -0
  57. data/lib/echosign/mega_sign.rb +32 -0
  58. data/lib/echosign/mega_sign/client.rb +119 -0
  59. data/lib/echosign/mega_sign/request.rb +144 -0
  60. data/lib/echosign/refresh.rb +25 -0
  61. data/lib/echosign/reminder.rb +17 -0
  62. data/lib/echosign/request.rb +165 -0
  63. data/lib/echosign/user.rb +29 -0
  64. data/lib/echosign/validatable.rb +54 -0
  65. data/lib/echosign/version.rb +3 -0
  66. data/lib/echosign/widget.rb +176 -0
  67. data/lib/echosign/widget/client.rb +127 -0
  68. data/lib/echosign/widget/counter_signer_info.rb +19 -0
  69. data/lib/echosign/widget/request.rb +135 -0
  70. data/lib/echosign/widget/widget_completion_info.rb +25 -0
  71. data/lib/echosign/widget/widget_personalization.rb +21 -0
  72. data/lib/echosign/widget/widget_security_option.rb +22 -0
  73. data/lib/echosign/widget/widget_signer_security_option.rb +18 -0
  74. data/lib/echosign/widget/widget_status.rb +20 -0
  75. data/lib/echosign/widget/widget_vaulting_info.rb +16 -0
  76. data/spec/lib/agreement/client_spec.rb +157 -0
  77. data/spec/lib/client_spec.rb +78 -0
  78. data/spec/lib/library_documents/client_spec.rb +71 -0
  79. data/spec/lib/request_spec.rb +18 -0
  80. data/spec/lib/shared_client.rb +22 -0
  81. data/spec/lib/user_spec.rb +6 -0
  82. data/spec/lib/validatable_spec.rb +110 -0
  83. data/spec/lib/version_spec.rb +7 -0
  84. data/spec/lib/widget/client_spec.rb +154 -0
  85. data/spec/spec_helper.rb +22 -0
  86. metadata +307 -0
@@ -0,0 +1,144 @@
1
+ module Echosign::Request
2
+
3
+ # Performs REST create_mega_sign operation
4
+ #
5
+ # @param body [Hash] Request body (REQUIRED)
6
+ # @param token [String] Auth token (REQUIRED)
7
+ # @param user_id [String] Echosign user ID (REQUIRED)
8
+ # @param user_email [String] Echosign user email
9
+ # @return [Hash] MegaSign response body
10
+ def self.create_mega_sign(body, token, user_id=nil, user_email=nil)
11
+ headers = { 'Access-Token' => token }
12
+ headers.merge!('X-User-Id' => user_id) unless user_id.nil?
13
+ headers.merge!('X-User-Email' => user_email) unless user_email.nil?
14
+ headers.merge!('Content-Type' => "application/json")
15
+ response = HTTParty.post(ENDPOINT.fetch(:mega_sign), :body => body.to_json,
16
+ :headers => headers)
17
+ JSON.parse(response.body)
18
+ end
19
+
20
+ # Performs REST GET /mega_signs operation
21
+ #
22
+ # @param token [String] Auth Token
23
+ # @return [Hash] MegaSigns response body
24
+ def self.get_mega_signs(token)
25
+ headers = { 'Access-Token' => token }
26
+ response = get(ENDPOINT.fetch(:mega_sign), headers)
27
+ JSON.parse(response.body)
28
+ end
29
+
30
+ # Performs REST GET /mega_sign/:id operation
31
+ #
32
+ # @param token [String] Auth Token
33
+ # @param mega_sign_id [String] ID of mega_sign to retrieve info on.
34
+ # @return [Hash] MegaSign info response body
35
+ def self.mega_sign_info(token, mega_sign_id)
36
+ headers = { 'Access-Token' => token }
37
+ endpoint = "#{ENDPOINT.fetch(:mega_sign)}/#{mega_sign_id}"
38
+ response = get(endpoint, headers)
39
+ JSON.parse(response.body)
40
+ end
41
+
42
+ # Performs REST GET /mega_sign/:id/signingUrls operation
43
+ #
44
+ # @param token [String] Auth Token
45
+ # @param mega_sign_id [String] ID of mega_sign to retrieve info on.
46
+ # @return [Hash] URL information for the eSign page of the mega_sign
47
+ def self.mega_sign_signing_urls(token, mega_sign_id)
48
+ headers = { 'Access-Token' => token }
49
+ endpoint = "#{ENDPOINT.fetch(:mega_sign)}/#{mega_sign_id}/signingUrls"
50
+ response = get(endpoint, headers)
51
+ JSON.parse(response.body)
52
+ end
53
+
54
+ # Gets a single combined PDF document for the documents associated with an mega_sign.
55
+ #
56
+ # @param token [String] Auth Token
57
+ # @param mega_sign_id [String] ID of mega_sign to retrieve info on.
58
+ # @return [String] Raw bytes from document file
59
+ def self.mega_sign_combined_pdf(token, mega_sign_id, versionId, participantEmail, attachSupportingDocuments, auditReport)
60
+ headers = { 'Access-Token' => token }
61
+ endpoint = "#{ENDPOINT.fetch(:mega_sign)}/#{mega_sign_id}/combinedDocument"
62
+ endpoint << add_query(endpoint, "versionId=#{versionId}") unless versionId.nil?
63
+ endpoint << add_query(endpoint, "participantEmail=#{participantEmail}") unless participantEmail.nil?
64
+ endpoint << add_query(endpoint, "attachSupportingDocuments=#{attachSupportingDocuments}")
65
+ endpoint << add_query(endpoint, "auditReport=#{auditReport}")
66
+ response = get(endpoint, headers)
67
+ end
68
+
69
+ # Retrieves data entered by the user into interactive form fields at the time they signed the mega_sign
70
+ #
71
+ # @param token [String] Auth Token
72
+ # @param mega_sign_id [String] (REQUIRED)
73
+ # @return [String] Raw bytes representing CSV file
74
+ def self.mega_sign_form_data(token, mega_sign_id)
75
+ headers = { 'Access-Token' => token }
76
+ endpoint = "#{ENDPOINT.fetch(:mega_sign)}/#{mega_sign_id}/formData"
77
+ response = get(endpoint, headers)
78
+ end
79
+
80
+ # Retrieve mega_sign document PDF
81
+ #
82
+ # @param token [String] Auth Token
83
+ # @param mega_sign_id [String] ID of mega_sign to retrieve info on.
84
+ # @return [String] Raw bytes from document file
85
+ def self.mega_sign_document_file(token, mega_sign_id, document_id)
86
+ headers = { 'Access-Token' => token }
87
+ endpoint = "#{ENDPOINT.fetch(:mega_sign)}/#{mega_sign_id}/documents/#{document_id}"
88
+ response = get(endpoint, headers)
89
+ end
90
+
91
+ # Performs REST GET /mega_sign/:id/auditTrail operation
92
+ #
93
+ # @param token [String] Auth Token
94
+ # @param mega_sign_id [String] ID of mega_sign to retrieve info on.
95
+ # @return [String] Raw bytes from audit pdf file
96
+ def self.audit_trail_pdf(token, mega_sign_id)
97
+ headers = { 'Access-Token' => token }
98
+ endpoint = "#{ENDPOINT.fetch(:mega_sign)}/#{mega_sign_id}/auditTrail"
99
+ response = get(endpoint, headers)
100
+ end
101
+
102
+ # Performs REST GET /mega_sign/:id/documents
103
+ #
104
+ # @param mega_sign_id [String] (REQUIRED)
105
+ # @param recipient_email [String] The email address of the participant to be used to retrieve documents. (REQUIRED)
106
+ # @param format [String] Content format of the supported documents. It can have two possible values ORIGINAL or CONVERTED_PDF. (REQUIRED)
107
+ # @param version_id [String] Version of the mega_sign as provided by {mega_sign_info mega_sign_info}. If not provided, the latest version of the mega_sign is used.
108
+ # @return [Hash] MegaSign documents response body
109
+ def self.mega_sign_documents(token, mega_sign_id, recipient_email=nil, format=nil, version_id=nil)
110
+ headers = { 'Access-Token' => token }
111
+ endpoint = "#{ENDPOINT.fetch(:mega_sign)}/#{mega_sign_id}/documents"
112
+ endpoint << add_query(endpoint, "versionId=#{version_id}") unless version_id.nil?
113
+ endpoint << add_query(endpoint, "participantEmail=#{recipient_email}") unless version_id.nil?
114
+ endpoint << add_query(endpoint, "supportingDocumentContentFormat=#{format}") unless format.nil?
115
+ response = get(endpoint, headers)
116
+ JSON.parse(response.body)
117
+ end
118
+
119
+
120
+ # Performs REST PUT /mega_sign/:id operation
121
+ #
122
+ # @param token [String] Auth Token
123
+ # @param mega_sign_id [String] ID of mega_sign to retrieve info on.
124
+ # @param request_body [Hash] Hash for MegaSign status update
125
+ # @return [Hash] MegaSigns response body
126
+ def self.update_mega_sign_status(token, mega_sign_id, request_body)
127
+ headers = { 'Access-Token' => token }
128
+ endpoint = "#{ENDPOINT.fetch(:mega_sign)}/#{mega_sign_id}/status"
129
+
130
+ begin
131
+ response = HTTParty.put(
132
+ endpoint,
133
+ request_body.to_json,
134
+ headers
135
+ )
136
+ rescue Exception => error
137
+ raise_error(error)
138
+ end
139
+
140
+ JSON.parse(response.body)
141
+ end
142
+
143
+
144
+ end
@@ -0,0 +1,25 @@
1
+ module Echosign
2
+ class Refresh < Hash
3
+
4
+ include Validatable
5
+
6
+ # Builds a Credentials object
7
+ #
8
+ # @param client_id [String] Application key
9
+ # @param client_secret [String] Application secret
10
+ # @param refresh_token [String] OAuth Refresh Token
11
+ def initialize(client_id, client_secret, refresh_token)
12
+
13
+ merge!(
14
+ {
15
+ :client_id => client_id,
16
+ :client_secret => client_secret,
17
+ :refresh_token => refresh_token,
18
+ :grant_type => "refresh_token"
19
+ }
20
+ )
21
+ end
22
+
23
+ end
24
+ end
25
+
@@ -0,0 +1,17 @@
1
+ module Echosign
2
+ class Reminder < Hash
3
+
4
+ include Validatable
5
+
6
+ # Reminder options
7
+ #
8
+ # @param [Hash] params SYMBOL-referenced Hash containing exactly one of the following:
9
+ # @option params [String] :agreementId (REQUIRED)
10
+ # @option params [String] :comment An Optional message sent to the recipients, describing what is being sent and why their signatures are required.
11
+ # @return [Echosign::Reminder]
12
+ def initialize(params)
13
+ require_keys([:agreementId], params)
14
+ merge!(params)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,165 @@
1
+ require 'httparty'
2
+ require 'echosign/agreement/request'
3
+ require 'echosign/library_documents/request'
4
+ require 'echosign/widget/request'
5
+
6
+ module Echosign::Request
7
+ class Failure < StandardError
8
+ attr_reader :original_exception
9
+
10
+ def initialize msg, original_exception
11
+ @message = msg
12
+ @original_exception = original_exception
13
+ end
14
+ end
15
+
16
+ BASE_URL = 'https://api.eu1.echosign.com/api/rest/v5'
17
+ REFRESH_URL = 'https://api.eu1.echosign.com/oauth/refresh'
18
+
19
+ ENDPOINT = {
20
+ token: BASE_URL + '/auth/tokens',
21
+ refresh: REFRESH_URL,
22
+ user: BASE_URL + '/users',
23
+ agreement: BASE_URL + '/agreements',
24
+ mega_sign: BASE_URL + '/megaSigns',
25
+ reminder: BASE_URL + '/reminders',
26
+ transientDocument: BASE_URL + '/transientDocuments',
27
+ libraryDocument: BASE_URL + '/libraryDocuments',
28
+ widget: BASE_URL + '/widgets'
29
+ }
30
+
31
+ # Retrieves the authentication token
32
+ #
33
+ # @param credentials [Echosign::Credentials] Initialized Echosign::Credentials
34
+ # @return [String] Valid authentication token
35
+ def self.get_token(credentials)
36
+ headers = {}
37
+ response = post(ENDPOINT.fetch(:token), credentials, headers)
38
+ response_body = JSON.parse(response.body)
39
+ response_body.fetch("access_token")
40
+ end
41
+
42
+ # Retrieves the authentication token
43
+ #
44
+ # @param credentials [Echosign::Credentials] Initialized Echosign::Credentials
45
+ # @return [String] Valid authentication token
46
+ def self.get_token_from_refresh(credentials)
47
+ # headers = { :content_type => "application/x-www-form-urlencoded" }
48
+ headers = {}
49
+ response = post(ENDPOINT.fetch(:refresh), credentials, headers)
50
+ response_body = JSON.parse(response.body)
51
+ response_body.fetch("access_token")
52
+ end
53
+
54
+ # Performs REST create_user operation
55
+ #
56
+ # @param body [Hash] Valid request body
57
+ # @param token [String] Auth Token
58
+ # @return [Hash] New user response body
59
+ def self.create_user(body, token)
60
+ endpoint = ENDPOINT.fetch(:user)
61
+ headers = { 'Access-Token' => token}
62
+ response = post(endpoint, body, headers)
63
+ JSON.parse(response.body)
64
+ end
65
+
66
+ # Sends a reminder for an agreement.
67
+ #
68
+ # @param body [Hash] Valid request body
69
+ # @param token [String] Auth Token
70
+ # @return [Hash] Response body
71
+ def self.create_reminder(token, body)
72
+ endpoint = ENDPOINT.fetch(:reminder)
73
+ headers = { 'Access-Token' => token}
74
+ response = post(endpoint, body, headers)
75
+ JSON.parse(response.body)
76
+ end
77
+
78
+ # Performs REST create_transient_document operation
79
+ #
80
+ # @param token [String] Auth token (REQUIRED)
81
+ # @param file_name [String] File name (REQUIRED)
82
+ # @param file_handle [File] File handle (REQUIRED)
83
+ # @param mime_type [String] Mime type
84
+ # @return [Hash] Transient Document Response Body
85
+ def self.create_transient_document(token, file_name, file_handle, mime_type=nil)
86
+ headers = { 'Access-Token' => token }
87
+
88
+ begin
89
+ response = HTTParty.post(
90
+ ENDPOINT.fetch(:transientDocument),
91
+ { 'File-Name' => file_name,
92
+ 'Mime-Type' => mime_type,
93
+ 'File' => file_handle,
94
+ :multipart => true},
95
+ headers
96
+ )
97
+ rescue Exception => error
98
+ raise_error(error)
99
+ end
100
+
101
+ JSON.parse(response.body)
102
+ end
103
+
104
+ # Gets all the users in an account that the caller has permissions to access.
105
+ #
106
+ # @param token [String] Auth Token
107
+ # @param user_email [String] The email address of the user whose details are being requested.
108
+ # @return [Hash] User info hash
109
+ def self.get_users(token, user_email)
110
+ headers = { 'Access-Token' => token }
111
+ endpoint = "#{ENDPOINT.fetch(:user)}?x-user-email=#{user_email}"
112
+ response = get(endpoint, headers)
113
+ JSON.parse(response)
114
+ end
115
+
116
+ # Gets all the users in an account that the caller has permissions to access.
117
+ #
118
+ # @param token [String] Auth Token
119
+ # @param user_id [String]
120
+ # @return [Hash] User info hash
121
+ def self.get_user(token, user_id)
122
+ headers = { 'Access-Token' => token }
123
+ endpoint = "#{ENDPOINT.fetch(:user)}/#{user_id}"
124
+ response = get(endpoint, headers)
125
+ JSON.parse(response)
126
+ end
127
+
128
+
129
+ private
130
+
131
+ def self.get(endpoint, headers)
132
+ begin
133
+ HTTParty.get(
134
+ endpoint,
135
+ headers: headers
136
+ )
137
+ rescue Exception => error
138
+ raise_error(error)
139
+ end
140
+ end
141
+
142
+ def self.post(endpoint, body, headers)
143
+ begin
144
+ HTTParty.post(
145
+ endpoint,
146
+ query: body,
147
+ headers: headers
148
+ )
149
+ rescue Exception => error
150
+ raise_error(error)
151
+ end
152
+ end
153
+
154
+ def self.add_query(url, query)
155
+ (url.include?('?') ? '&' : '?') + query
156
+ end
157
+
158
+ def self.raise_error(error)
159
+ puts error
160
+ message = "#{error.inspect}. \nSee Adobe Echosign REST API documentation for Error code meanings: https://secure.echosign.com/public/docs/restapi/v5"
161
+ raise Failure.new message, error
162
+ end
163
+
164
+ end
165
+
@@ -0,0 +1,29 @@
1
+ module Echosign
2
+ class User < Hash
3
+
4
+ include Validatable
5
+
6
+ # Creates a user for the current application
7
+ #
8
+ # @param [Hash] params SYMBOL-referenced Hash containing:
9
+ # @option params [String] :email User's email address (REQUIRED)
10
+ # @option params [String] :password The new user's password (REQUIRED)
11
+ # @option params [String] :firstName The first name of the new user (REQUIRED)
12
+ # @option params [String] :lastName The last name of the new user (REQUIRED)
13
+ # @option params [String] :optIn 'YES' or 'NO' or 'UNKNOWN': Whether or not the user has opted in to recieve marketing information from EchoSign and its partners. Default value is UNKNOWN
14
+ # @option params [String] :groupId Group in which the new user should be added. It can be obtained through GET /users call. Default is Group of the user making this call. The user is inferred from the access_token header
15
+ # @option params [String] :title The new user's job title
16
+ # @option params [String] :phone The phone number of the new user
17
+ # @option params [String] :company The name of the new user's company
18
+ # @option params [String] :customField1 You can choose to use custom fields to record additional information about your new users. These fields are, however, available only with customized implementations - please contact EchoSign if you would like to make use of this functionality
19
+ # @option params [String] :customField2 You can choose to use custom fields to record additional information about your new users. These fields are, however, available only with customized implementations - please contact EchoSign if you would like to make use of this functionality
20
+ # @option params [String] :customField3 You can choose to use custom fields to record additional information about your new users. These fields are, however, available only with customized implementations - please contact EchoSign if you would like to make use of this functionality
21
+ # @return [String] User ID
22
+
23
+ def initialize(params)
24
+ require_keys([:firstName, :lastName, :email, :password], params)
25
+ merge!(params)
26
+ end
27
+
28
+ end # class User
29
+ end # module Echosign
@@ -0,0 +1,54 @@
1
+ module Echosign
2
+
3
+ class RequiredParameterError < StandardError; end
4
+ class ParameterError < StandardError; end
5
+
6
+ module Validatable
7
+
8
+ def require_keys(required_fields, params)
9
+ required_fields.each do |field|
10
+ validate_field(field, params)
11
+ end
12
+ end
13
+
14
+ def require_exactly_one(field_group, params)
15
+ set_fields = 0
16
+ field_group.each do |field|
17
+ begin
18
+ validate_field(field, params)
19
+ rescue RequiredParameterError
20
+ next
21
+ else
22
+ set_fields += 1
23
+ end
24
+ end
25
+ raise ParameterError, "Exactly one of #{field_group.to_s} should be present" if set_fields != 1
26
+ end
27
+
28
+ # TODO (bernardworthy) A validator accepting a block for conditional execution
29
+ # might be useful.
30
+ # Maybe require_keys should accept a block. Figure out later.
31
+
32
+ def validate_field(field, params)
33
+ begin
34
+ value = params.fetch(field)
35
+ required_error(field) if value.nil? || (value.is_a?(String) && value.empty?)
36
+ rescue KeyError
37
+ required_error(field)
38
+ end
39
+ end
40
+
41
+ private
42
+
43
+ def required_error(field)
44
+ raise RequiredParameterError, "Nil, empty or missing required parameter: #{field.to_s}"
45
+ end
46
+
47
+ # If blank? did not exist, we would need to invent it.
48
+ def blank?(field)
49
+ field.nil? || field.empty?
50
+ end
51
+
52
+ end
53
+
54
+ end
@@ -0,0 +1,3 @@
1
+ module Echosign
2
+ VERSION = "1.0.2"
3
+ end
@@ -0,0 +1,176 @@
1
+ require 'echosign/widget/widget_completion_info'
2
+ require 'echosign/widget/widget_security_option'
3
+ require 'echosign/widget/widget_signer_security_option'
4
+ require 'echosign/widget/widget_vaulting_info'
5
+ require 'echosign/widget/widget_personalization'
6
+ require 'echosign/widget/widget_status'
7
+
8
+ module Echosign
9
+ class Widget < Hash
10
+
11
+ include Validatable
12
+
13
+ attr_reader :user_id, :user_email
14
+
15
+ # Widget initialization object
16
+ #
17
+ # @param user_id [String] The ID of the user on whose behalf widget is being created.
18
+ # @param user_email [String] The email address of the user on whose behalf widget is being created. If both X-User-Id and X-User-Email are provided then X-User-Id is given preference. If neither is specified then the user is inferred from the access token.
19
+ # @param [Hash] params SYMBOL-referenced Hash containing: (REQUIRED)
20
+ # @option params [String] :name The name of the widget that will be used to identify it, in emails and on the website (REQUIRED)
21
+ # @option params [Array] :fileInfos Populate with instances of {Echosign::Fileinfo Echosign::Fileinfo}. A list of one or more files (or references to files) that will be used to create the widget. If more than one file is provided, they will be combined before the widget is created. Library documents are not permitted. Note: Only one of the four parameters in every Fileinfo object must be specified (REQUIRED)
22
+ # @option param [String] :signatureFlow ['SENDER_SIGNATURE_NOT_REQUIRED' or 'SENDER_SIGNS_LAST']: 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 or SENDER_SIGNS_LAST (REQUIRED)
23
+ # @option params [Array] :formFieldLayerTemplates Populate with instances of {Echosign::Fileinfo Echosign::Fileinfo}. Specifies the form field layer template or source of form fields to apply on the files in this transaction. If specified, the FileInfo for this parameter must refer to a form field layer template via libraryDocumentId or libraryDocumentName, or if specified via transientDocumentId or documentURL, it must be of a supported file type. Note: Only one of the four parameters in every FileInfo object must be specified.
24
+ # @option params [Echosign::WidgetCompletionInfo] :widgetCompletionInfo URL and associated properties for the success page the user will be taken to after filling out the widget
25
+ # @option params [String] :callbackInfo A publicly accessible url to which EchoSign will perform an HTTP PUT operation with the final signed PDF file. HTTP authentication is supported using standard embedded syntax - i.e. http://username:password@your.server.com/path/to/file. EchoSign can also communicate with your system using HTTP GET, every time there is a new agreement event. Please contact support@echosign.com if you wish to use this option.
26
+ # @option params [Echosign::WidgetSecurityOption] :securityOptions Sets optional secondary security parameters for your widget
27
+ # @option params [String] :locale The locale associated with this widget - specifies the language for the signing page and emails, for example en_US or fr_FR. If none specified, defaults to the language configured for the widget creator
28
+ # @option params [Echosign::CounterSignerInfo] :counterSigners A list of one or more counter signers
29
+ # @option params [Echosign::WidgetVaultingInfo] :vaultingInfo Sets the vaulting properties that allows EchoSign to securely store documents with a vault provider
30
+ # @option params [Echosign::WidgetMergefieldInfo] :mergeFieldInfo Optional default values for fields to merge into the document. The values will be presented to the signers for editable fields; for read-only fields the provided values will not be editable during the signing process. Merging data into fields is currently not supported when used with libraryDocumentId or libraryDocumentName. Only file and url are curently supported
31
+ # @option params [Echosign::WidgetCompletionInfo] :widgetAuthFailureInfo URL and associated properties for the error page the user will be taken after failing to authenticate
32
+ # @option params [Echosign::WidgetSignerSecurityOption] :widgetSignerSecurityOptions Security options that apply to widget signers
33
+ def initialize(user_id=nil, user_email=nil, name, fileInfos, signatureFlow, widget_completion_info)
34
+ # require_keys([:name, :fileInfos, :signatureFlow], params)
35
+ @user_id = user_id
36
+ @user_email = user_email
37
+
38
+ # {
39
+ # "widgetCreationInfo": {
40
+ # "widgetCompletionInfo": {
41
+ # "deframe": false,
42
+ # "delay": 0,
43
+ # "url": ""
44
+ # },
45
+ # "widgetAuthFailureInfo": {
46
+ # "deframe": false,
47
+ # "delay": 0,
48
+ # "url": ""
49
+ # },
50
+ # "mergeFieldInfo": [
51
+ # {
52
+ # "fieldName": "",
53
+ # "defaultValue": ""
54
+ # }
55
+ # ],
56
+ # "formFieldLayerTemplates": [
57
+ # {
58
+ # "transientDocumentId": "",
59
+ # "libraryDocumentId": "",
60
+ # "libraryDocumentName": "",
61
+ # "documentURL": {
62
+ # "name": "",
63
+ # "url": "",
64
+ # "mimeType": ""
65
+ # }
66
+ # }
67
+ # ],
68
+ # "securityOptions": {
69
+ # "passwordProtection": {
70
+ # "ALL_USERS": "enum",
71
+ # "EXTERNAL_USERS": "enum",
72
+ # "NONE": "enum",
73
+ # "INTERNAL_USERS": "enum"
74
+ # },
75
+ # "kbaProtection": {
76
+ # "ALL_USERS": "enum",
77
+ # "EXTERNAL_USERS": "enum",
78
+ # "NONE": "enum",
79
+ # "INTERNAL_USERS": "enum"
80
+ # },
81
+ # "webIdentityProtection": {
82
+ # "ALL_USERS": "enum",
83
+ # "EXTERNAL_USERS": "enum",
84
+ # "NONE": "enum",
85
+ # "INTERNAL_USERS": "enum"
86
+ # },
87
+ # "protectOpen": false,
88
+ # "internalPassword": "",
89
+ # "externalPassword": "",
90
+ # "openPassword": ""
91
+ # },
92
+ # "fileInfos": [
93
+ # {
94
+ # "transientDocumentId": "",
95
+ # "libraryDocumentId": "",
96
+ # "libraryDocumentName": "",
97
+ # "documentURL": {
98
+ # "name": "",
99
+ # "url": "",
100
+ # "mimeType": ""
101
+ # }
102
+ # }
103
+ # ],
104
+ # "counterSignerSetInfos": [
105
+ # {
106
+ # "counterSignerSetRole": {
107
+ # "SIGNER": "enum",
108
+ # "DELEGATE_TO_SIGNER": "enum",
109
+ # "DELEGATE_TO_APPROVER": "enum",
110
+ # "APPROVER": "enum"
111
+ # },
112
+ # "counterSignerSetMemberInfos": [
113
+ # {
114
+ # "securityOptions": [
115
+ # {
116
+ # "authenticationMethod": {
117
+ # "PHONE": "enum",
118
+ # "INHERITED_FROM_DOCUMENT": "enum",
119
+ # "KBA": "enum",
120
+ # "WEB_IDENTITY": "enum",
121
+ # "PASSWORD": "enum",
122
+ # "NONE": "enum"
123
+ # },
124
+ # "phoneInfos": [
125
+ # {
126
+ # "phone": "",
127
+ # "countryCode": ""
128
+ # }
129
+ # ],
130
+ # "password": ""
131
+ # }
132
+ # ],
133
+ # "email": ""
134
+ # }
135
+ # ]
136
+ # }
137
+ # ],
138
+ # "callbackInfo": "",
139
+ # "widgetSignerSecurityOptions": {
140
+ # "authenticationMethod": {
141
+ # "PHONE": "enum",
142
+ # "INHERITED_FROM_DOCUMENT": "enum",
143
+ # "KBA": "enum",
144
+ # "WEB_IDENTITY": "enum",
145
+ # "PASSWORD": "enum",
146
+ # "NONE": "enum"
147
+ # },
148
+ # "phoneInfos": [
149
+ # {
150
+ # "phone": "",
151
+ # "countryCode": ""
152
+ # }
153
+ # ],
154
+ # "password": ""
155
+ # },
156
+ # "name": "",
157
+ # "locale": "",
158
+ # "vaultingInfo": {
159
+ # "enabled": false
160
+ # },
161
+ # "signatureFlow": ""
162
+ # }
163
+ # }
164
+
165
+ merge!({
166
+ widgetCreationInfo: {
167
+ name: name,
168
+ fileInfos: fileInfos,
169
+ signatureFlow: signatureFlow,
170
+ widgetCompletion_Info: widget_completion_info
171
+ }
172
+ })
173
+ end
174
+
175
+ end
176
+ end