clicksign-api 1.1.0.alpha4 → 1.1.1

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: 53f37c89406853a22420f28ada42cc02f354aaa0faab9f1250929e324befedfc
4
- data.tar.gz: d5cebece973a0001692b0a4a32e42ca83e064d973835fcf1263c956b2a7ef40b
3
+ metadata.gz: c4d73d8a0e57c13f35deb924e70f0cf2b55dec18ab4f1fe1b0ec72c9ecfe9a7d
4
+ data.tar.gz: 384d5c4a557a563576cf75e45efdf360b8ba343a2ecf44231a1e0a66489c19b3
5
5
  SHA512:
6
- metadata.gz: 26d092f0d08e34ed93d431779dd23b1e35c7797eb9ad0f8db741454a5685e61367fbad28cad36dff459cc6da5754a7eb55a975f912c62f307720af63b5aef2e0
7
- data.tar.gz: a64f4b516b3377ae7bac49a165969179c6150cfca64e3fb013b2aae8315a72d4c5ddb2119342686e07394e9e7d2f330271b04174772e9fe15f86d51f1866abc9
6
+ metadata.gz: 217334cbbf14ddffa78d804806bff973ede762d3acb49d3ea6d4bb8ec94fc96bef0af2ba7fddcf8ba5906e49f9a0947883a6b4f00f6ea0d8c0bfbfce97953b76
7
+ data.tar.gz: 4ef82bd3d37e148f3ad52104f1ccf6c766f700357112a6933262d112dadb2ee5ee34f5aa40d0d150928fe3f815144999aa144d6f675d705b8cd138820489f3b2
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
- => 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
- ```
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clicksign-api (1.1.0.alpha4)
4
+ clicksign-api (1.1.1)
5
5
  faraday
6
6
 
7
7
  GEM
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
- => {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
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
- => {:document=> {:key=> '...', :path=> '...', :status => '...', ... }
102
+ # => {:list=> {:key=> '...', ... }
106
103
  ```
107
104
 
108
105
  ##### Creating Documents in Batches
109
106
 
110
107
  ```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 ...>
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"=>"3dd7fa89-15f7-48b6-81e8-7d14a273bbb8"
120
-
122
+ # => #{"batch"=> {"key"=>"..."
121
123
  ```
122
124
  #### Notifying Signer by e-mail
123
125
 
124
126
  ```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 ...>
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
- => # 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 ...>
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
 
@@ -16,6 +16,8 @@ module Clicksign
16
16
  end
17
17
 
18
18
  def body(params)
19
+ params = params.transform_keys(&:to_sym)
20
+
19
21
  batch = ATTRIBUTES.each.with_object({}) do |attribute, hash|
20
22
  hash[attribute] = params[attribute] if params.has_key?(attribute)
21
23
  end
@@ -12,6 +12,7 @@ module Clicksign
12
12
  end
13
13
 
14
14
  def find(token:, params:)
15
+ params = params.transform_keys(&:to_sym)
15
16
  get(REQUEST_PATH + params[:key], token)
16
17
  end
17
18
 
@@ -24,6 +24,8 @@ module Clicksign
24
24
  end
25
25
 
26
26
  def body(params)
27
+ params = params.transform_keys(&:to_sym)
28
+
27
29
  list = ATTRIBUTES.each.with_object({}) do |key, hash|
28
30
  hash[key] = params[key] if params.has_key?(key)
29
31
  end
@@ -16,6 +16,8 @@ module Clicksign
16
16
  end
17
17
 
18
18
  def body(params)
19
+ params = params.transform_keys(&:to_sym)
20
+
19
21
  ATTRIBUTES.each.with_object({}) do |attribute, hash|
20
22
  hash[attribute] = params[attribute] if params.has_key?(attribute)
21
23
  end
@@ -1,5 +1,5 @@
1
1
  module Clicksign
2
2
  module API
3
- VERSION = "1.1.0.alpha4"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
@@ -16,6 +16,8 @@ module Clicksign
16
16
  end
17
17
 
18
18
  def body(params)
19
+ params = params.transform_keys(&:to_sym)
20
+
19
21
  ATTRIBUTES.each.with_object({}) do |attribute, hash|
20
22
  hash[attribute] = params[attribute] if params.has_key?(attribute)
21
23
  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.alpha4
4
+ version: 1.1.1
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-01 00:00:00.000000000 Z
11
+ date: 2021-11-05 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: 1.3.1
199
+ version: '0'
200
200
  requirements: []
201
201
  rubygems_version: 3.1.6
202
202
  signing_key: