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,25 +1,35 @@
1
1
  module Echosign
2
2
  class WidgetCompletionInfo < Hash
3
-
4
3
  include Validatable
5
4
 
6
5
  # Widget initialization object
7
- #
6
+ #
8
7
  # @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
8
+ # @option params [String] :url A publicly accessible url to which the user will be sent after successfully
9
+ # completing the widget. If the URL you provide includes information that allows you to identify the specific
10
+ # transaction, such as your own unique identifier, you can use the browser request to this URL as a callback
11
+ # to notify you that this transaction is completed. In addition, EchoSign will append a documentKey parameter
12
+ # to the URL which will contain the EchoSign DocumentKey for this signed widget, but only if the sender is the
13
+ # same as the API key user. Your application can use this value to get the form data for this widget. (REQUIRED)
14
+ # @option params [Boolean] :deframe If deframe is false, the success page will be shown inside the widget frame.
15
+ # If deframe is true, the success page will be shown in the full browser window. Note that if this widget is
16
+ # loaded through javascript returned from this end point, browser security restrictions do not permit
17
+ # automatic redirection in the full browser window, so if deframe is true the user will instead just see a
18
+ # link to the success page. We recommend this scenario be avoided - in other words, setting deframe to false
19
+ # is recommended for this case.
20
+ # @option params [Fixnum] :delay The delay (in seconds) before the user is taken to the success page. If this
21
+ # value is greater than 0, the user will first see the standard EchoSign success message, and then after a
22
+ # delay will be redirected to your success page. Note that this parameter has no effect for widgets loaded
23
+ # with javascript when deframe is true
12
24
  def initialize(params)
13
25
  require_keys([:url])
14
26
  merge!(
15
- {
16
- :deframe => deframe,
17
- :delay => delay,
18
- :url => url,
19
- }
27
+ {
28
+ deframe: deframe,
29
+ delay: delay,
30
+ url: url,
31
+ }
20
32
  )
21
33
  end
22
-
23
34
  end
24
35
  end
25
-
@@ -1,14 +1,17 @@
1
1
  module Echosign
2
2
  class WidgetPersonalization < Hash
3
-
4
3
  include Validatable
5
4
 
6
5
  # 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.
6
+ #
7
+ # @option params [String] :email (string): The email address of the person who will be receiving this widget
8
+ # (REQUIRED)
9
+ # expiration (date, optional): Expiration date for the personalization of this widget. After this date, the
10
+ # identity of the signer will not be assumed by EchoSign.,
11
+ # @option params [String] :expiration Expiration date for the personalization of this widget. After this date,
12
+ # the identity of the signer will not be assumed by EchoSign.
13
+ # @option params [String] :comment Comment describing how the API caller established the signer's identity -
14
+ # will appear in the audit trail.
12
15
  # @option params [Boolean] :reusable Should the intended signer be allowed to sign this widget more than once
13
16
  # @option params [Boolean] :allowManualVerification Not used at this time,
14
17
  # @return [Echosign::Validatable]
@@ -16,6 +19,5 @@ module Echosign
16
19
  require_keys([:email], params)
17
20
  merge!(params)
18
21
  end
19
-
20
22
  end
21
23
  end
@@ -1,22 +1,32 @@
1
1
  module Echosign
2
2
  class WidgetSecurityOption < Hash
3
-
4
3
  include Validatable
5
4
 
6
5
  # Widget initialization object
7
- #
6
+ #
8
7
  # @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
