clicksign-api 0.0.3 → 1.1.0.alpha2

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: ac13a12c8bf52e5a0d1d424e367c28cd64d78a2c0980bfdeca731a95a5a82bc2
4
- data.tar.gz: 1220fb326165bb377ac5e169d07706a66b188c36262b967fc2d637fd9ee7af38
3
+ metadata.gz: 35e2042ab4a9a94f3159c1b56192f92db15a84f301de3c9e9fa8bfe0be7d447a
4
+ data.tar.gz: a26c118f1a234525a17a2f6f210ef95eef1112b5405956512e2a5d7b8437f19f
5
5
  SHA512:
6
- metadata.gz: f3d50bf544d7a006b11a06388f09143433e9c512ea5867b598fef7569ee0b7eed16a33a1e376875b85caabffc619e267354f9c4ba95ef4287fa6c5f6c0e8e068
7
- data.tar.gz: f3a298c7dc4b5978978649593e427c635bc6b1da0c5103db8b65e68af8748fe6e8195acdc5688929143b4d06beb939473c04b5e3b118c69edde3ebf56321b2c0
6
+ metadata.gz: 901d00b80482587ac7a89af935331109cae51e31e7879d51993e64b5a3ff99214692e124f66478079be84ba1d795837e23502075d9a04738c92ac50014c8fd33
7
+ data.tar.gz: 6d32615a4a4dd3e37e73a1190f29ca572a446da50063a51e198bbad5dc8ec4b23a82e4256de6df5b3634f70c6021f42964c10b012b46d7a1cc3aeff27f7a3b31
data/Gemfile.lock CHANGED
@@ -1,65 +1,90 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clicksign-api (0.0.3)
4
+ clicksign-api (1.1.0.alpha2)
5
5
  faraday
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.5.2)
11
- public_suffix (>= 2.0.2, < 4.0)
10
+ addressable (2.8.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
12
  byebug (10.0.2)
13
- crack (0.4.3)
14
- safe_yaml (~> 1.0.0)
15
- diff-lcs (1.3)
16
- docile (1.3.1)
17
- dotenv (2.5.0)
18
- faraday (0.15.4)
13
+ coderay (1.1.3)
14
+ crack (0.4.5)
15
+ rexml
16
+ diff-lcs (1.4.4)
17
+ docile (1.4.0)
18
+ dotenv (2.7.6)
19
+ faraday (1.8.0)
20
+ faraday-em_http (~> 1.0)
21
+ faraday-em_synchrony (~> 1.0)
22
+ faraday-excon (~> 1.1)
23
+ faraday-httpclient (~> 1.0.1)
24
+ faraday-net_http (~> 1.0)
25
+ faraday-net_http_persistent (~> 1.1)
26
+ faraday-patron (~> 1.0)
27
+ faraday-rack (~> 1.0)
19
28
  multipart-post (>= 1.2, < 3)
20
- hashdiff (0.3.7)
21
- json (2.1.0)
22
- multipart-post (2.0.0)
23
- public_suffix (3.0.3)
24
- rake (10.5.0)
25
- rspec (3.8.0)
26
- rspec-core (~> 3.8.0)
27
- rspec-expectations (~> 3.8.0)
28
- rspec-mocks (~> 3.8.0)
29
- rspec-core (3.8.0)
30
- rspec-support (~> 3.8.0)
31
- rspec-expectations (3.8.2)
29
+ ruby2_keywords (>= 0.0.4)
30
+ faraday-em_http (1.0.0)
31
+ faraday-em_synchrony (1.0.0)
32
+ faraday-excon (1.1.0)
33
+ faraday-httpclient (1.0.1)
34
+ faraday-net_http (1.0.1)
35
+ faraday-net_http_persistent (1.2.0)
36
+ faraday-patron (1.0.0)
37
+ faraday-rack (1.0.0)
38
+ hashdiff (1.0.1)
39
+ method_source (1.0.0)
40
+ multipart-post (2.1.1)
41
+ pry (0.14.1)
42
+ coderay (~> 1.1)
43
+ method_source (~> 1.0)
44
+ public_suffix (4.0.6)
45
+ rake (13.0.6)
46
+ rexml (3.2.5)
47
+ rspec (3.10.0)
48
+ rspec-core (~> 3.10.0)
49
+ rspec-expectations (~> 3.10.0)
50
+ rspec-mocks (~> 3.10.0)
51
+ rspec-core (3.10.1)
52
+ rspec-support (~> 3.10.0)
53
+ rspec-expectations (3.10.1)
32
54
  diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.8.0)
34
- rspec-mocks (3.8.0)
55
+ rspec-support (~> 3.10.0)
56
+ rspec-mocks (3.10.2)
35
57
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.8.0)
37
- rspec-support (3.8.0)
38
- safe_yaml (1.0.4)
39
- simplecov (0.16.1)
58
+ rspec-support (~> 3.10.0)
59
+ rspec-support (3.10.2)
60
+ ruby2_keywords (0.0.5)
61
+ simplecov (0.21.2)
40
62
  docile (~> 1.1)
