hellosign-api 1.0.4 → 1.0.7
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/README.md +11 -5
- data/lib/hello_sign/api/template.rb +1 -0
- data/lib/hello_sign/client.rb +3 -3
- data/lib/hello_sign/version.rb +1 -1
- data/spec/fixtures/template_draft.json +7 -0
- data/spec/hello_sign/api/template_spec.rb +32 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 962547ff97880375f9e56a5fd00b3fb34bd20007929e6574f94ffba7e731ccf0
|
4
|
+
data.tar.gz: 915e99bd963ac37bfd12ed99f5ba85ced15610039dff9e852aadf4c1a1f5ce6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88b69a7d887ea2398b4ab13cabef08d8a02a59ea7748abb8fee18e88ed600568d4ebac9f4647d8816c1a4dfd619d05b02dd126893461b01918452f30edce7271
|
7
|
+
data.tar.gz: c61a04e926e1b6cd464c3cc0f4c89be069393ea1e235302d15f19a3b542ec2d1f7735ff0a21ce1e348e792ff1dd707f75341d6796087368382006dcafebe6c12
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Add this line to your application's Gemfile:
|
6
6
|
|
7
|
-
gem 'hellosign'
|
7
|
+
gem 'hellosign-api'
|
8
8
|
|
9
9
|
And then execute:
|
10
10
|
|
@@ -27,6 +27,7 @@ end
|
|
27
27
|
```
|
28
28
|
|
29
29
|
## Usage
|
30
|
+
|
30
31
|
When you have configured your app like above, you can start using it:
|
31
32
|
|
32
33
|
```ruby
|
@@ -41,13 +42,16 @@ signature_request = HelloSign.get_signature_request signature_request_id: '42383
|
|
41
42
|
```
|
42
43
|
|
43
44
|
If you need to authenticate for multiple users and you want a separated client for them, you can run:
|
45
|
+
|
44
46
|
```ruby
|
45
47
|
client2 = HelloSign::Client.new api_key: 'your_user_api_key'
|
46
48
|
user_account = client2.get_account
|
47
49
|
```
|
50
|
+
|
48
51
|
### Specifying files
|
49
52
|
|
50
53
|
When using request endpoints that send files, such as a signature request, you can specify files either as
|
54
|
+
|
51
55
|
1. A string representing the path
|
52
56
|
2. A Ruby File Object (File.open, then assign to a variable)
|
53
57
|
3. A Rails ActionDispatch::Http::UploadedFile
|
@@ -60,16 +64,17 @@ from the root of your project run <code>rake spec</code>.
|
|
60
64
|
## Additional notes
|
61
65
|
|
62
66
|
## Warnings
|
67
|
+
|
63
68
|
Any warnings returned from the API can be accessed by using the 'warnings' accessor on a returned object or list:
|
64
69
|
|
65
|
-
|
70
|
+
```ruby
|
66
71
|
my_signature_requests = client.get_signature_requests
|
67
72
|
puts my_signature_requests.warnings
|
68
|
-
|
73
|
+
```
|
69
74
|
|
70
75
|
and will give output of warnings in the following format (as an array of hashes):
|
71
76
|
|
72
|
-
|
77
|
+
```
|
73
78
|
[
|
74
79
|
[0] {
|
75
80
|
"warning_msg" => "Parameter hodor was ignored. Hodor.",
|
@@ -80,9 +85,10 @@ and will give output of warnings in the following format (as an array of hashes)
|
|
80
85
|
"warning_name" => "unconfirmed"
|
81
86
|
}
|
82
87
|
]
|
83
|
-
|
88
|
+
```
|
84
89
|
|
85
90
|
### Local callbacks
|
91
|
+
|
86
92
|
We do not allow app callbacks (event or OAuth) to be set to localhost. However it is still possible to test callbacks against a local server. Tunneling services such as ngrok (http://ngrok.com) can help you set this up.
|
87
93
|
|
88
94
|
## License
|
data/lib/hello_sign/client.rb
CHANGED
@@ -156,11 +156,11 @@ module HelloSign
|
|
156
156
|
|
157
157
|
if options[:no_auth]
|
158
158
|
elsif auth_token
|
159
|
-
connection.authorization
|
159
|
+
connection.request :authorization, 'Bearer', -> { auth_token }
|
160
160
|
elsif api_key
|
161
|
-
connection.
|
161
|
+
connection.request :authorization, :basic, api_key, ''
|
162
162
|
elsif email_address
|
163
|
-
connection.
|
163
|
+
connection.request :authorization, :basic, email_address, password
|
164
164
|
else
|
165
165
|
end
|
166
166
|
if proxy_uri
|
data/lib/hello_sign/version.rb
CHANGED
@@ -169,4 +169,36 @@ describe HelloSign::Api::Template do
|
|
169
169
|
expect(@template.headers).to_not be_nil
|
170
170
|
end
|
171
171
|
end
|
172
|
+
|
173
|
+
describe '#create_embedded_template_draft' do
|
174
|
+
before do
|
175
|
+
stub_post('/template/create_embedded_draft', 'template_draft')
|
176
|
+
@template_draft = HelloSign.create_embedded_template_draft :title => 'Document Test', :file_url => 'http://hellosign.com/test.pdf'
|
177
|
+
end
|
178
|
+
|
179
|
+
it 'should return a Template Draft' do
|
180
|
+
expect(@template_draft).to be_an HelloSign::Resource::TemplateDraft
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'should return response headers' do
|
184
|
+
expect(@template_draft.headers).to_not be_nil
|
185
|
+
end
|
186
|
+
|
187
|
+
context 'with multiple signer_roles' do
|
188
|
+
before do
|
189
|
+
stub_post('/template/create_embedded_draft', 'template_draft')
|
190
|
+
@template_draft = HelloSign.create_embedded_template_draft(
|
191
|
+
:title => 'Document Test',
|
192
|
+
:file_url => 'http://hellosign.com/test.pdf',
|
193
|
+
:signer_roles => [{ :name => 'Employee' }, { :name => 'CEO' }]
|
194
|
+
)
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'should send signer_roles as json' do
|
198
|
+
expect(a_post('/template/create_embedded_draft').with(
|
199
|
+
:body => hash_including({ :signer_roles => [{ :name => 'Employee' }, { :name => 'CEO' }] }))
|
200
|
+
).to have_been_made
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
172
204
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hellosign-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HelloSign, Aubrey Holland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -182,6 +182,7 @@ files:
|
|
182
182
|
- spec/fixtures/signature_requests.json
|
183
183
|
- spec/fixtures/team.json
|
184
184
|
- spec/fixtures/template.json
|
185
|
+
- spec/fixtures/template_draft.json
|
185
186
|
- spec/fixtures/templates.json
|
186
187
|
- spec/fixtures/token.json
|
187
188
|
- spec/fixtures/unclaimed_draft.json
|
@@ -220,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
221
|
- !ruby/object:Gem::Version
|
221
222
|
version: '0'
|
222
223
|
requirements: []
|
223
|
-
rubygems_version: 3.
|
224
|
+
rubygems_version: 3.3.7
|
224
225
|
signing_key:
|
225
226
|
specification_version: 4
|
226
227
|
summary: A Ruby SDK for the HelloSign API.
|
@@ -240,6 +241,7 @@ test_files:
|
|
240
241
|
- spec/fixtures/signature_requests.json
|
241
242
|
- spec/fixtures/team.json
|
242
243
|
- spec/fixtures/template.json
|
244
|
+
- spec/fixtures/template_draft.json
|
243
245
|
- spec/fixtures/templates.json
|
244
246
|
- spec/fixtures/token.json
|
245
247
|
- spec/fixtures/unclaimed_draft.json
|