hellosign-ruby-sdk 3.0.3 → 3.0.4
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.
- data/README.md +1 -2
- data/Rakefile +2 -2
- data/hellosign-ruby-sdk.gemspec +8 -8
- data/lib/hello_sign.rb +1 -1
- data/lib/hello_sign/api/account.rb +7 -10
- data/lib/hello_sign/api/embedded.rb +1 -1
- data/lib/hello_sign/api/oauth.rb +7 -9
- data/lib/hello_sign/api/signature_request.rb +10 -10
- data/lib/hello_sign/api/team.rb +10 -10
- data/lib/hello_sign/api/template.rb +6 -7
- data/lib/hello_sign/api/unclaimed_draft.rb +2 -4
- data/lib/hello_sign/client.rb +11 -11
- data/lib/hello_sign/configuration.rb +1 -2
- data/lib/hello_sign/resource/base_resource.rb +1 -3
- data/lib/hello_sign/resource/resource_array.rb +2 -3
- data/lib/hello_sign/resource/template.rb +0 -1
- data/lib/hello_sign/version.rb +1 -1
- data/spec/fixtures/account.json +15 -1
- data/spec/fixtures/error.json +5 -5
- data/spec/fixtures/signature_request.json +38 -2
- data/spec/fixtures/signature_requests.json +43 -13
- data/spec/fixtures/team.json +14 -18
- data/spec/fixtures/template.json +53 -1
- data/spec/fixtures/templates.json +58 -10
- data/spec/fixtures/token.json +13 -13
- data/spec/fixtures/unclaimed_draft.json +5 -5
- data/spec/hello_sign/api/account_spec.rb +13 -15
- data/spec/hello_sign/api/embedded_spec.rb +4 -4
- data/spec/hello_sign/api/oauth_spec.rb +9 -10
- data/spec/hello_sign/api/signature_request_spec.rb +43 -44
- data/spec/hello_sign/api/team_spec.rb +37 -39
- data/spec/hello_sign/api/template_spec.rb +21 -21
- data/spec/hello_sign/api/unclaimed_draft_spec.rb +13 -13
- data/spec/hello_sign/client_spec.rb +50 -51
- data/spec/hello_sign/resource/base_resource_spec.rb +18 -16
- data/spec/hello_sign_spec.rb +7 -7
- data/spec/spec_helper.rb +0 -1
- metadata +3 -3
@@ -1,18 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe HelloSign::Api::Embedded do
|
4
|
-
describe
|
5
|
-
let(:signature_id){'50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b'}
|
4
|
+
describe '#get_embedded_sign_url' do
|
5
|
+
let(:signature_id) { '50e3542f738adfa7ddd4cbd4c00d2a8ab6e4194b' }
|
6
6
|
before do
|
7
7
|
stub_get("/embedded/sign_url/#{signature_id}", 'embedded')
|
8
8
|
@embedded = HelloSign.get_embedded_sign_url :signature_id => signature_id
|
9
9
|
end
|
10
10
|
|
11
|
-
it
|
11
|
+
it 'should get the correct resource' do
|
12
12
|
expect(a_get("/embedded/sign_url/#{signature_id}")).to have_been_made
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
15
|
+
it 'should return a UnclaimedDraft' do
|
16
16
|
expect(@embedded).to be_an HelloSign::Resource::Embedded
|
17
17
|
end
|
18
18
|
end
|
@@ -1,28 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe HelloSign::Api::Account do
|
4
|
-
|
5
|
-
|
6
|
-
context "when successful request" do
|
4
|
+
describe '#get_oauth_token' do
|
5
|
+
context 'when successful request' do
|
7
6
|
before do
|
8
|
-
stub_post_oauth(
|
7
|
+
stub_post_oauth('/oauth/token', 'token')
|
9
8
|
@oauth_info = HelloSign.get_oauth_token :state => 'state', :code => 'code'
|
10
9
|
end
|
11
10
|
|
12
|
-
it
|
13
|
-
expect(a_post_oauth(
|
11
|
+
it 'should get the correct resource' do
|
12
|
+
expect(a_post_oauth('/oauth/token')).to have_been_made
|
14
13
|
end
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
|
-
describe
|
17
|
+
describe '#refresh_oauth_token' do
|
19
18
|
before do
|
20
|
-
stub_post_oauth(
|
19
|
+
stub_post_oauth('/oauth/token', 'token')
|
21
20
|
@oauth_info = HelloSign.refresh_oauth_token 'oauth_token'
|
22
21
|
end
|
23
22
|
|
24
|
-
it
|
25
|
-
expect(a_post_oauth(
|
23
|
+
it 'should get the correct resource' do
|
24
|
+
expect(a_post_oauth('/oauth/token')).to have_been_made
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
@@ -1,126 +1,125 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe HelloSign::Api::SignatureRequest do
|
4
|
-
describe
|
4
|
+
describe '#get_signature_request' do
|
5
5
|
before do
|
6
|
-
stub_get(
|
6
|
+
stub_get('/signature_request/1', 'signature_request')
|
7
7
|
@signature_request = HelloSign.get_signature_request :signature_request_id => 1
|
8
8
|
end
|
9
9
|
|
10
|
-
it
|
11
|
-
expect(a_get(
|
10
|
+
it 'should get the correct resource' do
|
11
|
+
expect(a_get('/signature_request/1')).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
14
|
+
it 'should return a SignatureRequest' do
|
15
15
|
expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
describe
|
19
|
+
describe '#get_signature_requests' do
|
20
20
|
before do
|
21
|
-
stub_get(
|
21
|
+
stub_get('/signature_request/list', 'signature_requests')
|
22
22
|
@signature_requests = HelloSign.get_signature_requests({})
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
26
|
-
expect(a_get(
|
25
|
+
it 'should get the correct resource' do
|
26
|
+
expect(a_get('/signature_request/list')).to have_been_made
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
29
|
+
it 'should return a SignatureRequestArray' do
|
30
30
|
expect(@signature_requests).to be_an HelloSign::Resource::ResourceArray
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
33
|
+
it 'each of Array is an SignatureRequest' do
|
34
34
|
expect(@signature_requests[0]).to be_an HelloSign::Resource::SignatureRequest
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe
|
38
|
+
describe '#send_signature_request' do
|
39
39
|
before do
|
40
|
-
stub_post(
|
40
|
+
stub_post('/signature_request/send', 'signature_request')
|
41
41
|
@signature_request = HelloSign.send_signature_request(
|
42
|
-
:files_url => [
|
43
|
-
:signers => [
|
42
|
+
:files_url => ['http://hellosign.com/test.pdf'],
|
43
|
+
:signers => ['sss']
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
48
|
-
expect(a_post(
|
47
|
+
it 'should get the correct resource' do
|
48
|
+
expect(a_post('/signature_request/send')).to have_been_made
|
49
49
|
end
|
50
50
|
|
51
|
-
it
|
51
|
+
it 'should return a SignatureRequest' do
|
52
52
|
expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
describe
|
56
|
+
describe '#remind_signature_request' do
|
57
57
|
before do
|
58
|
-
stub_post(
|
58
|
+
stub_post('/signature_request/remind/1', 'signature_request')
|
59
59
|
@signature_request = HelloSign.remind_signature_request(:signature_request_id => 1)
|
60
60
|
end
|
61
61
|
|
62
|
-
it
|
63
|
-
expect(a_post(
|
62
|
+
it 'should get the correct resource' do
|
63
|
+
expect(a_post('/signature_request/remind/1')).to have_been_made
|
64
64
|
end
|
65
65
|
|
66
|
-
it
|
66
|
+
it 'should return a SignatureRequest' do
|
67
67
|
expect(@signature_request).to be_an HelloSign::Resource::SignatureRequest
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
describe
|
71
|
+
describe '#cancel_signature_request' do
|
72
72
|
before do
|
73
|
-
stub_post(
|
73
|
+
stub_post('/signature_request/cancel/1', 'signature_request')
|
74
74
|
@signature_request = HelloSign.cancel_signature_request(:signature_request_id => 1)
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
78
|
-
expect(a_post(
|
77
|
+
it 'should get the correct resource' do
|
78
|
+
expect(a_post('/signature_request/cancel/1')).to have_been_made
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
describe
|
82
|
+
describe '#signature_request_files' do
|
83
83
|
before do
|
84
|
-
stub_get(
|
84
|
+
stub_get('/signature_request/files/1', 'file')
|
85
85
|
@files = HelloSign.signature_request_files(:signature_request_id => 1)
|
86
86
|
end
|
87
87
|
|
88
|
-
it
|
89
|
-
expect(a_get(
|
88
|
+
it 'should get the correct resource' do
|
89
|
+
expect(a_get('/signature_request/files/1')).to have_been_made
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
|
94
|
-
describe "#send_signature_request_with_template" do
|
93
|
+
describe '#send_signature_request_with_template' do
|
95
94
|
before do
|
96
|
-
stub_post(
|
95
|
+
stub_post('/signature_request/send_with_template', 'signature_request')
|
97
96
|
@signature_request = HelloSign.send_signature_request_with_template({})
|
98
97
|
end
|
99
98
|
|
100
|
-
it
|
101
|
-
expect(a_post(
|
99
|
+
it 'should get the correct resource' do
|
100
|
+
expect(a_post('/signature_request/send_with_template')).to have_been_made
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
105
|
-
describe
|
104
|
+
describe '#create_embedded_signature_request' do
|
106
105
|
before do
|
107
|
-
stub_post(
|
106
|
+
stub_post('/signature_request/create_embedded', 'signature_request')
|
108
107
|
@signature_request = HelloSign.create_embedded_signature_request({})
|
109
108
|
end
|
110
109
|
|
111
|
-
it
|
112
|
-
expect(a_post(
|
110
|
+
it 'should get the correct resource' do
|
111
|
+
expect(a_post('/signature_request/create_embedded')).to have_been_made
|
113
112
|
end
|
114
113
|
end
|
115
114
|
|
116
|
-
describe
|
115
|
+
describe '#create_embedded_signature_request_with_template' do
|
117
116
|
before do
|
118
|
-
stub_post(
|
117
|
+
stub_post('/signature_request/create_embedded_with_template', 'signature_request')
|
119
118
|
@signature_request = HelloSign.create_embedded_signature_request_with_template({})
|
120
119
|
end
|
121
120
|
|
122
|
-
it
|
123
|
-
expect(a_post(
|
121
|
+
it 'should get the correct resource' do
|
122
|
+
expect(a_post('/signature_request/create_embedded_with_template')).to have_been_made
|
124
123
|
end
|
125
124
|
end
|
126
125
|
end
|
@@ -1,94 +1,92 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe HelloSign::Api::Team do
|
4
|
-
describe
|
4
|
+
describe '#get_team' do
|
5
5
|
before do
|
6
|
-
stub_get(
|
6
|
+
stub_get('/team', 'team')
|
7
7
|
@team = HelloSign.get_team
|
8
8
|
end
|
9
9
|
|
10
|
-
it
|
11
|
-
expect(a_get(
|
10
|
+
it 'should get the correct resource' do
|
11
|
+
expect(a_get('/team')).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
14
|
+
it 'should return user\'s team' do
|
15
15
|
expect(@team).to be_an HelloSign::Resource::Team
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
describe "#create_team" do
|
19
|
+
describe '#create_team' do
|
22
20
|
before do
|
23
|
-
stub_post(
|
24
|
-
@team = HelloSign.create_team :name =>
|
21
|
+
stub_post('/team/create', 'team')
|
22
|
+
@team = HelloSign.create_team :name => 'Team HelloSign'
|
25
23
|
end
|
26
24
|
|
27
|
-
it
|
28
|
-
expect(a_post(
|
25
|
+
it 'should get the correct resource' do
|
26
|
+
expect(a_post('/team/create')).to have_been_made
|
29
27
|
end
|
30
28
|
|
31
|
-
it
|
32
|
-
expect(@team.name).to eql(
|
29
|
+
it 'should return information about a created team' do
|
30
|
+
expect(@team.name).to eql('Team HelloSign')
|
33
31
|
end
|
34
32
|
end
|
35
33
|
|
36
|
-
describe
|
34
|
+
describe '#update_team' do
|
37
35
|
before do
|
38
|
-
stub_post(
|
39
|
-
@team = HelloSign.update_team :name =>
|
36
|
+
stub_post('/team', 'team')
|
37
|
+
@team = HelloSign.update_team :name => 'Team HelloSign'
|
40
38
|
end
|
41
39
|
|
42
|
-
it
|
43
|
-
expect(a_post(
|
40
|
+
it 'should get the correct resource' do
|
41
|
+
expect(a_post('/team')).to have_been_made
|
44
42
|
end
|
45
43
|
|
46
|
-
it
|
47
|
-
expect(@team.name).to eql(
|
44
|
+
it 'should return information about a updated team' do
|
45
|
+
expect(@team.name).to eql('Team HelloSign')
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
51
|
-
describe
|
49
|
+
describe '#destroy_team' do
|
52
50
|
before do
|
53
|
-
stub_post(
|
51
|
+
stub_post('/team/destroy', 'team')
|
54
52
|
@team = HelloSign.destroy_team
|
55
53
|
end
|
56
54
|
|
57
|
-
it
|
58
|
-
expect(a_post(
|
55
|
+
it 'should get the correct resource' do
|
56
|
+
expect(a_post('/team/destroy')).to have_been_made
|
59
57
|
end
|
60
58
|
end
|
61
59
|
|
62
|
-
describe
|
60
|
+
describe '#destroy_team' do
|
63
61
|
before do
|
64
|
-
stub_post(
|
62
|
+
stub_post('/team/destroy', 'team')
|
65
63
|
@team = HelloSign.destroy_team
|
66
64
|
end
|
67
65
|
|
68
|
-
it
|
69
|
-
expect(a_post(
|
66
|
+
it 'should get the correct resource' do
|
67
|
+
expect(a_post('/team/destroy')).to have_been_made
|
70
68
|
end
|
71
69
|
end
|
72
70
|
|
73
|
-
describe
|
71
|
+
describe '#add_member_to_team' do
|
74
72
|
before do
|
75
|
-
stub_post(
|
76
|
-
@team = HelloSign.add_member_to_team :email_address =>
|
73
|
+
stub_post('/team/add_member', 'team')
|
74
|
+
@team = HelloSign.add_member_to_team :email_address => 'george@example.com'
|
77
75
|
end
|
78
76
|
|
79
|
-
it
|
80
|
-
expect(a_post(
|
77
|
+
it 'should get the correct resource' do
|
78
|
+
expect(a_post('/team/add_member')).to have_been_made
|
81
79
|
end
|
82
80
|
end
|
83
81
|
|
84
|
-
describe
|
82
|
+
describe '#remove_member_from_team' do
|
85
83
|
before do
|
86
|
-
stub_post(
|
87
|
-
@team = HelloSign.remove_member_from_team :email_address =>
|
84
|
+
stub_post('/team/remove_member', 'team')
|
85
|
+
@team = HelloSign.remove_member_from_team :email_address => 'george@example.com'
|
88
86
|
end
|
89
87
|
|
90
|
-
it
|
91
|
-
expect(a_post(
|
88
|
+
it 'should get the correct resource' do
|
89
|
+
expect(a_post('/team/remove_member')).to have_been_made
|
92
90
|
end
|
93
91
|
end
|
94
92
|
end
|
@@ -1,66 +1,66 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe HelloSign::Api::Template do
|
4
|
-
describe
|
4
|
+
describe '#get_template' do
|
5
5
|
before do
|
6
|
-
stub_get(
|
6
|
+
stub_get('/template/1', 'template')
|
7
7
|
@template = HelloSign.get_template :template_id => 1
|
8
8
|
end
|
9
9
|
|
10
|
-
it
|
11
|
-
expect(a_get(
|
10
|
+
it 'should get the correct resource' do
|
11
|
+
expect(a_get('/template/1')).to have_been_made
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
14
|
+
it 'should return a Template' do
|
15
15
|
expect(@template).to be_an HelloSign::Resource::Template
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
describe
|
19
|
+
describe '#get_templates' do
|
20
20
|
before do
|
21
|
-
stub_get(
|
21
|
+
stub_get('/template/list', 'templates')
|
22
22
|
@template = HelloSign.get_templates({})
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
26
|
-
expect(a_get(
|
25
|
+
it 'should get the correct resource' do
|
26
|
+
expect(a_get('/template/list')).to have_been_made
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
29
|
+
it 'should return a ResourceArray' do
|
30
30
|
expect(@template).to be_an HelloSign::Resource::ResourceArray
|
31
31
|
end
|
32
32
|
|
33
|
-
it
|
33
|
+
it 'each of Array is an Template' do
|
34
34
|
expect(@template[0]).to be_an HelloSign::Resource::Template
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
describe
|
38
|
+
describe '#add_user_to_template' do
|
39
39
|
before do
|
40
|
-
stub_post(
|
40
|
+
stub_post('/template/add_user/1', 'template')
|
41
41
|
@template = HelloSign.add_user_to_template :template_id => 1
|
42
42
|
end
|
43
43
|
|
44
|
-
it
|
45
|
-
expect(a_post(
|
44
|
+
it 'should get the correct resource' do
|
45
|
+
expect(a_post('/template/add_user/1')).to have_been_made
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
48
|
+
it 'should return a Template' do
|
49
49
|
expect(@template).to be_an HelloSign::Resource::Template
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
describe
|
53
|
+
describe '#remove_user_from_template' do
|
54
54
|
before do
|
55
|
-
stub_post(
|
55
|
+
stub_post('/template/remove_user/1', 'template')
|
56
56
|
@template = HelloSign.remove_user_from_template :template_id => 1
|
57
57
|
end
|
58
58
|
|
59
|
-
it
|
60
|
-
expect(a_post(
|
59
|
+
it 'should get the correct resource' do
|
60
|
+
expect(a_post('/template/remove_user/1')).to have_been_made
|
61
61
|
end
|
62
62
|
|
63
|
-
it
|
63
|
+
it 'should return a Template' do
|
64
64
|
expect(@template).to be_an HelloSign::Resource::Template
|
65
65
|
end
|
66
66
|
end
|