41
- json (>= 1.8, < 3)
42
- simplecov-html (~> 0.10.0)
43
- simplecov-html (0.10.2)
63
+ simplecov-html (~> 0.11)
64
+ simplecov_json_formatter (~> 0.1)
65
+ simplecov-html (0.12.3)
66
+ simplecov_json_formatter (0.1.3)
44
67
  vcr (4.0.0)
45
- webmock (3.4.2)
46
- addressable (>= 2.3.6)
68
+ webmock (3.14.0)
69
+ addressable (>= 2.8.0)
47
70
  crack (>= 0.3.2)
48
- hashdiff
71
+ hashdiff (>= 0.4.0, < 2.0.0)
49
72
 
50
73
  PLATFORMS
51
- ruby
74
+ x86_64-darwin-20
75
+ x86_64-linux
52
76
 
53
77
  DEPENDENCIES
54
- bundler (~> 1.16)
78
+ bundler (~> 2.2)
55
79
  byebug (~> 10.0)
56
80
  clicksign-api!
57
81
  dotenv (~> 2.5)
58
- rake (~> 10.0)
82
+ pry
83
+ rake (~> 13.0)
59
84
  rspec (~> 3.0)
60
85
  simplecov (~> 0.16)
61
86
  vcr (~> 4.0)
62
87
  webmock (~> 3.0)
63
88
 
64
89
  BUNDLED WITH
65
- 1.17.3
90
+ 2.2.29
@@ -5,7 +5,7 @@ require "clicksign/api/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'clicksign-api'
8
- spec.version = Clicksign::Api::VERSION
8
+ spec.version = Clicksign::API::VERSION
9
9
  spec.authors = ['Francisco Martins']
10
10
  spec.email = ['franciscomxs@gmail.com']
11
11
 
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
- spec.add_development_dependency 'bundler', '~> 1.16'
25
- spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'bundler', '~> 2.2'
25
+ spec.add_development_dependency 'rake', '~> 13.0'
26
26
  spec.add_development_dependency 'rspec', '~> 3.0'
27
27
  spec.add_dependency 'faraday'
28
28
 
@@ -31,4 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'webmock', '~> 3.0'
32
32
  spec.add_development_dependency 'byebug', '~> 10.0'
33
33
  spec.add_development_dependency 'dotenv', '~> 2.5'
34
+ spec.add_development_dependency 'pry'
34
35
  end
@@ -0,0 +1,28 @@
1
+ module Clicksign
2
+ module API
3
+ class Batch
4
+ extend Requests
5
+
6
+ REQUEST_PATH = '/api/v1/batches'
7
+ ATTRIBUTES = [:signer_key, :document_keys, :summary]
8
+
9
+ class << self
10
+ def create(token:, params: {})
11
+ post(
12
+ REQUEST_PATH,
13
+ body(params),
14
+ token,
15
+ )
16
+ end
17
+
18
+ def body(params)
19
+ batch = ATTRIBUTES.each.with_object({}) do |attribute, hash|
20
+ hash[attribute] = params[attribute] if params.has_key?(attribute)
21
+ end
22
+
23
+ body = { batch: batch }
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -4,18 +4,20 @@ module Clicksign
4
4
  extend Requests
5
5
 
6
6
  REQUEST_PATH = '/api/v1/documents/'
7
- ATTRIBUTES = [:path, :deadline_at, :auto_close, :locale]
7
+ ATTRIBUTES = [:path, :deadline_at, :auto_close, :locale, :content_base64]
8
8
 
9
9
  class << self
10
- def create(params = {})
11
- post(REQUEST_PATH, body(params))
10
+ def create(token:, params: {})
11
+ post(REQUEST_PATH, body(params), token)
12
12
  end
13
13
 
14
- def find(key)
15
- get(REQUEST_PATH + key)
14
+ def find(token:, key:)
15
+ get(REQUEST_PATH + key, token)
16
16
  end
17
17
 
18
18
  def body(params)
19
+ params = params.transform_keys(&:to_sym)
20
+
19
21
  document = ATTRIBUTES.each.with_object({}) do |attribute, hash|
20
22
  hash[attribute] = params[attribute] if params.has_key?(attribute)
21
23
  end
@@ -9,16 +9,17 @@ module Clicksign
9
9
  ]
10
10
 
11
11
  class << self
12
- def create(params)
12
+ def create(token:, params: {})
13
13
  post(
14
14
  REQUEST_PATH,
15
- body(params)
15
+ body(params),
16
+ token
16
17
  )
17
18
  end
18
19
 
19
- def batch_create(batch)
20
+ def batch_create(token:, batch:)
20
21
  batch.map do |params|
21
- create(params)
22
+ create(token: token, params: params)
22
23
  end
23
24
  end
24
25
 
@@ -7,10 +7,11 @@ module Clicksign
7
7
  ATTRIBUTES = [:request_signature_key, :message, :url]
8
8
 
9
9
  class << self
10
- def notify(params = {})
10
+ def notify(token:, params: {})
11
11
  post(
12
12
  REQUEST_PATH,
13
- body(params)
13
+ body(params),
14
+ token
14
15
  )
15
16
  end
16
17
 
