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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d11f64e7417787bde2ab879785fccf87ebfcf30f4b3db77c1ca8ba6798c9117b
4
- data.tar.gz: 7f56bec3b6074b20f50e6ac3fa8ff13e2ebcd215d2cba373ca86b1e1d97505e8
3
+ metadata.gz: 061bb74814df58a57be2fe91efc07adf51bced436abcc52c66d0845fa8a0d5c4
4
+ data.tar.gz: f57a4fd5de30e9ab39ee4d6eb00226fe892c079a22e9536ffa0b7162ade253d9
5
5
  SHA512:
6
- metadata.gz: 54be14b9d9e0eb0e965d965800d79a8fc0b209945b232c524836d334392430b4ef256c7b24bc396896a0e284ffb2bc74ae5f9963d3e8c3a933ce69f8b7aa9c2b
7
- data.tar.gz: b987296d24c8885b3e0559ed9860a0de273d4c70d851802fcbec2b7c665a722336cd2af4a4eb1444afb36d8eacbcb2d787f8b3c927b02473321fe3f27c1c597b
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
- => 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.alpha3)
4
+ clicksign-api (1.1.0)
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
@@ -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
@@ -19,6 +19,8 @@ module Clicksign
19
19
  end
20
20
 
21
21
  def body(params)
22
+ params = params.transform_keys(&:to_sym)
23
+
22
24
  signer = ATTRIBUTES.each.with_object({}) do |key, hash|
23
25
  hash[key] = params[key] if params.has_key?(key)
24
26
  end
@@ -1,5 +1,5 @@
1
1
  module Clicksign
2
2
  module API
3
- VERSION = "1.1.0.alpha3"
3
+ VERSION = "1.1.0"
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.alpha3
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-01 00:00:00.000000000 Z
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: 1.3.1
199
+ version: '0'
200
200
  requirements: []
201
201
  rubygems_version: 3.1.6
202
202
  signing_key: