echosign 1.0.2 → 1.5.0

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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/.rubocop.yml +14 -0
  4. data/.rubocop_todo.yml +241 -0
  5. data/.simplecov +2 -0
  6. data/.travis.yml +9 -0
  7. data/Gemfile +3 -3
  8. data/Gemfile.lock +74 -48
  9. data/README.md +43 -8
  10. data/Rakefile +2 -2
  11. data/doc/Echosign.html +135 -0
  12. data/doc/Echosign/Agreement.html +545 -0
  13. data/doc/Echosign/Client.html +5365 -0
  14. data/doc/Echosign/CounterSignerInfo.html +267 -0
  15. data/doc/Echosign/Credentials.html +1053 -0
  16. data/doc/Echosign/Fileinfo.html +305 -0
  17. data/doc/Echosign/FormFieldLocation.html +264 -0
  18. data/doc/Echosign/MegaSign.html +533 -0
  19. data/doc/Echosign/ParameterError.html +124 -0
  20. data/doc/Echosign/PhoneInfo.html +281 -0
  21. data/doc/Echosign/Recipient.html +311 -0
  22. data/doc/Echosign/RecipientSecurityOption.html +296 -0
  23. data/doc/Echosign/Refresh.html +288 -0
  24. data/doc/Echosign/Reminder.html +279 -0
  25. data/doc/Echosign/Request.html +5289 -0
  26. data/doc/Echosign/Request/EndpointHash.html +328 -0
  27. data/doc/Echosign/Request/Failure.html +290 -0
  28. data/doc/Echosign/RequestFormField.html +244 -0
  29. data/doc/Echosign/RequiredParameterError.html +124 -0
  30. data/doc/Echosign/UrlFileInfo.html +297 -0
  31. data/doc/Echosign/User.html +422 -0
  32. data/doc/Echosign/Validatable.html +355 -0
  33. data/doc/Echosign/Widget.html +924 -0
  34. data/doc/Echosign/WidgetCompletionInfo.html +323 -0
  35. data/doc/Echosign/WidgetPersonalization.html +330 -0
  36. data/doc/Echosign/WidgetSecurityOption.html +361 -0
  37. data/doc/Echosign/WidgetSignerSecurityOption.html +298 -0
  38. data/doc/Echosign/WidgetStatus.html +316 -0
  39. data/doc/Echosign/WidgetVaultingInfo.html +267 -0
  40. data/doc/_index.html +378 -0
  41. data/doc/class_list.html +51 -0
  42. data/doc/css/common.css +1 -0
  43. data/doc/css/full_list.css +58 -0
  44. data/doc/css/style.css +496 -0
  45. data/doc/file.README.html +191 -0
  46. data/doc/file_list.html +56 -0
  47. data/doc/frames.html +17 -0
  48. data/doc/index.html +191 -0
  49. data/doc/js/app.js +292 -0
  50. data/doc/js/full_list.js +216 -0
  51. data/doc/js/jquery.js +4 -0
  52. data/doc/method_list.html +1035 -0
  53. data/doc/top-level-namespace.html +110 -0
  54. data/echosign.gemspec +18 -20
  55. data/features/support/env.rb +8 -8
  56. data/fixtures/vcr_cassettes/agreement_combined_pdf.yml +2 -2
  57. data/fixtures/vcr_cassettes/agreement_document_file.yml +1 -1
  58. data/fixtures/vcr_cassettes/agreement_documents.yml +2 -2
  59. data/fixtures/vcr_cassettes/agreement_form_data.yml +1 -1
  60. data/fixtures/vcr_cassettes/agreement_info.yml +1 -1
  61. data/fixtures/vcr_cassettes/agreement_signing_urls.yml +1 -1
  62. data/fixtures/vcr_cassettes/audit_trail_pdf.yml +1 -1
  63. data/fixtures/vcr_cassettes/cancel_agreement.yml +1 -1
  64. data/fixtures/vcr_cassettes/create_agreement.yml +1 -1
  65. data/fixtures/vcr_cassettes/create_reminder.yml +1 -1
  66. data/fixtures/vcr_cassettes/create_transient_document.yml +1 -1
  67. data/fixtures/vcr_cassettes/create_user.yml +1 -1
  68. data/fixtures/vcr_cassettes/create_widget.yml +1 -1
  69. data/fixtures/vcr_cassettes/get_agreements.yml +1 -1
  70. data/fixtures/vcr_cassettes/get_library_document.yml +1 -1
  71. data/fixtures/vcr_cassettes/get_library_document_data.yml +1 -1
  72. data/fixtures/vcr_cassettes/get_library_document_file.yml +1 -1
  73. data/fixtures/vcr_cassettes/get_library_documents.yml +1 -1
  74. data/fixtures/vcr_cassettes/get_token.yml +22 -20
  75. data/fixtures/vcr_cassettes/get_user.yml +1 -1
  76. data/fixtures/vcr_cassettes/get_users.yml +2 -2
  77. data/fixtures/vcr_cassettes/get_widget.yml +1 -1
  78. data/fixtures/vcr_cassettes/get_widget_document_file.yml +1 -1
  79. data/fixtures/vcr_cassettes/get_widget_documents.yml +1 -1
  80. data/fixtures/vcr_cassettes/get_widgets.yml +1 -1
  81. data/fixtures/vcr_cassettes/library_combined_document.yml +2 -2
  82. data/fixtures/vcr_cassettes/library_document_audit_trail.yml +1 -1
  83. data/fixtures/vcr_cassettes/personalize_widget.yml +1 -1
  84. data/fixtures/vcr_cassettes/refresh_token.yml +46 -0
  85. data/fixtures/vcr_cassettes/revoke_token.yml +44 -0
  86. data/fixtures/vcr_cassettes/update_widget_status.yml +1 -1
  87. data/lib/echosign.rb +11 -11
  88. data/lib/echosign/agreement.rb +26 -10
  89. data/lib/echosign/agreement/client.rb +111 -104
  90. data/lib/echosign/agreement/fileinfo.rb +1 -3
  91. data/lib/echosign/agreement/form_field_location.rb +2 -3
  92. data/lib/echosign/agreement/phone_info.rb +5 -5
  93. data/lib/echosign/agreement/recipient.rb +9 -8
  94. data/lib/echosign/agreement/recipient_security_option.rb +5 -4
  95. data/lib/echosign/agreement/request.rb +33 -43
  96. data/lib/echosign/agreement/request_form_field.rb +2 -3
  97. data/lib/echosign/agreement/url_file_info.rb +8 -6
  98. data/lib/echosign/client.rb +33 -24
  99. data/lib/echosign/credentials.rb +95 -24
  100. data/lib/echosign/library_documents/client.rb +18 -23
  101. data/lib/echosign/library_documents/request.rb +19 -20
  102. data/lib/echosign/mega_sign.rb +20 -10
  103. data/lib/echosign/mega_sign/client.rb +109 -104
  104. data/lib/echosign/mega_sign/request.rb +32 -43
  105. data/lib/echosign/refresh.rb +6 -10
  106. data/lib/echosign/reminder.rb +2 -2
  107. data/lib/echosign/request.rb +85 -75
  108. data/lib/echosign/user.rb +13 -7
  109. data/lib/echosign/validatable.rb +6 -10
  110. data/lib/echosign/version.rb +1 -1
  111. data/lib/echosign/widget.rb +53 -27
  112. data/lib/echosign/widget/client.rb +33 -36
  113. data/lib/echosign/widget/counter_signer_info.rb +4 -5
  114. data/lib/echosign/widget/request.rb +28 -52
  115. data/lib/echosign/widget/widget_completion_info.rb +22 -12
  116. data/lib/echosign/widget/widget_personalization.rb +9 -7
  117. data/lib/echosign/widget/widget_security_option.rb +21 -11
  118. data/lib/echosign/widget/widget_signer_security_option.rb +8 -6
  119. data/lib/echosign/widget/widget_status.rb +10 -8
  120. data/lib/echosign/widget/widget_vaulting_info.rb +4 -5
  121. data/spec/lib/agreement/client_spec.rb +25 -31
  122. data/spec/lib/client_spec.rb +15 -18
  123. data/spec/lib/credentials_spec.rb +48 -0
  124. data/spec/lib/library_documents/client_spec.rb +11 -15
  125. data/spec/lib/shared_client.rb +9 -16
  126. data/spec/lib/user_spec.rb +0 -2
  127. data/spec/lib/validatable_spec.rb +12 -18
  128. data/spec/lib/version_spec.rb +1 -1
  129. data/spec/lib/widget/client_spec.rb +46 -49
  130. data/spec/spec_helper.rb +12 -5
  131. metadata +125 -60
  132. data/spec/lib/request_spec.rb +0 -18
