clicksign 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -4
- data/README.md +19 -0
- data/lib/clicksign/document.rb +21 -1
- data/lib/clicksign/version.rb +1 -1
- data/spec/clicksign_spec.rb +28 -0
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e190617a8165a91dfe5eafc285aec246b819fd45
|
4
|
+
data.tar.gz: 980736375f64d975e8e6508325dbe5629df3dc9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96acab5e66d16ccfb666ca32b440071830177968ec1113801217a138df00a399891625766efd04de46dc8cf80fca3430ff6d37b0b9c287142d28471da3f579a2
|
7
|
+
data.tar.gz: efab1f4d40647233ad0119ff84d9ba9888c6f4e2fb0577cf597aac3cf432f119df200ac10ecefc4f9bb94600255d981f85c181930de8437f8539783e4f0dd63d
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
clicksign (0.
|
4
|
+
clicksign (0.1.4)
|
5
5
|
rest-client
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
diff-lcs (1.2.5)
|
11
|
-
|
12
|
-
|
11
|
+
domain_name (0.5.24)
|
12
|
+
unf (>= 0.0.5, < 1.0.0)
|
13
|
+
http-cookie (1.0.2)
|
14
|
+
domain_name (~> 0.5)
|
15
|
+
mime-types (2.6.1)
|
16
|
+
netrc (0.10.3)
|
13
17
|
rake (10.3.2)
|
14
|
-
rest-client (1.
|
18
|
+
rest-client (1.8.0)
|
19
|
+
http-cookie (>= 1.0.2, < 2.0)
|
15
20
|
mime-types (>= 1.16, < 3.0)
|
16
21
|
netrc (~> 0.7)
|
17
22
|
rspec (3.0.0)
|
@@ -26,6 +31,9 @@ GEM
|
|
26
31
|
rspec-mocks (3.0.1)
|
27
32
|
rspec-support (~> 3.0.0)
|
28
33
|
rspec-support (3.0.0)
|
34
|
+
unf (0.1.4)
|
35
|
+
unf_ext
|
36
|
+
unf_ext (0.0.7.1)
|
29
37
|
|
30
38
|
PLATFORMS
|
31
39
|
ruby
|
@@ -35,3 +43,6 @@ DEPENDENCIES
|
|
35
43
|
clicksign!
|
36
44
|
rake
|
37
45
|
rspec (~> 3.0)
|
46
|
+
|
47
|
+
BUNDLED WITH
|
48
|
+
1.10.6
|
data/README.md
CHANGED
@@ -66,6 +66,16 @@ the same as the ones in the section [Creating a signature list](#user-content-cr
|
|
66
66
|
found = Clicksign::Document.find(document_key)
|
67
67
|
```
|
68
68
|
|
69
|
+
### Downloading a document
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
zip = Clicksign::Document.download(document_key)
|
73
|
+
File.open('mydoc.zip', 'wb') { |f| f.write(zip) } if zip
|
74
|
+
```
|
75
|
+
|
76
|
+
If _found_ is _nil_, it means that the server is preparing the zip file.
|
77
|
+
When the zip is ready, its contents are retrieved.
|
78
|
+
|
69
79
|
### Creating a signature list
|
70
80
|
|
71
81
|
The method `Clicksign::Document.create_list` accepts **3 arguments**, the latter being optional.
|
@@ -84,6 +94,15 @@ signers = [{ email: 'john.doe@example.com', act: 'sign' }]
|
|
84
94
|
result = Clicksign::Document.create_list(document, signers, true)
|
85
95
|
```
|
86
96
|
|
97
|
+
### Resending a signature request
|
98
|
+
|
99
|
+
Use the following snippet to send a email to a signer that have not signed yet:
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
messsage = 'This is a reminder for you to sign the document.'
|
103
|
+
Clicksign::Document.resend(key, email, message)
|
104
|
+
```
|
105
|
+
|
87
106
|
### Hooks
|
88
107
|
|
89
108
|
You can perform three different actions with hooks: **retrieve** all, **create** a new one or **delete** an existing hook.
|
data/lib/clicksign/document.rb
CHANGED
@@ -26,7 +26,27 @@ module Clicksign
|
|
26
26
|
request :post,
|
27
27
|
api_url('documents', key, 'list'),
|
28
28
|
{ signers: [signers].flatten(1), skip_email: skip_email }.to_json,
|
29
|
-
content_type:
|
29
|
+
content_type: 'json'
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.resend(key, email, message)
|
33
|
+
request :post,
|
34
|
+
api_url('documents', key, 'resend'),
|
35
|
+
{ email: email, message: message }.to_json,
|
36
|
+
content_type: 'json'
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.download(key)
|
40
|
+
RestClient.get(api_url('documents', key, 'download')) do |response, request, result, &block|
|
41
|
+
case response.code
|
42
|
+
when 200
|
43
|
+
response
|
44
|
+
when 202
|
45
|
+
nil
|
46
|
+
else
|
47
|
+
response.return!(request, response, &block)
|
48
|
+
end
|
49
|
+
end
|
30
50
|
end
|
31
51
|
end
|
32
52
|
end
|
data/lib/clicksign/version.rb
CHANGED
data/spec/clicksign_spec.rb
CHANGED
@@ -53,4 +53,32 @@ describe Clicksign::Document do
|
|
53
53
|
})
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
describe '.resend' do
|
58
|
+
it 'resends document to an email' do
|
59
|
+
key = "1123-4567-89ab-cdef"
|
60
|
+
email = 'jane.doe@example.com'
|
61
|
+
message = 'This is a reminder for you. Please sign the document.'
|
62
|
+
|
63
|
+
expect(RestClient).to receive(:post)
|
64
|
+
.with(
|
65
|
+
"http://example.com/v1/documents/#{key}/resend?access_token=my_token",
|
66
|
+
{ email: email,
|
67
|
+
message: message }.to_json,
|
68
|
+
{ content_type: 'json', accept: 'json' }).and_return({})
|
69
|
+
|
70
|
+
Clicksign::Document.resend(key, email, message)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '.download' do
|
75
|
+
it 'downloads document' do
|
76
|
+
key = "1123-4567-89ab-cdef"
|
77
|
+
expect(RestClient).to receive(:get)
|
78
|
+
.with("http://example.com/v1/documents/#{key}/download?access_token=my_token")
|
79
|
+
.and_return({})
|
80
|
+
|
81
|
+
Clicksign::Document.download(key)
|
82
|
+
end
|
83
|
+
end
|
56
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clicksign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clicksign
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -121,4 +121,3 @@ test_files:
|
|
121
121
|
- spec/fixtures/all_documents.json
|
122
122
|
- spec/fixtures/document.xml
|
123
123
|
- spec/spec_helper.rb
|
124
|
-
has_rdoc:
|