8
+ # @option params [String] :passwordProtection Specifies if signers are required to enter a password to have
9
+ # 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
11
+ # access to view and sign the widget. The possible values are NONE, EXTERNAL_USERS, INTERNAL_USERS, or ALL_USERS
12
+ # @option params [String] :webIdentityProtection Specifies if signers are required to provide their web
13
+ # identity, before they gain access to view and sign the widget. The possible values are NONE, EXTERNAL_USERS,
14
+ # INTERNAL_USERS, or ALL_USERS
15
+ # @option params [Boolean] :protectOpen If set to true, the document is always be encrypted with this password
16
+ # every time it is sent by email. Recipients need to provide the password to be able to view the PDF files
17
+ # @option params [String] :internalPassword The secondary password that will be used to protect signing the
18
+ # widget for internal signers. Note that EchoSign will never show this password to anyone, so you will need to
19
+ # separately communicate it to any relevant parties. This password is applied only if password protection is
20
+ # specified for internal signers or all signers
21
+ # @option params [String] :externalPassword The secondary password that will be used to protect signing the
22
+ # widget for external signers. Note that EchoSign will never show this password to anyone, so you will need to
23
+ # separately communicate it to any relevant parties. This password is applied only if password protection is
24
+ # specified for external signers or all signers
25
+ # @option params [String] :openPassword The secondary password that will be used to secure the PDF document.
26
+ # Note that EchoSign will never show this password to anyone, so you will need to separately communicate it to
27
+ # any relevant parties. This password is used only if protectOpen field is set to true
16
28
  def initialize(params)
17
29
  merge!(params)
18
30
  end
19
-
20
31
  end
21
32
  end
22
-
@@ -1,18 +1,20 @@
1
1
  module Echosign
2
2
  class WidgetSignerSecurityOption < Hash
3
-
4
3
  include Validatable
5
4
 
6
5
  # 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
6
+ #
7
+ # @param [Hash] params SYMBOL-referenced Hash containing:
8
+ # @option params [String] :authenticationMethod ['INHERITED_FROM_DOCUMENT' or 'KBA' or 'PASSWORD' or
9
+ # 'WEB_IDENTITY' or 'PHONE' or 'NONE']: The authentication method for the recipients to have access to view
10
+ # and sign the widget. PHONE authentication is only applicable to counter signers but not to widget signer
10
11
  # @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
+ # @option params [Array] :phoneInfos Populated with instances of [Echosign::PhoneInfo] The phoneInfo required
13
+ # for the counter signer to view and sign the widget if authentication method is PHONE. Not applicable to
14
+ # widget signer
12
15
  def initialize(params)
13
16
  require_keys([:authenticationMethod], params)
14
17
  merge!(params)
15
18
  end
16
-
17
19
  end
18
20
  end
@@ -1,20 +1,22 @@
1
1
  module Echosign
2
- class WidgetStatus< Hash
3
-
2
+ class WidgetStatus < Hash
4
3
  include Validatable
5
4
 
6
- # Status object
7
- #
5
+ # Status object
6
+ #
8
7
  # @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
8
+ # @option params [String] :value The status to which the widget is to be updated. The possible values for this
9
+ # variable are ENABLE and DISABLE (REQUIRED)
10
+ # @option params [String] :message Display this custom message to the user when the widget is accessed. Note
11
+ # that this can contain wiki markup to include clickable links in the message. This is required if redirectUrl
12
+ # is not provided. Both message and redirectUrl can not be specified
13
+ # @option params [String] :redirectUrl Redirect the user to this URL when the widget is accessed. This is
14
+ # required if message is not provided. Both message and redirectUrl can not be specified
12
15
  # @return [Echosign::WidgetStatus]
13
16
  def initialize(params)
14
17
  require_keys([:value], params)
15
18
  require_exactly_one([:message, :redirectUrl], params)
16
19
  merge!(params)
17
20
  end
18
-
19
21
  end
20
22
  end
@@ -1,16 +1,15 @@
1
1
  module Echosign
2
2
  class WidgetVaultingInfo < Hash
3
-
4
3
  include Validatable
5
4
 
6
5
  # 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
6
+ #
7
+ # @param [Hash] params SYMBOL-referenced Hash containing:
8
+ # @option params [Boolean] :enabled For accounts set up for document vaulting and the option to enable per
9
+ # agreement, this determines whether the document is to be vaulted
10
10
  def initialize(params)
11
11
  require_keys([:enabled], params)
12
12
  merge!(params)
13
13
  end
14
-
15
14
  end
16
15
  end
@@ -6,42 +6,41 @@ describe Echosign::Client do
6
6
  include_context "shared client"
7
7
 
8
8
  describe '.create_agreement' do
9
-
10
9
  let(:url_file_info) do
11
10
  {
12
- url: 'http://findgoplayers.com/resume.pdf',
13
- mimeType: 'application/pdf',
14
- name: 'resume.pdf'
11
+ url: 'http://findgoplayers.com/resume.pdf',
12
+ mimeType: 'application/pdf',
13
+ name: 'resume.pdf'
15
14
  }