@@ -1,17 +1,17 @@
1
1
  module Clicksign
2
2
  module API
3
3
  module Requests
4
- def post(request_path, body)
4
+ def post(request_path, body, token)
5
5
  conn.post do |req|
6
- req.url request_path, { access_token: Clicksign::API.access_token }
6
+ req.url request_path, { access_token: Clicksign::API.credentials[token] }
7
7
  req.headers['Content-Type'] = 'application/json'
8
8
  req.body = body.to_json
9
9
  end
10
10
  end
11
11
 
12
- def get(request_path)
12
+ def get(request_path, token)
13
13
  conn.get do |req|
14
- req.url request_path, { access_token: Clicksign::API.access_token }
14
+ req.url request_path, { access_token: Clicksign::API.credentials[token] }
15
15
  req.headers['Content-Type'] = 'application/json'
16
16
  end
17
17
  end
@@ -10,10 +10,11 @@ module Clicksign
10
10
  ]
11
11
 
12
12
  class << self
13
- def create(params)
13
+ def create(token:, params:)
14
14
  post(
15
15
  REQUEST_PATH,
16
- body(params)
16
+ body(params),
17
+ token
17
18
  )
18
19
  end
19
20
 
@@ -1,5 +1,5 @@
1
1
  module Clicksign
2
- module Api
3
- VERSION = "0.0.3"
2
+ module API
3
+ VERSION = "1.1.0.alpha2"
4
4
  end
5
5
  end
@@ -0,0 +1,26 @@
1
+ module Clicksign
2
+ module API
3
+ class WhatsappNotifier
4
+ extend Requests
5
+
6
+ REQUEST_PATH = '/api/v1/notify_by_whatsapp'
7
+ ATTRIBUTES = [:request_signature_key]
8
+
9
+ class << self
10
+ def notify(token:, params: {})
11
+ post(
12
+ REQUEST_PATH,
13
+ body(params),
14
+ token
15
+ )
16
+ end
17
+
18
+ def body(params)
19
+ ATTRIBUTES.each.with_object({}) do |attribute, hash|
20
+ hash[attribute] = params[attribute] if params.has_key?(attribute)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
data/lib/clicksign/api.rb CHANGED
@@ -1,25 +1,30 @@
1
- require "clicksign/api/version"
1
+ require 'clicksign/api/version'
2
2
 
3
- require "faraday"
4
- require "base64"
3
+ require 'faraday'
4
+ require 'base64'
5
+ require 'json'
6
+ require 'yaml'
7
+ require 'erb'
5
8
 
6
9
  begin
7
- require "dotenv/load"
8
- require "byebug"
10
+ require 'dotenv/load'
11
+ require 'byebug'
12
+ require 'pry'
9
13
  rescue LoadError
10
14
  end
11
15
 
12
- require "clicksign/api/requests"
13
- require "clicksign/api/document"
14
- require "clicksign/api/documents_signers"
15
- require "clicksign/api/signer"
16
- require "clicksign/api/notifier"
17
-
16
+ require 'clicksign/api/requests'
17
+ require 'clicksign/api/batch'
18
+ require 'clicksign/api/document'
19
+ require 'clicksign/api/documents_signers'
20
+ require 'clicksign/api/signer'
21
+ require 'clicksign/api/notifier'
22
+ require 'clicksign/api/whatsapp_notifier'
18
23
 
19
24
  module Clicksign
20
25
  module API
21
26
  class << self
22
- attr_accessor :access_token, :production
27
+ attr_accessor :credentials, :production
23
28
 
24
29
  def configure
25
30
  yield(self)
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: 0.0.3
4
+ version: 1.1.0.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francisco Martins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-27 00:00:00.000000000 Z
11
+ date: 2021-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '2.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '2.5'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  description:
140
154
  email:
141
155
  - franciscomxs@gmail.com
@@ -157,12 +171,14 @@ files:
157
171
  - bin/setup
158
172
  - clicksign-api.gemspec
159
173
  - lib/clicksign/api.rb
174
+ - lib/clicksign/api/batch.rb
160
175
  - lib/clicksign/api/document.rb
161
176
  - lib/clicksign/api/documents_signers.rb
162
177
  - lib/clicksign/api/notifier.rb
163
178
  - lib/clicksign/api/requests.rb
164
179
  - lib/clicksign/api/signer.rb
165
180
  - lib/clicksign/api/version.rb
181
+ - lib/clicksign/api/whatsapp_notifier.rb
166
182
  homepage: https://github.com/NexoosBR/clicksign-api
167
183
  licenses: []
168
184
  metadata: {}
@@ -177,12 +193,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
193
  version: '0'
178
194
  required_rubygems_version: !ruby/object:Gem::Requirement
179
195
  requirements:
180
- - - ">="
196
+ - - ">"
181
197
  - !ruby/object:Gem::Version
182
- version: '0'
198
+ version: 1.3.1
183
199
  requirements: []
184
- rubyforge_project:
185
- rubygems_version: 2.7.7
200
+ rubygems_version: 3.0.3
186
201
  signing_key:
187
202
  specification_version: 4
188
203
  summary: Clicksign API ruby interface