hello_sign 0.6.0 → 1.0.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.
- data/lib/hello_sign/client.rb +2 -2
- data/lib/hello_sign/parameters/reusable_form_signature_request.rb +9 -9
- data/lib/hello_sign/parameters/signature_request.rb +15 -15
- data/lib/hello_sign/parameters/unclaimed_draft.rb +7 -7
- data/lib/hello_sign/proxy/account.rb +1 -1
- data/lib/hello_sign/proxy/reusable_form.rb +10 -9
- data/lib/hello_sign/proxy/settings.rb +1 -1
- data/lib/hello_sign/proxy/signature_request.rb +13 -12
- data/lib/hello_sign/proxy/team.rb +4 -4
- data/lib/hello_sign/proxy/unclaimed_draft.rb +1 -1
- data/lib/hello_sign/proxy.rb +4 -4
- data/lib/hello_sign/upload_io.rb +56 -0
- data/lib/hello_sign/version.rb +1 -1
- data/lib/hello_sign.rb +1 -1
- data/spec/helper.rb +0 -2
- data/spec/integration/account_spec.rb +4 -4
- data/spec/integration/hello_sign_spec.rb +2 -2
- data/spec/integration/helper.rb +6 -1
- data/spec/integration/reusable_form_spec.rb +16 -20
- data/spec/integration/signature_request_spec.rb +52 -57
- data/spec/integration/team_spec.rb +8 -8
- data/spec/integration/unclaimed_draft_spec.rb +3 -3
- data/spec/shared_examples/proxy.rb +15 -5
- data/spec/unit/client_spec.rb +3 -3
- data/spec/unit/middleware/raise_error_spec.rb +1 -1
- data/spec/unit/parameters/reusable_form_signature_request_spec.rb +17 -17
- data/spec/unit/parameters/signature_request_spec.rb +25 -20
- data/spec/unit/parameters/unclaimed_draft_spec.rb +12 -11
- data/spec/unit/proxy/account_spec.rb +6 -6
- data/spec/unit/proxy/reusable_form_spec.rb +13 -12
- data/spec/unit/proxy/settings_spec.rb +3 -3
- data/spec/unit/proxy/signature_request_spec.rb +29 -32
- data/spec/unit/proxy/team_spec.rb +12 -12
- data/spec/unit/proxy/unclaimed_draft_spec.rb +1 -1
- data/spec/unit/upload_io_spec.rb +60 -0
- metadata +19 -15
@@ -5,9 +5,15 @@ describe HelloSign::Proxy::SignatureRequest do
|
|
5
5
|
let(:client) { double('client') }
|
6
6
|
let(:request_id) { 'request_id' }
|
7
7
|
let(:api_response) { double('API response') }
|
8
|
-
subject(:sr_proxy) { HelloSign::Proxy::SignatureRequest.new(client) }
|
8
|
+
subject(:sr_proxy) { HelloSign::Proxy::SignatureRequest.new(client, request_id) }
|
9
9
|
|
10
|
-
|
10
|
+
before do
|
11
|
+
client.stub(:get).and_return(api_response)
|
12
|
+
client.stub(:post).and_return(api_response)
|
13
|
+
end
|
14
|
+
|
15
|
+
its(:client) { should eq client }
|
16
|
+
its(:request_id) { should eq request_id }
|
11
17
|
|
12
18
|
describe "#deliver" do
|
13
19
|
let(:formatted_request_body) { double('formatted request body') }
|
@@ -17,8 +23,6 @@ describe HelloSign::Proxy::SignatureRequest do
|
|
17
23
|
request_parameters.stub(:foo=)
|
18
24
|
request_parameters.stub(:formatted).and_return(formatted_request_body)
|
19
25
|
sr_proxy.request_parameters = request_parameters
|
20
|
-
|
21
|
-
client.stub(:post).and_return(api_response)
|
22
26
|
end
|
23
27
|
|
24
28
|
it "yields the request parameters to the block" do
|
@@ -28,7 +32,7 @@ describe HelloSign::Proxy::SignatureRequest do
|
|
28
32
|
|
29
33
|
it "sends a signature request" do
|
30
34
|
client.should_receive(:post)
|
31
|
-
.with('/signature_request/send', :
|
35
|
+
.with('/signature_request/send', body: formatted_request_body)
|
32
36
|
sr_proxy.deliver { |params| params.foo = 'bar' }
|
33
37
|
end
|
34
38
|
|
@@ -44,31 +48,29 @@ describe HelloSign::Proxy::SignatureRequest do
|
|
44
48
|
|
45
49
|
it "sets the reusable form ID in the request parameters" do
|
46
50
|
request_parameters.should_receive(:reusable_form_id=).with('form_id')
|
47
|
-
sr_proxy.deliver(:
|
51
|
+
sr_proxy.deliver(form: 'form_id') {}
|
48
52
|
end
|
49
53
|
|
50
54
|
it "sends a reusable form signature request" do
|
51
55
|
client.should_receive(:post)
|
52
|
-
.with('/signature_request/send_with_reusable_form', :
|
53
|
-
sr_proxy.deliver(:
|
56
|
+
.with('/signature_request/send_with_reusable_form', body: formatted_request_body)
|
57
|
+
sr_proxy.deliver(form: 'form_id') {}
|
54
58
|
end
|
55
59
|
|
56
60
|
it "returns the response" do
|
57
|
-
expect(sr_proxy.deliver(:
|
61
|
+
expect(sr_proxy.deliver(form: 'form_id') {}).to eq api_response
|
58
62
|
end
|
59
63
|
end
|
60
64
|
end
|
61
65
|
|
62
66
|
describe "#status" do
|
63
67
|
it "fetches the signature request status" do
|
64
|
-
client.should_receive(:get)
|
65
|
-
|
66
|
-
sr_proxy.status(request_id)
|
68
|
+
client.should_receive(:get).with("/signature_request/#{request_id}")
|
69
|
+
sr_proxy.status
|
67
70
|
end
|
68
71
|
|
69
72
|
it "returns the response" do
|
70
|
-
|
71
|
-
expect(sr_proxy.status(request_id)).to eq api_response
|
73
|
+
expect(sr_proxy.status).to eq api_response
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
@@ -76,7 +78,7 @@ describe HelloSign::Proxy::SignatureRequest do
|
|
76
78
|
context "when called without a page number" do
|
77
79
|
it "fetches the first page of signature requests" do
|
78
80
|
client.should_receive(:get)
|
79
|
-
.with('/signature_request/list', :
|
81
|
+
.with('/signature_request/list', params: {page: 1})
|
80
82
|
sr_proxy.list
|
81
83
|
end
|
82
84
|
|
@@ -89,13 +91,13 @@ describe HelloSign::Proxy::SignatureRequest do
|
|
89
91
|
context "when called with a page number" do
|
90
92
|
it "fetches a list of signature requests from the specified page" do
|
91
93
|
client.should_receive(:get)
|
92
|
-
.with('/signature_request/list', :
|
93
|
-
sr_proxy.list(:
|
94
|
+
.with('/signature_request/list', params: {page: 10})
|
95
|
+
sr_proxy.list(page: 10)
|
94
96
|
end
|
95
97
|
|
96
98
|
it "returns the response" do
|
97
99
|
client.stub(:get).and_return(api_response)
|
98
|
-
expect(sr_proxy.list(:
|
100
|
+
expect(sr_proxy.list(page: 10)).to eq api_response
|
99
101
|
end
|
100
102
|
end
|
101
103
|
end
|
@@ -105,39 +107,34 @@ describe HelloSign::Proxy::SignatureRequest do
|
|
105
107
|
|
106
108
|
it "sends a signature request reminder" do
|
107
109
|
client.should_receive(:post)
|
108
|
-
.with(
|
109
|
-
sr_proxy.remind(
|
110
|
+
.with("/signature_request/remind/#{request_id}", body: {email_address: email})
|
111
|
+
sr_proxy.remind(email: email)
|
110
112
|
end
|
111
113
|
|
112
114
|
it "returns the response" do
|
113
|
-
|
114
|
-
expect(sr_proxy.remind(request_id, :email => email)).to eq api_response
|
115
|
+
expect(sr_proxy.remind(email: email)).to eq api_response
|
115
116
|
end
|
116
117
|
end
|
117
118
|
|
118
119
|
describe "#cancel" do
|
119
120
|
it "cancels a signature request" do
|
120
|
-
client.should_receive(:post)
|
121
|
-
|
122
|
-
sr_proxy.cancel(request_id)
|
121
|
+
client.should_receive(:post).with("/signature_request/cancel/#{request_id}")
|
122
|
+
sr_proxy.cancel
|
123
123
|
end
|
124
124
|
|
125
125
|
it "returns the response" do
|
126
|
-
|
127
|
-
expect(sr_proxy.cancel(request_id)).to eq api_response
|
126
|
+
expect(sr_proxy.cancel).to eq api_response
|
128
127
|
end
|
129
128
|
end
|
130
129
|
|
131
130
|
describe "#final_copy" do
|
132
131
|
it "fetches a final copy of the signature request" do
|
133
|
-
client.should_receive(:get)
|
134
|
-
|
135
|
-
sr_proxy.final_copy(request_id)
|
132
|
+
client.should_receive(:get).with("/signature_request/final_copy/#{request_id}")
|
133
|
+
sr_proxy.final_copy
|
136
134
|
end
|
137
135
|
|
138
136
|
it "returns the response" do
|
139
|
-
|
140
|
-
expect(sr_proxy.final_copy(request_id)).to eq api_response
|
137
|
+
expect(sr_proxy.final_copy).to eq api_response
|
141
138
|
end
|
142
139
|
end
|
143
140
|
end
|
@@ -18,12 +18,12 @@ describe HelloSign::Proxy::Team do
|
|
18
18
|
let(:name) { 'The Browncoats' }
|
19
19
|
|
20
20
|
it "sends a request to create a team" do
|
21
|
-
client.should_receive(:post).with('/team/create', :
|
22
|
-
team_proxy.create(:
|
21
|
+
client.should_receive(:post).with('/team/create', body: {name: name})
|
22
|
+
team_proxy.create(name: name)
|
23
23
|
end
|
24
24
|
|
25
25
|
it "returns the API response" do
|
26
|
-
expect(team_proxy.create(:
|
26
|
+
expect(team_proxy.create(name: name)).to eq api_response
|
27
27
|
end
|
28
28
|
|
29
29
|
end
|
@@ -46,12 +46,12 @@ describe HelloSign::Proxy::Team do
|
|
46
46
|
let(:new_name) { 'The Bluecoats' }
|
47
47
|
|
48
48
|
it "sends a request to update the team information" do
|
49
|
-
client.should_receive(:post).with('/team', :
|
50
|
-
team_proxy.update(:
|
49
|
+
client.should_receive(:post).with('/team', body: {name: new_name})
|
50
|
+
team_proxy.update(name: new_name)
|
51
51
|
end
|
52
52
|
|
53
53
|
it "returns the API response" do
|
54
|
-
expect(team_proxy.update(:
|
54
|
+
expect(team_proxy.update(name: new_name)).to eq api_response
|
55
55
|
end
|
56
56
|
|
57
57
|
end
|
@@ -74,12 +74,12 @@ describe HelloSign::Proxy::Team do
|
|
74
74
|
let(:email_address) { 'john@johnson.com' }
|
75
75
|
|
76
76
|
it "sends a request to add the member to the team" do
|
77
|
-
client.should_receive(:post).with('/team/add_member', :
|
78
|
-
team_proxy.add_member(:
|
77
|
+
client.should_receive(:post).with('/team/add_member', body: {email_address: email_address})
|
78
|
+
team_proxy.add_member(email_address: email_address)
|
79
79
|
end
|
80
80
|
|
81
81
|
it "returns the API response" do
|
82
|
-
expect(team_proxy.add_member(:
|
82
|
+
expect(team_proxy.add_member(email_address: email_address)).to eq api_response
|
83
83
|
end
|
84
84
|
|
85
85
|
end
|
@@ -89,12 +89,12 @@ describe HelloSign::Proxy::Team do
|
|
89
89
|
let(:email_address) { 'john@johnson.com' }
|
90
90
|
|
91
91
|
it "sends a request to remove the member from the team" do
|
92
|
-
client.should_receive(:post).with('/team/remove_member', :
|
93
|
-
team_proxy.remove_member(:
|
92
|
+
client.should_receive(:post).with('/team/remove_member', body: {email_address: email_address})
|
93
|
+
team_proxy.remove_member(email_address: email_address)
|
94
94
|
end
|
95
95
|
|
96
96
|
it "returns the API response" do
|
97
|
-
expect(team_proxy.remove_member(:
|
97
|
+
expect(team_proxy.remove_member(email_address: email_address)).to eq api_response
|
98
98
|
end
|
99
99
|
|
100
100
|
end
|
@@ -17,7 +17,7 @@ describe HelloSign::Proxy::UnclaimedDraft do
|
|
17
17
|
draft_parameters.stub(:formatted).and_return(formatted_request_body)
|
18
18
|
draft_parameters.should_receive(:foo=).with('bar')
|
19
19
|
client.should_receive(:post)
|
20
|
-
.with('/unclaimed_draft/create', :
|
20
|
+
.with('/unclaimed_draft/create', body: formatted_request_body)
|
21
21
|
.and_return(api_response)
|
22
22
|
end
|
23
23
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'hello_sign/upload_io'
|
3
|
+
|
4
|
+
describe HelloSign::UploadIO do
|
5
|
+
let(:upload_file) { double('upload file') }
|
6
|
+
let(:io_object) { double('IO object') }
|
7
|
+
let(:file_converter_source) { double('file converter source') }
|
8
|
+
|
9
|
+
before { HelloSign::UploadIO.any_instance.stub(:file_converter_source).and_return(file_converter_source) }
|
10
|
+
|
11
|
+
it "returns the upload file" do
|
12
|
+
file_converter_source.stub(:new).and_return(upload_file)
|
13
|
+
|
14
|
+
expect(HelloSign::UploadIO.new(filename: 'test.txt').upload).to eq upload_file
|
15
|
+
end
|
16
|
+
|
17
|
+
context "#upload" do
|
18
|
+
specify do
|
19
|
+
file_converter_source.should_receive(:new).with('test.txt', 'text/plain')
|
20
|
+
|
21
|
+
HelloSign::UploadIO.new(filename: 'test.txt').upload
|
22
|
+
end
|
23
|
+
|
24
|
+
specify do
|
25
|
+
file_converter_source.should_receive(:new).with('test.foo', 'text/plain')
|
26
|
+
|
27
|
+
HelloSign::UploadIO.new(filename: 'test.foo').upload
|
28
|
+
end
|
29
|
+
|
30
|
+
specify do
|
31
|
+
file_converter_source.should_receive(:new).with('test.baz', 'fake/mime')
|
32
|
+
|
33
|
+
HelloSign::UploadIO.new(filename: 'test.baz', mime: 'fake/mime').upload
|
34
|
+
end
|
35
|
+
|
36
|
+
specify do
|
37
|
+
file_converter_source.should_receive(:new).with(io_object, 'text/plain')
|
38
|
+
|
39
|
+
HelloSign::UploadIO.new(io: io_object).upload
|
40
|
+
end
|
41
|
+
|
42
|
+
specify do
|
43
|
+
file_converter_source.should_receive(:new).with(io_object, 'fake/mime')
|
44
|
+
|
45
|
+
HelloSign::UploadIO.new(io: io_object, mime: 'fake/mime').upload
|
46
|
+
end
|
47
|
+
|
48
|
+
specify do
|
49
|
+
file_converter_source.should_receive(:new).with(io_object, 'fake/mime', 'test.foo')
|
50
|
+
|
51
|
+
HelloSign::UploadIO.new(filename: 'test.foo', io: io_object, mime: 'fake/mime').upload
|
52
|
+
end
|
53
|
+
|
54
|
+
specify do
|
55
|
+
file_converter_source.should_receive(:new).with(io_object, 'text/plain', 'test.foo')
|
56
|
+
|
57
|
+
HelloSign::UploadIO.new(filename: 'test.foo', io: io_object).upload
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hello_sign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
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: 2013-
|
12
|
+
date: 2013-03-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.8
|
21
|
+
version: '0.8'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.8
|
29
|
+
version: '0.8'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: faraday_middleware-multi_json
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.12
|
53
|
+
version: '2.12'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.12
|
61
|
+
version: '2.12'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: webmock
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.9
|
69
|
+
version: '1.9'
|
70
70
|
type: :development
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.9
|
77
|
+
version: '1.9'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: rake
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 10.0
|
85
|
+
version: '10.0'
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,15 +90,15 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 10.0
|
93
|
+
version: '10.0'
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
95
|
+
name: coveralls
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
101
|
+
version: '0.6'
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: '0.6'
|
110
110
|
description: A Ruby interface to the HelloSign API.
|
111
111
|
email:
|
112
112
|
- craiglttl@gmail.com
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- lib/hello_sign/proxy/team.rb
|
128
128
|
- lib/hello_sign/proxy/unclaimed_draft.rb
|
129
129
|
- lib/hello_sign/proxy.rb
|
130
|
+
- lib/hello_sign/upload_io.rb
|
130
131
|
- lib/hello_sign/version.rb
|
131
132
|
- lib/hello_sign.rb
|
132
133
|
- spec/fixtures/test.jpg
|
@@ -155,8 +156,10 @@ files:
|
|
155
156
|
- spec/unit/proxy/signature_request_spec.rb
|
156
157
|
- spec/unit/proxy/team_spec.rb
|
157
158
|
- spec/unit/proxy/unclaimed_draft_spec.rb
|
159
|
+
- spec/unit/upload_io_spec.rb
|
158
160
|
homepage: http://www.github.com/craiglittle/hello_sign
|
159
|
-
licenses:
|
161
|
+
licenses:
|
162
|
+
- MIT
|
160
163
|
post_install_message:
|
161
164
|
rdoc_options: []
|
162
165
|
require_paths:
|
@@ -175,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
178
|
version: '0'
|
176
179
|
requirements: []
|
177
180
|
rubyforge_project:
|
178
|
-
rubygems_version: 1.8.
|
181
|
+
rubygems_version: 1.8.25
|
179
182
|
signing_key:
|
180
183
|
specification_version: 3
|
181
184
|
summary: A Ruby interface to the HelloSign API.
|
@@ -206,3 +209,4 @@ test_files:
|
|
206
209
|
- spec/unit/proxy/signature_request_spec.rb
|
207
210
|
- spec/unit/proxy/team_spec.rb
|
208
211
|
- spec/unit/proxy/unclaimed_draft_spec.rb
|
212
|
+
- spec/unit/upload_io_spec.rb
|