16
15
  end
17
16
 
18
17
  let(:file_info) do
19
- {
20
- documentURL: Echosign::UrlFileInfo.new(url_file_info)
18
+ {
19
+ documentURL: Echosign::UrlFileInfo.new(url_file_info)
21
20
  }
22
21
  end
23
22
 
24
23
  let(:file_infos) do
25
- [ Echosign::Fileinfo.new(file_info) ]
24
+ [Echosign::Fileinfo.new(file_info)]
26
25
  end
27
26
 
28
- let(:agreement_user_id) { nil }
27
+ let(:agreement_user_id) { nil }
29
28
  let(:agreement_user_email) { nil }
30
29
 
31
30
  let(:agreement_info) do
32
31
  {
33
- fileInfos: [ file_infos ],
34
- recipients: [ Echosign::Recipient.new({ role: 'SIGNER', email: 'goishi.san@gmail.com'})],
32
+ fileInfos: [file_infos],
33
+ recipientSetInfos: [Echosign::Recipient.new({ role: 'SIGNER', email: 'goishi.san@gmail.com' })],
35
34
  signatureFlow: "SENDER_SIGNS_LAST",
36
35
  signatureType: "ESIGN",
37
36
  name: "Rumplestiltskin Contract"
38
37
  }
39
38
  end
40
39
 
41
- let(:agreement) { Echosign::Agreement.new(agreement_user_id, agreement_user_email, agreement_info) }
40
+ let(:agreement) { Echosign::Agreement.new(agreement_user_id, agreement_user_email, agreement_info) }
42
41
 
43
42
  it 'returns the agreement_id' do
44
- VCR.use_cassette('create_agreement', :record => :once) do
43
+ VCR.use_cassette('create_agreement', record: :once) do
45
44
  agreement_id = client.create_agreement(agreement)
46
45
  expect(agreement_id).to_not be_nil
47
46
  end
@@ -50,7 +49,7 @@ describe Echosign::Client do
50
49
 
51
50
  describe '.get_agreements' do
52
51
  it 'returns all agreements' do
53
- VCR.use_cassette('get_agreements', :record => :once) do
52
+ VCR.use_cassette('get_agreements', record: :once) do
54
53
  response = client.get_agreements
55
54
  expect(response).to_not be_nil
56
55
  end
@@ -60,7 +59,7 @@ describe Echosign::Client do
60
59
  describe '.agreement_info' do
61
60
  let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
62
61
  it 'returns detailed agreement info' do
63
- VCR.use_cassette('agreement_info', :record => :once) do
62
+ VCR.use_cassette('agreement_info', record: :once) do
64
63
  response = client.agreement_info(agreement_id)
65
64
  expect(response).to_not be_nil
66
65
  end
@@ -68,20 +67,20 @@ describe Echosign::Client do
68
67
  end
69
68
 
70
69
  describe '.agreement_form_data' do
71
- let(:agreement_id) { "2AAABLblqZhDvfdYluvps8mSzQXnXr074OVtMYTwTVtljZYFJNi43iuzYeBaPUUOMTSlGXrt04Sw*" }
70
+ let(:agreement_id) { "2AAABLblqZhDvfdYluvps8mSzQXnXr074OVtMYTwTVtljZYFJNi43iuzYeBaPUUOMTSlGXrt04Sw*" }
72
71
  it 'returns CSV data' do
73
- VCR.use_cassette('agreement_form_data', :record => :once) do
72
+ VCR.use_cassette('agreement_form_data', record: :once) do
74
73
  response = client.agreement_form_data(agreement_id)
75
74
  expect(response).to_not be_nil
76
75
  end
77
- end
76
+ end
78
77
  end
79
78
 
80
79
  describe '.cancel_agreement' do
81
80
  let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
82
81
 
83
82
  it 'returns the result of the operation' do
84
- VCR.use_cassette('cancel_agreement', :record => :once) do
83
+ VCR.use_cassette('cancel_agreement', record: :once) do
85
84
  result = client.cancel_agreement(agreement_id, true, 'Just because')
86
85
  expect(result).to_not be_nil
87
86
  end
@@ -95,7 +94,7 @@ describe Echosign::Client do
95
94
  let(:version_id) { nil }
96
95
 
97
96
  it 'returns information about documents for this agreement' do
98
- VCR.use_cassette('agreement_documents', :record => :once) do
97
+ VCR.use_cassette('agreement_documents', record: :once) do
99
98
  result = client.agreement_documents(agreement_id, recipient_email, format, version_id)
100
99
  expect(result).to_not be_nil
101
100
  end
@@ -107,9 +106,9 @@ describe Echosign::Client do
107
106
  let(:document_id) { "2AAABLblqZhDcteEO9jy6gSat9d_3XgpPVpxhetoDCpU4L9PoolGv_3mqgKL1DhIGTXTHhqAHlHk*" }
108
107
 
109
108
  it 'returns a document file from the selected agreement' do
110
- VCR.use_cassette('agreement_document_file', :record => :once) do
109
+ VCR.use_cassette('agreement_document_file', record: :once) do
111
110
  result = client.agreement_document_file(agreement_id, document_id)
112
- expect(result).to be_a String
111
+ expect(result).to be_a String
113
112
  expect(result).to_not be_nil
114
113
  end
115
114
  end
@@ -119,9 +118,9 @@ describe Echosign::Client do
119
118
  let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
120
119
 
121
120
  it 'returns a pdf file for an audit trail on the agreement' do
122
- VCR.use_cassette('audit_trail_pdf', :record => :once) do
121
+ VCR.use_cassette('audit_trail_pdf', record: :once) do
123
122
  result = client.audit_trail_pdf(agreement_id)
124
- expect(result).to be_a String
123
+ expect(result).to be_a String
125
124
  expect(result).to_not be_nil
126
125
  end
127
126
  end
@@ -131,9 +130,9 @@ describe Echosign::Client do
131
130
  let(:agreement_id) { "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*" }
132
131
 
133
132
  it 'returns a combined pdf file ' do
134
- VCR.use_cassette('agreement_combined_pdf', :record => :once) do
133
+ VCR.use_cassette('agreement_combined_pdf', record: :once) do
135
134
  result = client.agreement_combined_pdf(agreement_id)
136
- expect(result).to be_a String
135
+ expect(result).to be_a String
137
136
  expect(result).to_not be_nil
138
137
  end
139
138
  end
@@ -143,15 +142,10 @@ describe Echosign::Client do
143
142
  let(:agreement_id) { "2AAABLblqZhDdfTP0uM4EIz2UE2Mq27D7PXGl7Uk3e5nO4RtzlkN8GMANmeVwUVRWGGuUGCQoRQc*" }
144
143
 
145
144
  it 'returns URL information for the agreement' do
146
- VCR.use_cassette('agreement_signing_urls', :record => :once) do
145
+ VCR.use_cassette('agreement_signing_urls', record: :once) do
147
146
  result = client.agreement_signing_urls(agreement_id)
148
147
  expect(result).to be_a Hash
149
148
  end
150
149
  end
151
150
  end
152
-
153
-
154
-
155
151
  end
156
-
157
-
@@ -17,7 +17,7 @@ describe Echosign::Client do
17
17
  let (:user) { Echosign::User.new(user_params) }
18
18
 
19
19
  it 'returns the User ID' do
20
- VCR.use_cassette('create_user', :record => :once) do
20
+ VCR.use_cassette('create_user', record: :once) do
21
21
  user_id = client.create_user(user)
22
22
  expect(user_id).to_not be_nil
23
23
  end
@@ -25,34 +25,35 @@ describe Echosign::Client do
25
25
  end
26
26
 
27
27
  describe '.get_users' do
28
- let(:email) { "cthomas@railjumper.com" }
28
+ let(:email) { "nobody@nobody.com" }
29
29
  it 'returns user data' do
30
- VCR.use_cassette('get_users', :record => :once) do
30
+ VCR.use_cassette('get_users', record: :once) do
31
31
  response = client.get_users(email)
32
32
  expect(response).to be_a Hash
33
33
  end
34
- end
34
+ end
35
35
  end
36
36
 
37
37
  describe '.get_user' do
38
- let(:id) { "2AAABLblqZhBp6sZ412RCo4_5P1OCDATcuKQf3gzb7M-kea77rqC7h6kzMKSpofswP8rY9Cwv9Vw*" }
38
+ let(:id) { "2AAABLblqZhBp6sZ412RCo4_5P1OCDATcuKQf3gzb7M-kea77rqC7h6kzMKSpofswP8rY9Cwv9Vw*" }
39
39
  it 'returns user data' do
40
- VCR.use_cassette('get_user', :record => :once) do
40
+ VCR.use_cassette('get_user', record: :once) do
41
41
  response = client.get_user(id)
42
42
  expect(response).to be_a Hash
43
43
  end
44
- end
44
+ end
45
45
  end
46
46
 
47
47
  describe '.create_reminder' do
48
- let(:reminderInfo) { {
49
- agreementId: "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*",
50
- comment: "Hey don't forget..."
51
- } }
48
+ let(:reminderInfo) {
49
+ {
50
+ agreementId: "2AAABLblqZhA79nM-6ALjW2nXMKKb_ECz-Nr2yr_WrJ-3-Vz7d5D5_Dn9B6K-25C_EDktQqawW7M*",
51
+ comment: "Hey don't forget..."
52
+ } }
52
53
  let(:reminder) { Echosign::Reminder.new(reminderInfo) }
53
54
 
54
- it 'returns result' do
55
- VCR.use_cassette('create_reminder', :record => :once) do
55
+ it 'returns result' do
56
+ VCR.use_cassette('create_reminder', record: :once) do
56
57
  response = client.create_reminder(reminder)
57
58
  expect(response).to be_a Hash
58
59
  end
@@ -65,14 +66,10 @@ describe Echosign::Client do
65
66
  let(:file) { File.new("fixtures/agreement.pdf", 'rb') }
66
67
 
67
68
  it 'returns the transient document ID' do
68
- VCR.use_cassette('create_transient_document', :record => :once) do
69
+ VCR.use_cassette('create_transient_document', record: :once) do
69
70
  tran_doc_id = client.create_transient_document(file_name, mime_type, file)
70
71
  expect(tran_doc_id).to_not be_nil
71
72
  end
72
73
  end
73
74
  end
74
-
75
-
76
75
  end # describe Echosign::Client
77
-
78
-
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+ require 'lib/shared_client.rb'
3
+
4
+ describe Echosign::Credentials do
5
+ include_context "shared client"
6
+
7
+ let(:app_id) { "9Q444442AX82M" }
8
+ let(:app_secret) { "390db09fc6672388b9457593a7" }
9
+
10
+ describe '#get_token' do
11
+ it 'returns the access_token' do
12
+ VCR.use_cassette('get_token', record: :once) do
13
+ redirect_uri = 'https://example.com/oauth/callback'
14
+ code = 'CBNCKBAAHBCAABAAsl_mVpKa1ksh2FrdZmjju5IzTQ2lynIE'
15
+
16
+ credentials = Echosign::Credentials.new(app_id, app_secret)
17
+ token = credentials.get_token(redirect_uri, code)
18
+ expect(token).to_not be_nil
19
+ end
20
+ end
21
+ end
22
+
23
+ describe '#refresh_access_token' do
24
+ it 'refreshes the access_token' do
25
+ VCR.use_cassette('refresh_token', record: :once) do
26
+ refresh_token = '3AAABLblqZhCNb-X2YXthBgBsEVpM1xC0EATrsDEo0yAmXOIlM58tuASRzYaMjhUGNbRQga8syqE*'
27
+
28
+ credentials = Echosign::Credentials.new(app_id, app_secret)
29
+ token = credentials.refresh_access_token(refresh_token)
30
+ expect(token).to_not be_nil
31
+ end
32
+ end
33
+ end
34
+
35
+ describe '#revoke_token' do
36
+ it 'revokes the access_token' do
37
+ VCR.use_cassette('revoke_token', record: :once) do
38
+ credentials = Echosign::Credentials.new(app_id, app_secret)
39
+
40
+ credentials.instance_variable_set(:@access_token, access_token) # sneaky!
41
+ expect(credentials.access_token).to_not be_nil
42
+
43
+ credentials.revoke_token
44
+ expect(credentials.access_token).to be_nil
45
+ end
46
+ end
47
+ end
48
+ end