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.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.rubocop.yml +14 -0
- data/.rubocop_todo.yml +241 -0
- data/.simplecov +2 -0
- data/.travis.yml +9 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +74 -48
- data/README.md +43 -8
- data/Rakefile +2 -2
- data/doc/Echosign.html +135 -0
- data/doc/Echosign/Agreement.html +545 -0
- data/doc/Echosign/Client.html +5365 -0
- data/doc/Echosign/CounterSignerInfo.html +267 -0
- data/doc/Echosign/Credentials.html +1053 -0
- data/doc/Echosign/Fileinfo.html +305 -0
- data/doc/Echosign/FormFieldLocation.html +264 -0
- data/doc/Echosign/MegaSign.html +533 -0
- data/doc/Echosign/ParameterError.html +124 -0
- data/doc/Echosign/PhoneInfo.html +281 -0
- data/doc/Echosign/Recipient.html +311 -0
- data/doc/Echosign/RecipientSecurityOption.html +296 -0
- data/doc/Echosign/Refresh.html +288 -0
- data/doc/Echosign/Reminder.html +279 -0
- data/doc/Echosign/Request.html +5289 -0
- data/doc/Echosign/Request/EndpointHash.html +328 -0
- data/doc/Echosign/Request/Failure.html +290 -0
- data/doc/Echosign/RequestFormField.html +244 -0
- data/doc/Echosign/RequiredParameterError.html +124 -0
- data/doc/Echosign/UrlFileInfo.html +297 -0
- data/doc/Echosign/User.html +422 -0
- data/doc/Echosign/Validatable.html +355 -0
- data/doc/Echosign/Widget.html +924 -0
- data/doc/Echosign/WidgetCompletionInfo.html +323 -0
- data/doc/Echosign/WidgetPersonalization.html +330 -0
- data/doc/Echosign/WidgetSecurityOption.html +361 -0
- data/doc/Echosign/WidgetSignerSecurityOption.html +298 -0
- data/doc/Echosign/WidgetStatus.html +316 -0
- data/doc/Echosign/WidgetVaultingInfo.html +267 -0
- data/doc/_index.html +378 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.README.html +191 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +191 -0
- data/doc/js/app.js +292 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1035 -0
- data/doc/top-level-namespace.html +110 -0
- data/echosign.gemspec +18 -20
- data/features/support/env.rb +8 -8
- data/fixtures/vcr_cassettes/agreement_combined_pdf.yml +2 -2
- data/fixtures/vcr_cassettes/agreement_document_file.yml +1 -1
- data/fixtures/vcr_cassettes/agreement_documents.yml +2 -2
- data/fixtures/vcr_cassettes/agreement_form_data.yml +1 -1
- data/fixtures/vcr_cassettes/agreement_info.yml +1 -1
- data/fixtures/vcr_cassettes/agreement_signing_urls.yml +1 -1
- data/fixtures/vcr_cassettes/audit_trail_pdf.yml +1 -1
- data/fixtures/vcr_cassettes/cancel_agreement.yml +1 -1
- data/fixtures/vcr_cassettes/create_agreement.yml +1 -1
- data/fixtures/vcr_cassettes/create_reminder.yml +1 -1
- data/fixtures/vcr_cassettes/create_transient_document.yml +1 -1
- data/fixtures/vcr_cassettes/create_user.yml +1 -1
- data/fixtures/vcr_cassettes/create_widget.yml +1 -1
- data/fixtures/vcr_cassettes/get_agreements.yml +1 -1
- data/fixtures/vcr_cassettes/get_library_document.yml +1 -1
- data/fixtures/vcr_cassettes/get_library_document_data.yml +1 -1
- data/fixtures/vcr_cassettes/get_library_document_file.yml +1 -1
- data/fixtures/vcr_cassettes/get_library_documents.yml +1 -1
- data/fixtures/vcr_cassettes/get_token.yml +22 -20
- data/fixtures/vcr_cassettes/get_user.yml +1 -1
- data/fixtures/vcr_cassettes/get_users.yml +2 -2
- data/fixtures/vcr_cassettes/get_widget.yml +1 -1
- data/fixtures/vcr_cassettes/get_widget_document_file.yml +1 -1
- data/fixtures/vcr_cassettes/get_widget_documents.yml +1 -1
- data/fixtures/vcr_cassettes/get_widgets.yml +1 -1
- data/fixtures/vcr_cassettes/library_combined_document.yml +2 -2
- data/fixtures/vcr_cassettes/library_document_audit_trail.yml +1 -1
- data/fixtures/vcr_cassettes/personalize_widget.yml +1 -1
- data/fixtures/vcr_cassettes/refresh_token.yml +46 -0
- data/fixtures/vcr_cassettes/revoke_token.yml +44 -0
- data/fixtures/vcr_cassettes/update_widget_status.yml +1 -1
- data/lib/echosign.rb +11 -11
- data/lib/echosign/agreement.rb +26 -10
- data/lib/echosign/agreement/client.rb +111 -104
- data/lib/echosign/agreement/fileinfo.rb +1 -3
- data/lib/echosign/agreement/form_field_location.rb +2 -3
- data/lib/echosign/agreement/phone_info.rb +5 -5
- data/lib/echosign/agreement/recipient.rb +9 -8
- data/lib/echosign/agreement/recipient_security_option.rb +5 -4
- data/lib/echosign/agreement/request.rb +33 -43
- data/lib/echosign/agreement/request_form_field.rb +2 -3
- data/lib/echosign/agreement/url_file_info.rb +8 -6
- data/lib/echosign/client.rb +33 -24
- data/lib/echosign/credentials.rb +95 -24
- data/lib/echosign/library_documents/client.rb +18 -23
- data/lib/echosign/library_documents/request.rb +19 -20
- data/lib/echosign/mega_sign.rb +20 -10
- data/lib/echosign/mega_sign/client.rb +109 -104
- data/lib/echosign/mega_sign/request.rb +32 -43
- data/lib/echosign/refresh.rb +6 -10
- data/lib/echosign/reminder.rb +2 -2
- data/lib/echosign/request.rb +85 -75
- data/lib/echosign/user.rb +13 -7
- data/lib/echosign/validatable.rb +6 -10
- data/lib/echosign/version.rb +1 -1
- data/lib/echosign/widget.rb +53 -27
- data/lib/echosign/widget/client.rb +33 -36
- data/lib/echosign/widget/counter_signer_info.rb +4 -5
- data/lib/echosign/widget/request.rb +28 -52
- data/lib/echosign/widget/widget_completion_info.rb +22 -12
- data/lib/echosign/widget/widget_personalization.rb +9 -7
- data/lib/echosign/widget/widget_security_option.rb +21 -11
- data/lib/echosign/widget/widget_signer_security_option.rb +8 -6
- data/lib/echosign/widget/widget_status.rb +10 -8
- data/lib/echosign/widget/widget_vaulting_info.rb +4 -5
- data/spec/lib/agreement/client_spec.rb +25 -31
- data/spec/lib/client_spec.rb +15 -18
- data/spec/lib/credentials_spec.rb +48 -0
- data/spec/lib/library_documents/client_spec.rb +11 -15
- data/spec/lib/shared_client.rb +9 -16
- data/spec/lib/user_spec.rb +0 -2
- data/spec/lib/validatable_spec.rb +12 -18
- data/spec/lib/version_spec.rb +1 -1
- data/spec/lib/widget/client_spec.rb +46 -49
- data/spec/spec_helper.rb +12 -5
- metadata +125 -60
- 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
|
10
|
-
#
|
11
|
-
#
|
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
|
-
|
17
|
-
|
18
|
-
|
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
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
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
|
10
|
-
#
|
11
|
-
# @option params [String] :
|
12
|
-
#
|
13
|
-
# @option params [String] :
|
14
|
-
#
|
15
|
-
#
|
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
|
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
|
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
|
10
|
-
#
|
11
|
-
# @option params [String] :
|
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
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
[
|
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: [
|
34
|
-
|
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)
|
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', :
|
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', :
|
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', :
|
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
|
-
|
70
|
+
let(:agreement_id) { "2AAABLblqZhDvfdYluvps8mSzQXnXr074OVtMYTwTVtljZYFJNi43iuzYeBaPUUOMTSlGXrt04Sw*" }
|
72
71
|
it 'returns CSV data' do
|
73
|
-
VCR.use_cassette('agreement_form_data', :
|
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
|
-
|
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', :
|
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', :
|
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', :
|
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', :
|
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', :
|
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', :
|
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
|
-
|
data/spec/lib/client_spec.rb
CHANGED
@@ -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', :
|
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
|
-
|
28
|
+
let(:email) { "nobody@nobody.com" }
|
29
29
|
it 'returns user data' do
|
30
|
-
VCR.use_cassette('get_users', :
|
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
|
-
|
34
|
+
end
|
35
35
|
end
|
36
36
|
|
37
37
|
describe '.get_user' do
|
38
|
-
|
38
|
+
let(:id) { "2AAABLblqZhBp6sZ412RCo4_5P1OCDATcuKQf3gzb7M-kea77rqC7h6kzMKSpofswP8rY9Cwv9Vw*" }
|
39
39
|
it 'returns user data' do
|
40
|
-
VCR.use_cassette('get_user', :
|
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
|
-
|
44
|
+
end
|
45
45
|
end
|
46
46
|
|
47
47
|
describe '.create_reminder' do
|
48
|
-
let(:reminderInfo) {
|
49
|
-
|
50
|
-
|
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'
|
55
|
-
VCR.use_cassette('create_reminder', :
|
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', :
|
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
|