@@ -1,22 +1,22 @@
1
1
  module Echosign
2
-
3
- class Client
4
-
2
+ class Client
5
3
  # Retrieves library documents metadata for a user.
6
4
  #
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.
5
+ # @param user_id [String] The ID of the user whose library documents are being requested.
6
+ # @param user_email [String] The email address of the user whose library documents are being requested. If both
7
+ # user_id and user_email are provided then user_id is given preference. If neither is specified then the user
8
+ # is inferred from the access token.
9
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)
10
+ def get_library_documents(user_id = nil, user_email = nil)
11
+ request(:get_library_documents, user_id, user_email)
12
12
  end
13
13
 
14
- # Retrieves library document metadata
14
+ # Retrieves library document metadata
15
15
  #
16
16
  # @param library_document_id [String] (REQUIRED)
17
17
  # @return [Hash] Library document metadata
18
18
  def get_library_document(library_document_id)
19
- Echosign::Request.get_library_document(token, library_document_id)
19
+ request(:get_library_document, library_document_id)
20
20
  end
21
21
 
22
22
  # Retrieves library document files metadata
@@ -24,7 +24,7 @@ module Echosign
24
24
  # @param library_document_id [String] (REQUIRED)
25
25
  # @return [Hash] Library document files metadata
26
26
  def get_library_document_files(library_document_id)
