clicksign-api 1.1.0.alpha3 → 1.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -16
- data/Gemfile.lock +1 -1
- data/README.md +30 -37
- data/lib/clicksign/api/batch.rb +2 -0
- data/lib/clicksign/api/documents_signers.rb +2 -0
- data/lib/clicksign/api/notifier.rb +2 -0
- data/lib/clicksign/api/signer.rb +2 -0
- data/lib/clicksign/api/version.rb +1 -1
- data/lib/clicksign/api/whatsapp_notifier.rb +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 061bb74814df58a57be2fe91efc07adf51bced436abcc52c66d0845fa8a0d5c4
|
4
|
+
data.tar.gz: f57a4fd5de30e9ab39ee4d6eb00226fe892c079a22e9536ffa0b7162ade253d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b63752187adf661d6b62f09a6f7988385bb1e364677d1125f21cce5d8ff24e8ede765931a3ef8102e9be6b82ab0fd8556b38a45cadc8893baf4da5769784b856
|
7
|
+
data.tar.gz: 562c3b925acee7c369ff5c3aadc961065c6c38cdbddc7c4add58805b3d72e0df6f720e12ea4ed659a35548ed8c616d7980efdb1c19c4e0565203fa376b06e2c1
|
data/CHANGELOG.md
CHANGED
@@ -1,25 +1,15 @@
|
|
1
1
|
# Clicksign::API 1.1.0 (Octuber 29, 2021)
|
2
2
|
|
3
3
|
Add support to multiple credentials.
|
4
|
-
This is useful to work with different environments, providing flexibility.
|
4
|
+
This is useful to work with different accounts and environments, providing flexibility.
|
5
5
|
For example, applications have different tokens for each environment.
|
6
6
|
Other useful case, occurs working with multiple companies.
|
7
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
|
-
```
|
8
|
+
The credentials should be a hash.
|
20
9
|
|
21
10
|
Request:
|
22
11
|
```ruby
|
23
|
-
|
24
|
-
|
25
|
-
|
12
|
+
file = File.open('/path/to/file/local/file.pdf', 'r')
|
13
|
+
response = Clicksign::API::Document.create(params: { path: '/path/to/file/on/clicksign.pdf', file: file }, token: 'key.production')
|
14
|
+
# =>
|
15
|
+
```
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -55,100 +55,93 @@ To see all available parameters, please, check the [API docs](https://developers
|
|
55
55
|
```ruby
|
56
56
|
file = File.open('/path/to/file/local/file.pdf', 'r')
|
57
57
|
document = Clicksign::API::Document.create( params: { path: '/path/to/file/on/clicksign.pdf', file: file }, token: 'valid_token')
|
58
|
-
=> #<Faraday::Response ...>
|
58
|
+
# => #<Faraday::Response ...>
|
59
59
|
|
60
60
|
document.success?
|
61
|
-
=> true # false
|
61
|
+
# => true # false
|
62
62
|
|
63
63
|
response_document = JSON.parse(document.body)
|
64
|
-
=> {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
|
65
|
-
=> # key: '123abcd' as example!
|
64
|
+
# => {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
|
66
65
|
```
|
67
66
|
|
68
67
|
#### View documents
|
69
68
|
|
70
69
|
```ruby
|
71
70
|
find_document = Clicksign::API::Document.find(params: { key: response_document['document']['key'] }, token: 'valid_token')
|
72
|
-
=> #<Faraday::Response ...>
|
71
|
+
# => #<Faraday::Response ...>
|
73
72
|
|
74
73
|
find_document.success?
|
75
|
-
=> true # false
|
74
|
+
# => true # false
|
76
75
|
|
77
76
|
JSON.parse(find_document.body)
|
78
|
-
=> {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
|
77
|
+
# => {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
|
79
78
|
```
|
80
79
|
|
81
80
|
#### Create Signers
|
82
81
|
|
83
82
|
```ruby
|
84
83
|
signer = Clicksign::API::Signer.create(params: { email: 'mail@email.com', auths: ['email'], delivery: 'email' }, token: 'valid_token')
|
85
|
-
=> #<Faraday::Response ...>
|
84
|
+
# => #<Faraday::Response ...>
|
86
85
|
|
87
86
|
signer.success?
|
88
|
-
=> true # false
|
87
|
+
# => true # false
|
89
88
|
|
90
89
|
response_signer = JSON.parse(signer.body)
|
91
|
-
=> {:
|
92
|
-
=> # signer_key: '999poo' as example!
|
90
|
+
# => {:signer=> {:key=> '...', :email=> '...', ... }
|
93
91
|
```
|
94
92
|
#### Add Signers to Document
|
95
93
|
|
96
94
|
```ruby
|
97
|
-
|
98
95
|
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 ...>
|
96
|
+
# => #<Faraday::Response ...>
|
100
97
|
|
101
98
|
signer_document.success?
|
102
|
-
=> true # false
|
99
|
+
# => true # false
|
103
100
|
|
104
101
|
response_signer_document = JSON.parse(signer_document.body)
|
105
|
-
=> {:
|
102
|
+
# => {:list=> {:key=> '...', ... }
|
106
103
|
```
|
107
104
|
|
108
105
|
##### Creating Documents in Batches
|
109
106
|
|
110
107
|
```ruby
|
111
|
-
|
112
|
-
|
113
|
-
|
108
|
+
batch = Clicksign::API::Batch.create(
|
109
|
+
params: {
|
110
|
+
document_keys: [response_document['document']['key'], 'other_document_key'],
|
111
|
+
signer_key: response_signer['key'],
|
112
|
+
summary: true
|
113
|
+
},
|
114
|
+
token: 'valid_token'
|
115
|
+
)
|
116
|
+
# => #<Faraday::Response ...>
|
114
117
|
|
115
118
|
batch.success?
|
116
|
-
=> true # false
|
119
|
+
# => true # false
|
117
120
|
|
118
121
|
rseponse_batch = JSON.parse(batch.body)
|
119
|
-
=> #{"batch"=> {"key"=>"
|
120
|
-
|
122
|
+
# => #{"batch"=> {"key"=>"..."
|
121
123
|
```
|
122
124
|
#### Notifying Signer by e-mail
|
123
125
|
|
124
126
|
```ruby
|
125
|
-
|
126
|
-
|
127
|
-
=> #<Faraday::Response ...>
|
127
|
+
notify = Clicksign::API::Notifier.notify(params: { request_signature_key: 'request_signature_key' }, token: 'valid_token')
|
128
|
+
# => #<Faraday::Response ...>
|
128
129
|
|
129
130
|
notify.success?
|
130
|
-
=> true # false
|
131
|
+
# => true # false
|
131
132
|
|
132
133
|
JSON.parse(notify.body)
|
133
|
-
=> ##<struct Faraday::Env, method=:post request_body="{\"request_signature_key\":
|
134
|
-
|
134
|
+
# => ##<struct Faraday::Env, method=:post request_body="{\"request_signature_key\":
|
135
135
|
```
|
136
136
|
|
137
137
|
#### Notifying Signer by whatsapp
|
138
138
|
|
139
139
|
```ruby
|
140
|
-
|
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 ...>
|
140
|
+
notify = Clicksign::API::Notifier.notify(params: { request_signature_key: 'request_signature_key' }, token: 'valid_token')
|
141
|
+
# => #<Faraday::Response ...>
|
145
142
|
|
146
143
|
notify.success?
|
147
|
-
=> true # false
|
148
|
-
|
149
|
-
JSON.parse(notify.body)
|
150
|
-
=> ##<struct Faraday::Env, method=:post request_body="{\"request_signature_key\":
|
151
|
-
|
144
|
+
# => true # false
|
152
145
|
|
153
146
|
## Development
|
154
147
|
|
data/lib/clicksign/api/batch.rb
CHANGED
data/lib/clicksign/api/signer.rb
CHANGED
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
|
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-
|
11
|
+
date: 2021-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -194,9 +194,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
194
|
version: '0'
|
195
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
196
|
requirements:
|
197
|
-
- - "
|
197
|
+
- - ">="
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version:
|
199
|
+
version: '0'
|
200
200
|
requirements: []
|
201
201
|
rubygems_version: 3.1.6
|
202
202
|
signing_key:
|