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,33 +1,33 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe HelloSign::Api::UnclaimedDraft do
|
4
|
-
describe
|
5
|
-
context
|
4
|
+
describe '#create_unclaimed_draft' do
|
5
|
+
context 'send_document' do
|
6
6
|
before do
|
7
|
-
stub_post(
|
8
|
-
@unclaimed_draft = HelloSign.create_unclaimed_draft({:type => 'send_document'})
|
7
|
+
stub_post('/unclaimed_draft/create', 'unclaimed_draft')
|
8
|
+
@unclaimed_draft = HelloSign.create_unclaimed_draft({ :type => 'send_document' })
|
9
9
|
end
|
10
10
|
|
11
|
-
it
|
12
|
-
expect(a_post(
|
11
|
+
it 'should get the correct resource' do
|
12
|
+
expect(a_post('/unclaimed_draft/create')).to have_been_made
|
13
13
|
end
|
14
14
|
|
15
|
-
it
|
15
|
+
it 'should return a UnclaimedDraft' do
|
16
16
|
expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
context
|
20
|
+
context 'request_signature' do
|
21
21
|
before do
|
22
|
-
stub_post(
|
23
|
-
@unclaimed_draft = HelloSign.create_unclaimed_draft({:type => 'request_signature'})
|
22
|
+
stub_post('/unclaimed_draft/create', 'unclaimed_draft')
|
23
|
+
@unclaimed_draft = HelloSign.create_unclaimed_draft({ :type => 'request_signature' })
|
24
24
|
end
|
25
25
|
|
26
|
-
it
|
27
|
-
expect(a_post(
|
26
|
+
it 'should get the correct resource' do
|
27
|
+
expect(a_post('/unclaimed_draft/create')).to have_been_made
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
30
|
+
it 'should return a UnclaimedDraft' do
|
31
31
|
expect(@unclaimed_draft).to be_an HelloSign::Resource::UnclaimedDraft
|
32
32
|
end
|
33
33
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe HelloSign::Client do
|
4
|
-
describe
|
5
|
-
context
|
6
|
-
subject(:client){HelloSign::Client.new}
|
4
|
+
describe '#initialize' do
|
5
|
+
context 'with default values' do
|
6
|
+
subject(:client) { HelloSign::Client.new }
|
7
7
|
HelloSign::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
8
8
|
it "should set #{key}" do
|
9
9
|
expect(client.send(key)).to eql(HelloSign.send(key))
|
@@ -11,24 +11,24 @@ describe HelloSign::Client do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
context
|
14
|
+
context 'with custom values' do
|
15
15
|
let(:custom_client){
|
16
16
|
{
|
17
|
-
:email_address =>
|
18
|
-
:password =>
|
19
|
-
:api_key =>
|
20
|
-
:user_agent =>
|
21
|
-
:end_point =>
|
22
|
-
:oauth_end_point =>
|
23
|
-
:api_version =>
|
24
|
-
:client_id =>
|
25
|
-
:client_secret =>
|
26
|
-
:auth_token =>
|
17
|
+
:email_address => 'email_address',
|
18
|
+
:password => 'password',
|
19
|
+
:api_key => 'api_key',
|
20
|
+
:user_agent => 'user_agent',
|
21
|
+
:end_point => 'end_point',
|
22
|
+
:oauth_end_point => 'oauth_end_point',
|
23
|
+
:api_version => 'api_version',
|
24
|
+
:client_id => 'client_id',
|
25
|
+
:client_secret => 'client_secret',
|
26
|
+
:auth_token => 'auth_token',
|
27
27
|
:log_level => 5,
|
28
28
|
:logging => false
|
29
29
|
}
|
30
30
|
}
|
31
|
-
subject(:client){ HelloSign::Client.new custom_client}
|
31
|
+
subject(:client) { HelloSign::Client.new custom_client }
|
32
32
|
HelloSign::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
33
33
|
it "should set #{key}" do
|
34
34
|
expect(client.send(key)).to eql(custom_client[key])
|
@@ -37,19 +37,18 @@ describe HelloSign::Client do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
describe
|
41
|
-
context
|
40
|
+
describe '#request' do
|
41
|
+
context 'when response status >= 400' do
|
42
42
|
HelloSign::Client::ERRORS.keys.each do |key|
|
43
43
|
it "raise #{HelloSign::Client::ERRORS[key].to_s} when response status #{key}" do
|
44
|
-
|
45
44
|
# raise when post
|
46
|
-
stub_post(
|
45
|
+
stub_post('/account/create', 'error', key)
|
47
46
|
expect {
|
48
|
-
HelloSign.create_account :email_address =>
|
47
|
+
HelloSign.create_account :email_address => 'test@example.com', :password => 'password'
|
49
48
|
}.to raise_error(HelloSign::Client::ERRORS[key])
|
50
49
|
|
51
50
|
# raise when get
|
52
|
-
stub_get(
|
51
|
+
stub_get('/account', 'error', key)
|
53
52
|
expect {
|
54
53
|
HelloSign.get_account
|
55
54
|
}.to raise_error(HelloSign::Client::ERRORS[key])
|
@@ -58,73 +57,73 @@ describe HelloSign::Client do
|
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
61
|
-
describe
|
62
|
-
context
|
63
|
-
describe
|
60
|
+
describe 'prepare' do
|
61
|
+
context 'signers' do
|
62
|
+
describe 'is an array' do
|
64
63
|
before do
|
65
|
-
stub_post(
|
64
|
+
stub_post('/signature_request/send', 'signature_request')
|
66
65
|
end
|
67
66
|
|
68
|
-
it
|
69
|
-
expect(lambda{HelloSign.send_signature_request(
|
70
|
-
:files_url => [
|
71
|
-
:signers => [
|
72
|
-
)}).not_to raise_error
|
67
|
+
it 'work correctly' do
|
68
|
+
expect(lambda{ HelloSign.send_signature_request(
|
69
|
+
:files_url => ['http://hellosign.com/test.pdf'],
|
70
|
+
:signers => ['sss']
|
71
|
+
) }).not_to raise_error
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
76
|
-
describe
|
75
|
+
describe 'is an Hash' do
|
77
76
|
before do
|
78
|
-
stub_post(
|
77
|
+
stub_post('/signature_request/send', 'signature_request')
|
79
78
|
end
|
80
79
|
|
81
|
-
it
|
82
|
-
expect(lambda{HelloSign.send_signature_request(
|
83
|
-
:files_url => [
|
80
|
+
it 'work correctly' do
|
81
|
+
expect(lambda{ HelloSign.send_signature_request(
|
82
|
+
:files_url => ['http://hellosign.com/test.pdf'],
|
84
83
|
:signers => [{
|
85
84
|
:email_address => 'jack@example.com',
|
86
85
|
:name => 'Jack',
|
87
86
|
:order => 0
|
88
|
-
},{
|
87
|
+
}, {
|
89
88
|
:email_address => 'jill@example.com',
|
90
89
|
:name => 'Jill',
|
91
90
|
:order => 1
|
92
91
|
}]
|
93
|
-
)}).not_to raise_error
|
92
|
+
) }).not_to raise_error
|
94
93
|
end
|
95
94
|
end
|
96
95
|
end
|
97
96
|
|
98
|
-
context
|
99
|
-
describe
|
97
|
+
context 'ccs' do
|
98
|
+
describe 'is an array' do
|
100
99
|
before do
|
101
|
-
stub_post(
|
100
|
+
stub_post('/signature_request/send_with_template', 'signature_request')
|
102
101
|
end
|
103
102
|
|
104
|
-
it
|
105
|
-
expect(lambda{HelloSign.send_signature_request_with_template(
|
106
|
-
:ccs => [
|
107
|
-
)}).not_to raise_error
|
103
|
+
it 'work correctly' do
|
104
|
+
expect(lambda{ HelloSign.send_signature_request_with_template(
|
105
|
+
:ccs => ['sss']
|
106
|
+
) }).not_to raise_error
|
108
107
|
end
|
109
108
|
end
|
110
109
|
|
111
|
-
describe
|
110
|
+
describe 'is an Hash' do
|
112
111
|
before do
|
113
|
-
stub_post(
|
112
|
+
stub_post('/signature_request/send_with_template', 'signature_request')
|
114
113
|
end
|
115
114
|
|
116
|
-
it
|
117
|
-
expect(lambda{HelloSign.send_signature_request_with_template(
|
115
|
+
it 'work correctly' do
|
116
|
+
expect(lambda{ HelloSign.send_signature_request_with_template(
|
118
117
|
:ccs => [{
|
119
118
|
:email_address => 'jack@example.com',
|
120
119
|
:name => 'Jack',
|
121
120
|
:role => 'Manager'
|
122
|
-
},{
|
121
|
+
}, {
|
123
122
|
:email_address => 'jill@example.com',
|
124
123
|
:name => 'Jill',
|
125
|
-
:role =>
|
124
|
+
:role => 'Client'
|
126
125
|
}]
|
127
|
-
)}).not_to raise_error
|
126
|
+
) }).not_to raise_error
|
128
127
|
end
|
129
128
|
end
|
130
129
|
end
|
@@ -1,20 +1,22 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe HelloSign::Resource::BaseResource do
|
4
|
-
let(:data){
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
}}
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
let(:data){
|
5
|
+
{
|
6
|
+
:a => :a1,
|
7
|
+
:b => :b1,
|
8
|
+
:c => { :c1 => :c2 },
|
9
|
+
:d => [:d1, :d2, :d3],
|
10
|
+
:e => [{ :e1 => :e11 }, { :e2 => :e21 }, { :e3 => :e31 }]
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
describe 'methods' do
|
15
|
+
subject(:resource) { HelloSign::Resource::BaseResource.new data }
|
14
16
|
|
15
17
|
it 'can access attributes by calling method with the same name' do
|
16
18
|
data.keys.each do |key|
|
17
|
-
expect(resource.send key).not_to
|
19
|
+
expect(resource.send key).not_to be_nil
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -32,17 +34,17 @@ describe HelloSign::Resource::BaseResource do
|
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
35
|
-
describe
|
37
|
+
describe '#initialize' do
|
36
38
|
context 'without key params' do
|
37
|
-
subject(:resource) {HelloSign::Resource::BaseResource.new data }
|
38
|
-
it
|
39
|
+
subject(:resource) { HelloSign::Resource::BaseResource.new data }
|
40
|
+
it 'have correct data' do
|
39
41
|
expect(resource.data).to eql(data)
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
43
45
|
context 'without key params' do
|
44
|
-
subject(:resource) {HelloSign::Resource::BaseResource.new data, :e }
|
45
|
-
it
|
46
|
+
subject(:resource) { HelloSign::Resource::BaseResource.new data, :e }
|
47
|
+
it 'have correct data' do
|
46
48
|
expect(resource.data).to eql(data[:e])
|
47
49
|
end
|
48
50
|
end
|
data/spec/hello_sign_spec.rb
CHANGED
@@ -3,13 +3,13 @@ require 'spec_helper'
|
|
3
3
|
describe HelloSign do
|
4
4
|
after { HelloSign.reset }
|
5
5
|
|
6
|
-
describe
|
7
|
-
it
|
6
|
+
describe '.client' do
|
7
|
+
it 'should be a HelloSign::Client' do
|
8
8
|
expect(HelloSign.client).to be_a(HelloSign::Client)
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe
|
12
|
+
describe '.configure' do
|
13
13
|
HelloSign::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
14
14
|
it "should set #{key}" do
|
15
15
|
HelloSign.configure do |config|
|
@@ -20,15 +20,15 @@ describe HelloSign do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
describe
|
24
|
-
it
|
23
|
+
describe '.user_agent=' do
|
24
|
+
it 'should set user_agent' do
|
25
25
|
HelloSign.user_agent = 'Custom User Agent'
|
26
26
|
expect(HelloSign.user_agent).to eql('Custom User Agent')
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
describe
|
31
|
-
it
|
30
|
+
describe '.user_agent' do
|
31
|
+
it 'should return default user_agent' do
|
32
32
|
expect(HelloSign.user_agent).to eql(HelloSign::Configuration::DEFAULT_USER_AGENT)
|
33
33
|
end
|
34
34
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hellosign-ruby-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project:
|
190
|
-
rubygems_version: 1.8.23
|
190
|
+
rubygems_version: 1.8.23.2
|
191
191
|
signing_key:
|
192
192
|
specification_version: 3
|
193
193
|
summary: A Ruby SDK for the HelloSign API.
|