27
- Echosign::Request.get_library_document_files(token, library_document_id)
27
+ request(:get_library_document_files, library_document_id)
28
28
  end
29
29
 
30
30
  # Retrieves library document file data
@@ -33,8 +33,8 @@ module Echosign
33
33
  # @param file_id [String] (REQUIRED)
34
34
  # @param file_path [String] File path for saving the document. If none is given, nothing will be saved to disk.
35
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)
36
+ def get_library_document_file(library_document_id, file_id, file_path = nil)
37
+ response = request(:get_library_document_file, library_document_id, file_id)
38
38
  unless file_path.nil?
39
39
  file = File.new(file_path, 'wb')
40
40
  file.write(response)
@@ -48,8 +48,8 @@ module Echosign
48
48
  # @param library_document_id (REQUIRED)
49
49
  # @param file_path [String] File path for saving the document. If none is given, nothing will be saved to disk.
50
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)
51
+ def library_document_audit_trail(library_document_id, file_path = nil)
52
+ response = request(:library_document_audit_trail, library_document_id)
53
53
  unless file_path.nil?
54
54
  file = File.new(file_path, 'wb')
55
55
  file.write(response)
@@ -62,10 +62,11 @@ module Echosign
62
62
  #
63
63
  # @param library_document_id (REQUIRED)
64
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.
65
+ # @param auditReport [Boolean] When set to YES attach an audit report to the library document PDF. Default value
66
+ # will be false.
66
67
  # @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)
68
+ def library_combined_document(library_document_id, file_path = nil, auditReport = false)
69
+ response = request(:library_combined_document, library_document_id, auditReport)
69
70
  unless file_path.nil?
70
71
  file = File.new(file_path, 'wb')
71
72
  file.write(response)
@@ -73,11 +74,5 @@ module Echosign
73
74
  end
74
75
  response
75
76
  end
76
-
77
-
78
-
79
-
80
77
  end
81
78
  end
82
-
83
-
@@ -1,16 +1,17 @@
1
1
  module Echosign::Request
2
-
3
2
  # Retrieves library documents for a user.
4
3
  #
5
4
  # @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.
5
+ # @param user_id [String] The ID of the user whose library documents are being requested.
6
+ # @param user_email [String] The email address of the user whose library documents are being requested. If both
7
+ # user_id and user_email are provided then user_id is given preference. If neither is specified then the user
8
+ # is inferred from the access token.
8
9
  # @return [Hash] Library documents metadata
9
- def self.get_library_documents(token, user_id=nil, user_email=nil)
10
+ def self.get_library_documents(token, base_uri, user_id = nil, user_email = nil)
10
11
  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)
