clicksign-api 1.1.0.alpha2 → 1.1.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +1 -1
- data/README.md +78 -11
- data/lib/clicksign/api/document.rb +2 -2
- data/lib/clicksign/api/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d11f64e7417787bde2ab879785fccf87ebfcf30f4b3db77c1ca8ba6798c9117b
|
4
|
+
data.tar.gz: 7f56bec3b6074b20f50e6ac3fa8ff13e2ebcd215d2cba373ca86b1e1d97505e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54be14b9d9e0eb0e965d965800d79a8fc0b209945b232c524836d334392430b4ef256c7b24bc396896a0e284ffb2bc74ae5f9963d3e8c3a933ce69f8b7aa9c2b
|
7
|
+
data.tar.gz: b987296d24c8885b3e0559ed9860a0de273d4c70d851802fcbec2b7c665a722336cd2af4a4eb1444afb36d8eacbcb2d787f8b3c927b02473321fe3f27c1c597b
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Clicksign::API 1.1.0 (Octuber 29, 2021)
|
2
|
+
|
3
|
+
Add support to multiple credentials.
|
4
|
+
This is useful to work with different environments, providing flexibility.
|
5
|
+
For example, applications have different tokens for each environment.
|
6
|
+
Other useful case, occurs working with multiple companies.
|
7
|
+
|
8
|
+
The credentials should be a hash.
|
9
|
+
It is possible use a `.yml` file to configure the authentication tokens.
|
10
|
+
The `.yml` file can get the tokens using environment variables.
|
11
|
+
Now all requests receive token parameter, that represents the key associated with the token.
|
12
|
+
|
13
|
+
## Examples:
|
14
|
+
|
15
|
+
YML file
|
16
|
+
```ruby
|
17
|
+
=> key.production: ENV['CLICKSIGN_ACCESS_TOKEN_PRODUCTION']
|
18
|
+
=> key.sandbox: ENV['CLICKSIGN_ACCESS_TOKEN_SANDBOX']
|
19
|
+
```
|
20
|
+
|
21
|
+
Request:
|
22
|
+
```ruby
|
23
|
+
=> file = File.open('/path/to/file/local/file.pdf', 'r')
|
24
|
+
=> response = Clicksign::API::Document.create( params: { path: '/path/to/file/on/clicksign.pdf', file: file }, token: 'key.production')
|
25
|
+
```
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -26,8 +26,14 @@ Or install it yourself as:
|
|
26
26
|
By default, all requests use Clicksign's SANDBOX.
|
27
27
|
|
28
28
|
```ruby
|
29
|
+
credentials = {
|
30
|
+
"key.production" => ENV["CLICKSIGN_ACCESS_TOKEN_PRODUCTION"]
|
31
|
+
"key.sandbox" => ENV["CLICKSIGN_ACCESS_TOKEN_SANDBOX"]
|
32
|
+
}
|
33
|
+
|
29
34
|
Clicksign::API.configure do |config|
|
30
|
-
config.
|
35
|
+
config.credentials = credentials
|
36
|
+
config.production = false
|
31
37
|
end
|
32
38
|
```
|
33
39
|
|
@@ -47,41 +53,102 @@ To see all available parameters, please, check the [API docs](https://developers
|
|
47
53
|
#### Create documents
|
48
54
|
|
49
55
|
```ruby
|
50
|
-
|
56
|
+
file = File.open('/path/to/file/local/file.pdf', 'r')
|
57
|
+
document = Clicksign::API::Document.create( params: { path: '/path/to/file/on/clicksign.pdf', file: file }, token: 'valid_token')
|
51
58
|
=> #<Faraday::Response ...>
|
52
59
|
|
53
|
-
|
60
|
+
document.success?
|
54
61
|
=> true # false
|
55
62
|
|
56
|
-
JSON.parse(
|
63
|
+
response_document = JSON.parse(document.body)
|
57
64
|
=> {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
|
65
|
+
=> # key: '123abcd' as example!
|
58
66
|
```
|
59
67
|
|
60
68
|
#### View documents
|
61
69
|
|
62
70
|
```ruby
|
63
|
-
|
71
|
+
find_document = Clicksign::API::Document.find(params: { key: response_document['document']['key'] }, token: 'valid_token')
|
64
72
|
=> #<Faraday::Response ...>
|
65
73
|
|
66
|
-
|
74
|
+
find_document.success?
|
67
75
|
=> true # false
|
68
76
|
|
69
|
-
JSON.parse(
|
77
|
+
JSON.parse(find_document.body)
|
70
78
|
=> {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
|
71
79
|
```
|
72
80
|
|
73
|
-
####
|
81
|
+
#### Create Signers
|
74
82
|
|
75
83
|
```ruby
|
76
|
-
|
84
|
+
signer = Clicksign::API::Signer.create(params: { email: 'mail@email.com', auths: ['email'], delivery: 'email' }, token: 'valid_token')
|
77
85
|
=> #<Faraday::Response ...>
|
78
86
|
|
79
|
-
|
87
|
+
signer.success?
|
80
88
|
=> true # false
|
81
89
|
|
82
|
-
JSON.parse(
|
90
|
+
response_signer = JSON.parse(signer.body)
|
83
91
|
=> {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
|
92
|
+
=> # signer_key: '999poo' as example!
|
84
93
|
```
|
94
|
+
#### Add Signers to Document
|
95
|
+
|
96
|
+
```ruby
|
97
|
+
|
98
|
+
signer_document = Clicksign::API::DocumentsSigners.create(params: { document_key: response_document['document']['key'], signer_key: response_signer['key'], sign_as: 'sign_as' }, token: 'valid_token')
|
99
|
+
=> #<Faraday::Response ...>
|
100
|
+
|
101
|
+
signer_document.success?
|
102
|
+
=> true # false
|
103
|
+
|
104
|
+
response_signer_document = JSON.parse(signer_document.body)
|
105
|
+
=> {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
|
106
|
+
```
|
107
|
+
|
108
|
+
##### Creating Documents in Batches
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
|
112
|
+
batch = Clicksign::API::Batch.create(params: { document_keys: [response_document['document']['key'], 'other_document_key'], signer_key: response_signer['key'], summary: true}, token: 'valid_token')
|
113
|
+
=> #<Faraday::Response ...>
|
114
|
+
|
115
|
+
batch.success?
|
116
|
+
=> true # false
|
117
|
+
|
118
|
+
rseponse_batch = JSON.parse(batch.body)
|
119
|
+
=> #{"batch"=> {"key"=>"3dd7fa89-15f7-48b6-81e8-7d14a273bbb8"
|
120
|
+
|
121
|
+
```
|
122
|
+
#### Notifying Signer by e-mail
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
request_signature_key = JSON.parse(response_document_above.body)['document']['signers'].first['request_signature_key']
|
126
|
+
notify = Clicksign::API::Notifier.notify(params: { request_signature_key: request_signature_key }, token: 'valid_token')
|
127
|
+
=> #<Faraday::Response ...>
|
128
|
+
|
129
|
+
notify.success?
|
130
|
+
=> true # false
|
131
|
+
|
132
|
+
JSON.parse(notify.body)
|
133
|
+
=> ##<struct Faraday::Env, method=:post request_body="{\"request_signature_key\":
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
#### Notifying Signer by whatsapp
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
=> # To deliver this content, its necessary add `phone_number` on Signer
|
141
|
+
|
142
|
+
request_signature_key = JSON.parse(response_document_above.body)['document']['signers'].first['request_signature_key']
|
143
|
+
notify = Clicksign::API::Notifier.notify(params: { request_signature_key: request_signature_key }, token: 'valid_token')
|
144
|
+
=> #<Faraday::Response ...>
|
145
|
+
|
146
|
+
notify.success?
|
147
|
+
=> true # false
|
148
|
+
|
149
|
+
JSON.parse(notify.body)
|
150
|
+
=> ##<struct Faraday::Env, method=:post request_body="{\"request_signature_key\":
|
151
|
+
|
85
152
|
|
86
153
|
## Development
|
87
154
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clicksign-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.
|
4
|
+
version: 1.1.0.alpha3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francisco Martins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -163,6 +163,7 @@ files:
|
|
163
163
|
- ".ruby-gemset"
|
164
164
|
- ".ruby-version"
|
165
165
|
- ".travis.yml"
|
166
|
+
- CHANGELOG.md
|
166
167
|
- Gemfile
|
167
168
|
- Gemfile.lock
|
168
169
|
- README.md
|
@@ -197,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
198
|
- !ruby/object:Gem::Version
|
198
199
|
version: 1.3.1
|
199
200
|
requirements: []
|
200
|
-
rubygems_version: 3.
|
201
|
+
rubygems_version: 3.1.6
|
201
202
|
signing_key:
|
202
203
|
specification_version: 4
|
203
204
|
summary: Clicksign API ruby interface
|