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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35e2042ab4a9a94f3159c1b56192f92db15a84f301de3c9e9fa8bfe0be7d447a
4
- data.tar.gz: a26c118f1a234525a17a2f6f210ef95eef1112b5405956512e2a5d7b8437f19f
3
+ metadata.gz: d11f64e7417787bde2ab879785fccf87ebfcf30f4b3db77c1ca8ba6798c9117b
4
+ data.tar.gz: 7f56bec3b6074b20f50e6ac3fa8ff13e2ebcd215d2cba373ca86b1e1d97505e8
5
5
  SHA512:
6
- metadata.gz: 901d00b80482587ac7a89af935331109cae51e31e7879d51993e64b5a3ff99214692e124f66478079be84ba1d795837e23502075d9a04738c92ac50014c8fd33
7
- data.tar.gz: 6d32615a4a4dd3e37e73a1190f29ca572a446da50063a51e198bbad5dc8ec4b23a82e4256de6df5b3634f70c6021f42964c10b012b46d7a1cc3aeff27f7a3b31
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clicksign-api (1.1.0.alpha2)
4
+ clicksign-api (1.1.0.alpha3)
5
5
  faraday
6
6
 
7
7
  GEM
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.access_token = ENV['CLICKSIGN_ACCESS_TOKEN']
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
- response = Clicksign::API::Document.create(path: '/path/to/file.pdf', file: file)
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
- response.success?
60
+ document.success?
54
61
  => true # false
55
62
 
56
- JSON.parse(response.body)
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
- response = Clicksign::API::Document.find('DOCUMENT_KEY')
71
+ find_document = Clicksign::API::Document.find(params: { key: response_document['document']['key'] }, token: 'valid_token')
64
72
  => #<Faraday::Response ...>
65
73
 
66
- response.success?
74
+ find_document.success?
67
75
  => true # false
68
76
 
69
- JSON.parse(response.body)
77
+ JSON.parse(find_document.body)
70
78
  => {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
71
79
  ```
72
80
 
73
- #### Add signers
81
+ #### Create Signers
74
82
 
75
83
  ```ruby
76
- response = Clicksign::API::Signer.create('DOCUMENT_KEY', signer)
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
- response.success?
87
+ signer.success?
80
88
  => true # false
81
89
 
82
- JSON.parse(response.body)
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
 
@@ -11,8 +11,8 @@ module Clicksign
11
11
  post(REQUEST_PATH, body(params), token)
12
12
  end
13
13
 
14
- def find(token:, key:)
15
- get(REQUEST_PATH + key, token)
14
+ def find(token:, params:)
15
+ get(REQUEST_PATH + params[:key], token)
16
16
  end
17
17
 
18
18
  def body(params)
@@ -1,5 +1,5 @@
1
1
  module Clicksign
2
2
  module API
3
- VERSION = "1.1.0.alpha2"
3
+ VERSION = "1.1.0.alpha3"
4
4
  end
5
5
  end
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.alpha2
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-10-27 00:00:00.000000000 Z
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.0.3
201
+ rubygems_version: 3.1.6
201
202
  signing_key:
202
203
  specification_version: 4
203
204
  summary: Clicksign API ruby interface