12
+ headers['X-User-Id'] = user_id unless user_id.nil?
13
+ headers['X-User-Email'] = user_email unless user_email.nil?
14
+ endpoint = ENDPOINT.fetch(:libraryDocument, base_uri)
14
15
  response = get(endpoint, headers)
15
16
  JSON.parse(response.body)
16
17
  end
@@ -20,9 +21,9 @@ module Echosign::Request
20
21
  # @param token [String] Auth Token
21
22
  # @param library_document_id [String]
22
23
  # @return [Hash] Library document metadata
23
- def self.get_library_document(token, library_document_id)
24
+ def self.get_library_document(token, base_uri, library_document_id)
24
25
  headers = { 'Access-Token' => token }
25
- endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}"
26
+ endpoint = "#{ENDPOINT.fetch(:libraryDocument, base_uri)}/#{library_document_id}"
26
27
  response = get(endpoint, headers)
27
28
  JSON.parse(response.body)
28
29
  end
@@ -32,9 +33,9 @@ module Echosign::Request
32
33
  # @param token [String] Auth Token
33
34
  # @param library_document_id [String] (REQUIRED)
34
35
  # @return [Hash] Library document files metadata
35
- def self.get_library_document_files(token, library_document_id)
36
+ def self.get_library_document_files(token, base_uri, library_document_id)
36
37
  headers = { 'Access-Token' => token }
37
- endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}/documents"
38
+ endpoint = "#{ENDPOINT.fetch(:libraryDocument, base_uri)}/#{library_document_id}/documents"
38
39
  response = get(endpoint, headers)
39
40
  JSON.parse(response.body)
40
41
  end
@@ -45,9 +46,9 @@ module Echosign::Request
45
46
  # @param library_document_id [String] (REQUIRED)
46
47
  # @param file_id [String] (REQUIRED)
47
48
  # @return [String] Library document file data
48
- def self.get_library_document_file(token, library_document_id, file_id)
49
+ def self.get_library_document_file(token, base_uri, library_document_id, file_id)
49
50
  headers = { 'Access-Token' => token }
50
- endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}/documents/#{file_id}"
51
+ endpoint = "#{ENDPOINT.fetch(:libraryDocument, base_uri)}/#{library_document_id}/documents/#{file_id}"
51
52
  response = get(endpoint, headers)
52
53
  end
53
54
 
@@ -56,9 +57,9 @@ module Echosign::Request
56
57
  # @param token [String] Auth Token
57
58
  # @param library_document_id [String] (REQUIRED)
58
59
  # @return [String] Library document file data
59
- def self.library_document_audit_trail(token, library_document_id)
60
+ def self.library_document_audit_trail(token, base_uri, library_document_id)
60
61
  headers = { 'Access-Token' => token }
61
- endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}/auditTrail"
62
+ endpoint = "#{ENDPOINT.fetch(:libraryDocument, base_uri)}/#{library_document_id}/auditTrail"
62
63
  response = get(endpoint, headers)
63
64
  end
64
65
 
@@ -67,12 +68,10 @@ module Echosign::Request
67
68
  # @param token [String] Auth Token
68
69
  # @param library_document_id [String] (REQUIRED)
69
70
  # @return [String] Raw library combined document file data
70
- def self.library_combined_document(token, library_document_id, auditReport)
71
+ def self.library_combined_document(token, base_uri, library_document_id, auditReport)
71
72
  headers = { 'Access-Token' => token }
72
- endpoint = "#{ENDPOINT.fetch(:libraryDocument)}/#{library_document_id}/combinedDocument"
73
- endpoint << add_query(endpoint, "auditReport=#{auditReport}")
73
+ endpoint = "#{ENDPOINT.fetch(:libraryDocument, base_uri)}/#{library_document_id}/combinedDocument"
74
+ endpoint << add_query(endpoint, "auditReport=#{auditReport}")
74
75
  response = get(endpoint, headers)
75
76
  end
76
-
77
77
  end
78
-
@@ -4,7 +4,6 @@ require 'echosign/agreement/recipient'
4
4
 
5
5
  module Echosign
6
6
  class MegaSign < Hash
7
-
8
7
  include Validatable
9
8
 
10
9
  attr_accessor :user_id, :user_email
@@ -14,19 +13,30 @@ module Echosign
14
13
  # @param [String] user_id ID of the user whom this megasign is made for
