signaturit-sdk 0.0.4 → 0.0.5
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 +31 -0
- data/lib/signaturit_client.rb +32 -6
- data/signaturit-sdk.gemspec +2 -2
- data/test/test_signaturit_client.rb +8 -0
- metadata +2 -2
data/README.md
CHANGED
@@ -69,6 +69,12 @@ response = client.get_signatures(100, 0, 3)
|
|
69
69
|
response = client.get_signatures(100, 0, 3, '2014-7-20')
|
70
70
|
```
|
71
71
|
|
72
|
+
##### Getting signatures with custom field "crm_id"
|
73
|
+
|
74
|
+
```
|
75
|
+
response = client.get_signatures(100, 0, nil, nil, :crm_id => 2445)
|
76
|
+
```
|
77
|
+
|
72
78
|
### Count signature requests
|
73
79
|
|
74
80
|
Count your signature requests.
|
@@ -112,6 +118,31 @@ file_path = '/documents/contracts/125932_important.pdf'
|
|
112
118
|
response = client.create_signature_request(file_path, recipients, params)
|
113
119
|
```
|
114
120
|
|
121
|
+
You can add custom info in your requests
|
122
|
+
|
123
|
+
```
|
124
|
+
recipients = ['bobsoap@signatur.it']
|
125
|
+
params = {:subject => 'Receipt number 250', :body => 'Please, can you sign this document?', :data => {:crm_id => 2445}}
|
126
|
+
file_path = '/documents/contracts/125932_important.pdf'
|
127
|
+
response = client.create_signature_request(file_path, recipients, params)
|
128
|
+
```
|
129
|
+
|
130
|
+
### Cancel signature request
|
131
|
+
|
132
|
+
Cancel a signature request.
|
133
|
+
|
134
|
+
```
|
135
|
+
response = client.cancel_signature_request('SIGNATURE_ID');
|
136
|
+
```
|
137
|
+
|
138
|
+
### Send reminder
|
139
|
+
|
140
|
+
Send a reminder for signature request job.
|
141
|
+
|
142
|
+
```
|
143
|
+
response = client.send_reminder('SIGNATURE_ID', 'DOCUMENT_ID');
|
144
|
+
```
|
145
|
+
|
115
146
|
### Get audit trail
|
116
147
|
|
117
148
|
Get the audit trail of a signature request document and save it in the submitted path.
|
data/lib/signaturit_client.rb
CHANGED
@@ -11,7 +11,7 @@ class SignaturitClient
|
|
11
11
|
def initialize(token, production = false)
|
12
12
|
base = production ? 'https://api.signaturit.com' : 'http://api.sandbox.signaturit.com'
|
13
13
|
|
14
|
-
@client = RestClient::Resource.new base, :headers => { :Authorization => "Bearer #{token}" }, :ssl_version => :TLSv1_2
|
14
|
+
@client = RestClient::Resource.new base, :headers => { :Authorization => "Bearer #{token}", :user_agent => 'signaturit-ruby-sdk 0.0.4' }, :ssl_version => :TLSv1_2
|
15
15
|
end
|
16
16
|
|
17
17
|
# get info from your account
|
@@ -66,12 +66,21 @@ class SignaturitClient
|
|
66
66
|
# +offset+:: Offset of results to skip
|
67
67
|
# +status+:: Status of the signature objects to filter
|
68
68
|
# +since+:: Filter signature objects created since this date
|
69
|
-
|
69
|
+
# +data+:: Filter signature objects using custom data
|
70
|
+
def get_signatures(limit = 100, offset = 0, status = nil, since = nil, data = nil)
|
70
71
|
params = { :limit => limit, :offset => offset }
|
71
72
|
|
72
73
|
params[:status] = status unless status.nil?
|
73
74
|
params[:since] = since unless since.nil?
|
74
75
|
|
76
|
+
if data
|
77
|
+
data.each do |key, value|
|
78
|
+
new_key = "data.#{key}"
|
79
|
+
|
80
|
+
params[new_key] = value
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
75
84
|
request :get, '/v2/signs.json', params
|
76
85
|
end
|
77
86
|
|
@@ -80,12 +89,21 @@ class SignaturitClient
|
|
80
89
|
# Params:
|
81
90
|
# +status+:: Status of the signature objects to filter
|
82
91
|
# +since+:: Filter signature objects created since this date
|
83
|
-
|
92
|
+
# +data+:: Filter signature objects using custom data
|
93
|
+
def count_signatures(status = nil, since = nil, data = nil)
|
84
94
|
params = {}
|
85
95
|
|
86
96
|
params[:status] = status unless status.nil?
|
87
97
|
params[:since] = since unless since.nil?
|
88
98
|
|
99
|
+
if data
|
100
|
+
data.each do |key, value|
|
101
|
+
new_key = "data.#{key}"
|
102
|
+
|
103
|
+
params[new_key] = value
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
89
107
|
request :get, '/v2/signs/count.json', params
|
90
108
|
end
|
91
109
|
|
@@ -110,7 +128,7 @@ class SignaturitClient
|
|
110
128
|
#
|
111
129
|
# Params:
|
112
130
|
# +signature_id++:: The id of the signature object
|
113
|
-
# +document_id++::
|
131
|
+
# +document_id++:: The id of the document object
|
114
132
|
# +path++:: Path where the document will be stored
|
115
133
|
def get_audit_trail(signature_id, document_id, path)
|
116
134
|
response = request :get, "/v2/signs/#{signature_id}/documents/#{document_id}/download/doc_proof", {}, false
|
@@ -126,7 +144,7 @@ class SignaturitClient
|
|
126
144
|
#
|
127
145
|
# Params:
|
128
146
|
# +signature_id++:: The id of the signature object
|
129
|
-
# +document_id++::
|
147
|
+
# +document_id++:: The id of the document object
|
130
148
|
# +path++:: Path where the document will be stored
|
131
149
|
def get_signed_document(signature_id, document_id, path)
|
132
150
|
response = request :get, "/v2/signs/#{signature_id}/documents/#{document_id}/download/signed", {}, false
|
@@ -180,6 +198,15 @@ class SignaturitClient
|
|
180
198
|
request :patch, "/v2/signs/#{signature_id}/cancel.json"
|
181
199
|
end
|
182
200
|
|
201
|
+
# Send a reminder for the given signature request document
|
202
|
+
#
|
203
|
+
# Param
|
204
|
+
# +signature_id++:: The id of the signature object
|
205
|
+
# +document_id++:: The id of the document object
|
206
|
+
def send_reminder(signature_id, document_id)
|
207
|
+
request :post, "/v2/signs/#{signature_id}/documents/#{document_id}/reminder.json"
|
208
|
+
end
|
209
|
+
|
183
210
|
# Get a concrete branding
|
184
211
|
#
|
185
212
|
# Params
|
@@ -293,5 +320,4 @@ class SignaturitClient
|
|
293
320
|
|
294
321
|
body
|
295
322
|
end
|
296
|
-
|
297
323
|
end
|
data/signaturit-sdk.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.platform = Gem::Platform::RUBY
|
3
3
|
s.name = 'signaturit-sdk'
|
4
|
-
s.version = '0.0.
|
5
|
-
s.date = '
|
4
|
+
s.version = '0.0.5'
|
5
|
+
s.date = '2015-02-10'
|
6
6
|
s.summary = 'Signaturit Ruby SDK'
|
7
7
|
s.description = 'Sign Documents Online'
|
8
8
|
|
@@ -110,6 +110,14 @@ class TestSignaturitClient < Test::Unit::TestCase
|
|
110
110
|
assert_requested :patch, 'https://api.signaturit.com/v2/signs/an_id/cancel.json', :headers => { :Authorization => 'Bearer a_token' }
|
111
111
|
end
|
112
112
|
|
113
|
+
def test_send_reminder
|
114
|
+
stub_request(:any, /.*/).to_return(:body => '{}')
|
115
|
+
|
116
|
+
@client.send_reminder('an_id', 'another_id')
|
117
|
+
|
118
|
+
assert_requested :post, 'https://api.signaturit.com/v2/signs/an_id/documents/another_id/reminder.json', :headers => { :Authorization => 'Bearer a_token' }
|
119
|
+
end
|
120
|
+
|
113
121
|
def test_create_signature_request_multi
|
114
122
|
stub_request(:any, /.*/).to_return(:body => '{}')
|
115
123
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: signaturit-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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:
|
12
|
+
date: 2015-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest_client
|