15
14
  # @param [String] user_email Email of the user whom this megasign is made for
16
15
  # @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)
16
+ # @option params [Array] :fileInfos A list of one or more files (or references to files) that will be sent out
17
+ # for signature. If more than one file is provided, they will be combined into one PDF before being sent out.
18
+ # Note: Only one of the four parameters in every FileInfo object must be specified. Populate the array with
19
+ # instances of {Echosign::Fileinfo Echosign::Fileinfo} (REQUIRED)
20
+ # @option params [Array] :recipientSetInfos A list of one or more recipients. For regular (non-MegaSign)
21
+ # documents, there is no limit on the number of electronic signatures in a single document. Written signatures
22
+ # are limited to four per document. This limit includes the sender if the sender's signature is also required.
23
+ # Populate the array with instances of {Echosign::Recipient Echosign::Recipient} (REQUIRED)
24
+ # @option params [String] :signatureFlow ['SENDER_SIGNATURE_NOT_REQUIRED' or 'SENDER_SIGNS_LAST' or
25
+ # 'SENDER_SIGNS_FIRST' or 'SEQUENTIAL' or 'PARALLEL']: Selects the workflow you would like to use - whether
26
+ # the sender needs to sign before the recipient, after the recipient, or not at all. The possible values for
27
+ # this variable are SENDER_SIGNATURE_NOT_REQUIRED, SENDER_SIGNS_LAST, SENDER_SIGNS_FIRST, SEQUENTIAL or
28
+ # PARALLEL. (REQUIRED)
29
+ # @option params [String] :signatureType ['ESIGN' or 'WRITTEN']: Specifies the type of signature you would like
30
+ # to request - written or eSignature. The possible values are ESIGN or WRITTEN (REQUIRED)
31
+ # @option params [String] :name The name of the megasign that will be used to identify it, in emails and on the
32
+ # website. (REQUIRED)
33
+ # @return [Echosign::MegaSign]
34
+ def initialize(user_id = nil, user_email = nil, params)
24
35
  @user_id = user_id
25
36
  @user_email = user_email
26
- #TODO (cthomas) barf if user_id or user_email are blank
37
+ # TODO (cthomas) barf if user_id or user_email are blank
27
38
  require_keys([:signatureType, :recipientSetInfos, :signatureFlow, :fileInfos, :name], params)
28
39
  merge!({ megaSignCreationInfo: params })
29
40
  end
30
-
31
41
  end # class MegaSign
32
42
  end # module Echosign
@@ -1,119 +1,124 @@
1
1
  module Echosign
2
-
3
2
  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)
3
+ # Creates an mega_sign
4
+ #
5
+ # @param mega_sign [Echosign::Agreement]
6
+ # @return [String] Agreement ID
7
+ def create_mega_sign(mega_sign)
8
+ mega_sign_response = request(:create_mega_sign, mega_sign, mega_sign.user_id, mega_sign.user_email)
11
9
  puts mega_sign_response.inspect
12
10
  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
11
+ end
23
12
 
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
13
+ # Gets list of mega_signs
14
+ #
15
+ # @return [Hash] An array of mega sign parent agreements
16
+ def get_mega_signs
17
+ get_mega_signs_response = request(:get_mega_signs)
18
+ get_mega_signs_response.fetch("megaSignList")
19
+ end
31
20
 
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?
21
+ # Gets detailed info on an mega_sign
22
+ #
23
+ # @param mega_sign_id [String] ID of mega_sign to retrieve info on.
24
+ # @return [Hash] Detailed mega_sign info
25
+ def mega_sign_info(mega_sign_id)
26
+ request(:mega_sign_info, mega_sign_id)
27
+ end
44
28
 
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
29
+ # Cancel mega_sign
30
+ #
31
+ # @param mega_sign_id [String] (REQUIRED)
32
+ # @param notify_signer [Boolean] Whether to notify the signer by email of the cancellation. Default is false.
33
+ # @param comment [String] Comment regarding this cancellation.
34
+ # @return [String] Result of the operation
35
+ def cancel_mega_sign(mega_sign_id, notify_signer = false, comment = nil)
36
+ request_body = {
37
+ "value" => "CANCEL",
38
+ "notifySigner" => notify_signer
39
+ }
40
+ request_body[:comment] = comment unless comment.nil?
48
41
 
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
42
+ mega_sign_status_response = request(:update_mega_sign_status, mega_sign_id, request_body)
43
+ mega_sign_status_response.fetch('result')
44
+ end
59
45
 
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
46
+ # All documents relating to an mega_sign
47
+ #
48
+ # @param mega_sign_id [String] (REQUIRED)
49
+ # @param recipient_email [String] The email address of the participant to be used to retrieve documents. (REQUIRED)
50
+ # @param format [String] Content format of the supported documents. It can have two possible values ORIGINAL or
51
+ # CONVERTED_PDF. (REQUIRED)
52
+ # @param version_id [String] Version of the mega_sign as provided by mega_sign_info(). If not provided, the
53
+ # latest version of the mega_sign is used.
54
+ # @return [Array] Documents relating to mega_sign.
55
+ def mega_sign_documents(mega_sign_id, recipient_email, format, version_id = nil)
56
+ result = request(:mega_sign_documents, mega_sign_id, recipient_email, format, version_id)
57
+ end
75
58
 
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
59
+ # Retrieve a document file from an mega_sign
60
+ #
61
+ # @param mega_sign_id [String] (REQUIRED)
62
+ # @param document_id [String] (REQUIRED)
63
+ # @param file_path [String] File path to save the document. If no file path is given, nothing is saved to disk.
64
+ # @return [String] Raw bytes from document file
65
+ def mega_sign_document_file(mega_sign_id, document_id, file_path = nil)
66
+ response = request(:mega_sign_document_file, mega_sign_id, document_id)
67
+ unless file_path.nil?
68
+ file = File.new(file_path, 'wb')
69
+ file.write(response)
70
+ file.close
71
+ end
72
+ response
73
+ end
83
74
 
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
75
+ # Retrieves the URL for the eSign page for the current signer(s) of an mega_sign
76
+ #
77
+ # @param mega_sign_id [String] (REQUIRED)
78
+ # @return [Hash] URL information for the eSign page of the mega_sign
79
+ def mega_sign_signing_urls(mega_sign_id)
80
+ response = request(:mega_sign_signing_urls, mega_sign_id)
81
+ end
102
82
 
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
83
+ # Gets a single combined PDF document for the documents associated with an mega_sign.
84
+ #
85
+ # @param mega_sign_id [String] (REQUIRED)
86
+ # @param file_path [String] File path to save the document. If no file path is given, nothing is saved to disk.
87
+ # @param versionId [String] The version identifier of mega_sign as provided by get_mega_sign. If not provided
88
+ # then latest version will be used
89
+ # @param participantEmail [String] The email address of the participant to be used to retrieve documents. If
90
+ # none is given, the auth token will be used to determine the user
91
+ # @param attachSupportingDocuments [Boolean] When set to YES, attach corresponding supporting documents to the
92
+ # signed mega_sign PDF. Default value of this parameter is true.
93
+ # @param auditReport [Boolean] When set to YES, attach an audit report to the signed mega_sign PDF. Default
94
+ # value is false
95
+ # @return [String] Raw bytes from document file
96
+ def mega_sign_combined_pdf(mega_sign_id, file_path = nil, versionId = nil, participantEmail = nil,
97
+ attachSupportingDocuments = true, auditReport = false)
98
+ response = request(:mega_sign_combined_pdf, mega_sign_id, versionId, participantEmail, attachSupportingDocuments,
99
+ auditReport)
100
+ unless file_path.nil?
101
+ file = File.new(file_path, 'wb')
102
+ file.write(response)
103
+ file.close
104
+ end
105
+ response
106
+ end
117
107
 
108
+ # Retrieves library document audit trail file
109
+ #
110
+ # @param mega_sign_id [String] (REQUIRED)
111
+ # @param file_path [String] File path where to save the CSV file. If no file path is given, nothing is saved to
112
+ # disk.
113
+ # @return [String] Raw bytes representing CSV file
114
+ def mega_sign_form_data(mega_sign_id, file_path = nil)
115
+ response = request(:mega_sign_form_data, mega_sign_id)
116
+ unless file_path.nil?
117
+ file = File.new(file_path, 'wb')
118
+ file.write(response)
119
+ file.close
120
+ end
121
+ response
122
+ end
118
123
  end
119
124
  end