docuseal 0.1.1 → 1.0.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/README.md +51 -203
- data/lib/docuseal/api.rb +93 -0
- data/lib/docuseal/http.rb +62 -40
- data/lib/docuseal/version.rb +1 -1
- data/lib/docuseal.rb +55 -32
- metadata +20 -61
- data/.rspec +0 -3
- data/.ruby-version +0 -1
- data/.standard.yml +0 -3
- data/.vscode/settings.json +0 -11
- data/CHANGELOG.md +0 -5
- data/CODE_OF_CONDUCT.md +0 -84
- data/CONTRIBUTING.md +0 -3
- data/Gemfile +0 -26
- data/Gemfile.lock +0 -156
- data/LICENSE.txt +0 -21
- data/Rakefile +0 -10
- data/lib/docuseal/client.rb +0 -25
- data/lib/docuseal/model.rb +0 -87
- data/lib/docuseal/submission.rb +0 -18
- data/lib/docuseal/submitter.rb +0 -9
- data/lib/docuseal/template.rb +0 -29
- data/sig/docuseal.rbs +0 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a42565a2583a622dcfef3e7d2c145b4ea79a5b57972791c00b3c8d80f03c2bf4
|
|
4
|
+
data.tar.gz: 10bdcee2c2f97e43b746773836ac548646156e3f2825bf4bc563533cf9430d61
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4969ccfcdca73d84d274ff3d31c79ed5beab209179efbe9c8a561477366b4503082497af7cf74e523fce008adc7c88fe553947c042714fb303959ab2473c5ff6
|
|
7
|
+
data.tar.gz: a3ca3f193ed03196c1eef26dcd2cc768aa73cd5f2ead6294656928d4333f2dea06f7c9b92a549c928a6980cd122fba7e08064f785a6c751f15dd80cf13cb50f3
|
data/README.md
CHANGED
|
@@ -1,255 +1,103 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DocuSeal Ruby Library
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
<img src="https://codecov.io/github/moraki-finance/docuseal/graph/badge.svg?token=SKTT14JJGV"/>
|
|
5
|
-
</a>
|
|
3
|
+
The DocuSeal Ruby library provides seamless integration with the DocuSeal API, allowing developers to interact with DocuSeal's electronic signature and document management features directly within Ruby applications. This library is designed to simplify API interactions and provide tools for efficient implementation.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
## Documentation
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
:warning: The extracted API objects don't do input parameters validations. It's a simple faraday wrapper that allows you to send as many inputs as you want. The docuseal API might fail when passing a wrong set of parameters.
|
|
7
|
+
Detailed documentation is available at [DocuSeal API Docs](https://www.docuseal.com/docs/api).
|
|
12
8
|
|
|
13
9
|
## Installation
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
$ bundle add docuseal
|
|
18
|
-
|
|
19
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
20
|
-
|
|
21
|
-
$ gem install docuseal
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
### Setup
|
|
11
|
+
To install the library, run:
|
|
26
12
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```rb
|
|
30
|
-
Docuseal.configure do |config|
|
|
31
|
-
config.api_key = "{DOCUSEAL_API_KEY}"
|
|
32
|
-
end
|
|
13
|
+
```sh
|
|
14
|
+
gem install docuseal
|
|
33
15
|
```
|
|
34
16
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```rb
|
|
38
|
-
Docuseal.configure do |config|
|
|
39
|
-
config.api_key = "{DOCUSEAL_API_KEY}"
|
|
40
|
-
|
|
41
|
-
# Set the docuseal API request timeout, the default is 120 seconds
|
|
42
|
-
config.request_timeout = 20
|
|
43
|
-
|
|
44
|
-
# Set extra headers that will get attached to every docuseal api request.
|
|
45
|
-
# Useful for observability tools like Helicone: https://www.helicone.ai/
|
|
46
|
-
config.global_headers = {
|
|
47
|
-
"Helicone-Auth": "Bearer HELICONE_API_KEY"
|
|
48
|
-
"helicone-stream-force-format" => "true",
|
|
49
|
-
}
|
|
17
|
+
If you want to build the gem from source:
|
|
50
18
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
config.base_uri = "https://api.docuseal.eu/"
|
|
54
|
-
end
|
|
19
|
+
```sh
|
|
20
|
+
gem build docuseal.gemspec
|
|
55
21
|
```
|
|
56
22
|
|
|
57
|
-
###
|
|
23
|
+
### Requirements
|
|
58
24
|
|
|
59
|
-
|
|
25
|
+
- Ruby 2.5+.
|
|
60
26
|
|
|
61
|
-
|
|
27
|
+
### Bundler
|
|
62
28
|
|
|
63
|
-
|
|
64
|
-
submissions = Docuseal::Submission.list
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
#### Find
|
|
29
|
+
Add the library to your Gemfile for projects using Bundler:
|
|
68
30
|
|
|
69
|
-
|
|
31
|
+
```ruby
|
|
32
|
+
source 'https://rubygems.org'
|
|
70
33
|
|
|
71
|
-
|
|
72
|
-
submission = Docuseal::Submission.find(1)
|
|
34
|
+
gem 'docuseal'
|
|
73
35
|
```
|
|
74
36
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Reference: https://www.docuseal.co/docs/api#create-a-submission
|
|
78
|
-
|
|
79
|
-
```rb
|
|
80
|
-
submission = Docuseal::Submission.create(
|
|
81
|
-
template_id: 1000001,
|
|
82
|
-
send_email: true,
|
|
83
|
-
submitters: [{role: 'First Party', email: 'john.doe@example.com'}]
|
|
84
|
-
)
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
#### Create From Email
|
|
88
|
-
|
|
89
|
-
Reference: https://www.docuseal.co/docs/api#create-submissions-from-emails
|
|
90
|
-
|
|
91
|
-
```rb
|
|
92
|
-
submission = Docuseal::Submission.create(
|
|
93
|
-
from: :emails,
|
|
94
|
-
template_id: 1000001,
|
|
95
|
-
emails: 'hi@docuseal.co, example@docuseal.co'
|
|
96
|
-
)
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
#### Archive
|
|
100
|
-
|
|
101
|
-
Reference: https://www.docuseal.co/docs/api#archive-a-submission
|
|
102
|
-
|
|
103
|
-
```rb
|
|
104
|
-
submission = Docuseal::Submission.archive(1)
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Submitters
|
|
108
|
-
|
|
109
|
-
#### List
|
|
110
|
-
|
|
111
|
-
Reference: https://www.docuseal.co/docs/api#list-all-submitters
|
|
112
|
-
|
|
113
|
-
```rb
|
|
114
|
-
submitters = Docuseal::Submitter.list
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
#### Find
|
|
118
|
-
|
|
119
|
-
Reference: https://www.docuseal.co/docs/api#get-a-submitter
|
|
120
|
-
|
|
121
|
-
```rb
|
|
122
|
-
submitter = Docuseal::Submitter.find(1)
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
#### Update
|
|
126
|
-
|
|
127
|
-
Reference: https://www.docuseal.co/docs/api#update-a-submitter
|
|
128
|
-
|
|
129
|
-
```rb
|
|
130
|
-
submitter = Docuseal::Submitter.update(1,
|
|
131
|
-
email: 'john.doe@example.com',
|
|
132
|
-
fields: [{name: 'First Name', default_value: 'Acme'}]
|
|
133
|
-
)
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Templates
|
|
137
|
-
|
|
138
|
-
#### List
|
|
139
|
-
|
|
140
|
-
Reference: https://www.docuseal.co/docs/api#list-all-templates
|
|
141
|
-
|
|
142
|
-
```rb
|
|
143
|
-
templates = Docuseal::Template.list
|
|
144
|
-
```
|
|
37
|
+
## Usage
|
|
145
38
|
|
|
146
|
-
|
|
39
|
+
### Configuration
|
|
147
40
|
|
|
148
|
-
|
|
41
|
+
Set up the library with your DocuSeal API key based on your deployment. Retrieve your API key from the appropriate location:
|
|
149
42
|
|
|
150
|
-
|
|
151
|
-
template = Docuseal::Template.find(1)
|
|
152
|
-
```
|
|
43
|
+
#### Global Cloud
|
|
153
44
|
|
|
154
|
-
|
|
45
|
+
API keys for the global cloud can be obtained from your [Global DocuSeal Console](https://console.docuseal.com/api).
|
|
155
46
|
|
|
156
|
-
|
|
47
|
+
```ruby
|
|
48
|
+
require 'docuseal'
|
|
157
49
|
|
|
158
|
-
|
|
159
|
-
template = Docuseal::Template.create(
|
|
160
|
-
from: :docx,
|
|
161
|
-
name: 'Demo DOCX',
|
|
162
|
-
documents: [{ name: 'Demo DOCX', file: 'base64' }]
|
|
163
|
-
)
|
|
50
|
+
Docuseal.key = 'your_api_key_here'
|
|
164
51
|
```
|
|
165
52
|
|
|
166
|
-
####
|
|
53
|
+
#### EU Cloud
|
|
167
54
|
|
|
168
|
-
|
|
55
|
+
API keys for the EU cloud can be obtained from your [EU DocuSeal Console](https://console.docuseal.eu/api).
|
|
169
56
|
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
from: :html,
|
|
173
|
-
html: '<p>Lorem Ipsum is simply dummy text of the\n<text-field\n name="Industry"\n role="First Party"\n required="false"\n style="width: 80px; height: 16px; display: inline-block; margin-bottom: -4px">\n</text-field>\nand typesetting industry</p>\n',
|
|
174
|
-
name: 'Test Template'
|
|
175
|
-
)
|
|
176
|
-
```
|
|
57
|
+
```ruby
|
|
58
|
+
require 'docuseal'
|
|
177
59
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
Reference: https://www.docuseal.co/docs/api#create-a-template-from-existing-pdf
|
|
181
|
-
|
|
182
|
-
```rb
|
|
183
|
-
template = Docuseal::Template.create(
|
|
184
|
-
from: :pdf,
|
|
185
|
-
name: 'Test PDF',
|
|
186
|
-
documents: [
|
|
187
|
-
{
|
|
188
|
-
name: 'string',
|
|
189
|
-
file: 'base64',
|
|
190
|
-
fields: [{name: 'string', areas: [{x: 0, y: 0, w: 0, h: 0, page: 0}]}]
|
|
191
|
-
}
|
|
192
|
-
]
|
|
193
|
-
)
|
|
60
|
+
Docuseal.key = 'your_api_key_here'
|
|
61
|
+
Docuseal.url = 'https://api.docuseal.eu'
|
|
194
62
|
```
|
|
195
63
|
|
|
196
|
-
####
|
|
197
|
-
|
|
198
|
-
Reference: https://www.docuseal.co/docs/api#clone-a-template
|
|
64
|
+
#### On-Premise
|
|
199
65
|
|
|
200
|
-
|
|
201
|
-
template = Docuseal::Template.clone(1,
|
|
202
|
-
name: 'Clone of Test',
|
|
203
|
-
)
|
|
204
|
-
```
|
|
66
|
+
For on-premise installations, API keys can be retrieved from the API settings page of your deployed application, e.g., https://yourdocusealapp.com/settings/api.
|
|
205
67
|
|
|
206
|
-
|
|
68
|
+
```ruby
|
|
69
|
+
require 'docuseal'
|
|
207
70
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
```rb
|
|
211
|
-
template = Docuseal::Template.update(1,
|
|
212
|
-
name: 'New Document Name',
|
|
213
|
-
folder_name: 'New Folder'
|
|
214
|
-
)
|
|
71
|
+
Docuseal.key = 'your_api_key_here'
|
|
72
|
+
Docuseal.url = 'https://yourdocusealapp.com/api'
|
|
215
73
|
```
|
|
216
74
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
Reference: https://www.docuseal.co/docs/api#update-template-documents
|
|
220
|
-
|
|
221
|
-
```rb
|
|
222
|
-
template = Docuseal::Template.update_documents(1,
|
|
223
|
-
documents: [{file: 'base64'}]
|
|
224
|
-
)
|
|
225
|
-
```
|
|
75
|
+
### Basic Examples
|
|
226
76
|
|
|
227
|
-
####
|
|
77
|
+
#### List Templates
|
|
228
78
|
|
|
229
|
-
|
|
79
|
+
```ruby
|
|
80
|
+
# list templates
|
|
81
|
+
Docuseal.list_templates
|
|
230
82
|
|
|
231
|
-
|
|
232
|
-
|
|
83
|
+
# retrieve single template
|
|
84
|
+
Docuseal.get_template(1)
|
|
233
85
|
```
|
|
234
86
|
|
|
235
|
-
|
|
87
|
+
### Configuring Timeouts
|
|
236
88
|
|
|
237
|
-
|
|
89
|
+
Set timeouts to avoid hanging requests:
|
|
238
90
|
|
|
239
|
-
```
|
|
240
|
-
|
|
91
|
+
```ruby
|
|
92
|
+
Docuseal.open_timeout = 70
|
|
93
|
+
Docuseal.read_timeout = 90
|
|
241
94
|
```
|
|
242
95
|
|
|
243
|
-
|
|
96
|
+
## Support
|
|
244
97
|
|
|
245
|
-
|
|
98
|
+
For feature requests or bug reports, visit our [GitHub Issues page](https://github.com/docusealco/docuseal-ruby/issues).
|
|
246
99
|
|
|
247
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/moraki-finance/docuseal. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/moraki-finance/docuseal/blob/main/CODE_OF_CONDUCT.md).
|
|
248
100
|
|
|
249
101
|
## License
|
|
250
102
|
|
|
251
103
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
252
|
-
|
|
253
|
-
## Code of Conduct
|
|
254
|
-
|
|
255
|
-
Everyone interacting in the Docuseal project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/docuseal/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/docuseal/api.rb
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Docuseal
|
|
4
|
+
class Api
|
|
5
|
+
Error = Class.new(StandardError)
|
|
6
|
+
|
|
7
|
+
attr_reader :http
|
|
8
|
+
|
|
9
|
+
def initialize(config)
|
|
10
|
+
@http = Http.new(config)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def list_templates(params = {})
|
|
14
|
+
http.get('/templates', params)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def get_template(id)
|
|
18
|
+
http.get("/templates/#{id}")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create_template_from_docx(data)
|
|
22
|
+
http.post('/templates/docx', data)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def create_template_from_html(data)
|
|
26
|
+
http.post('/templates/html', data)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def create_template_from_pdf(data)
|
|
30
|
+
http.post('/templates/pdf', data)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def merge_templates(data)
|
|
34
|
+
http.post('/templates/merge', data)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def clone_template(id, data)
|
|
38
|
+
http.post("/templates/#{id}/clone", data)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def update_template(id, data)
|
|
42
|
+
http.put("/templates/#{id}", data)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def update_template_documents(id, data)
|
|
46
|
+
http.put("/templates/#{id}/documents", data)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def archive_template(id)
|
|
50
|
+
http.delete("/templates/#{id}")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def permanently_delete_template(id)
|
|
54
|
+
http.delete("/templates/#{id}", { permanently: true })
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def list_submissions(params = {})
|
|
58
|
+
http.get('/submissions', params)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def get_submission(id)
|
|
62
|
+
http.get("/submissions/#{id}")
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def create_submission(data)
|
|
66
|
+
http.post('/submissions/init', data)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def create_submission_from_emails(data)
|
|
70
|
+
http.post('/submissions/emails', data)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def archive_submission(id)
|
|
74
|
+
http.delete("/submissions/#{id}")
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def permanently_delete_submission(id)
|
|
78
|
+
http.delete("/submissions/#{id}", { permanently: true })
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def list_submitters(params = {})
|
|
82
|
+
http.get('/submitters', params)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def get_submitter(id)
|
|
86
|
+
http.get("/submitters/#{id}")
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def update_submitter(id, data)
|
|
90
|
+
http.put("/submitters/#{id}", data)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
data/lib/docuseal/http.rb
CHANGED
|
@@ -1,62 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
module HTTP
|
|
3
|
-
def get(path, headers: {}, **query)
|
|
4
|
-
full_uri = uri(path:, query:)
|
|
1
|
+
# frozen_string_literal: true
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'cgi'
|
|
5
|
+
require 'uri'
|
|
6
|
+
require 'net/http'
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
module Docuseal
|
|
9
|
+
class Http
|
|
10
|
+
BODY_METHODS = %i[post put].freeze
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
attr_reader :config
|
|
13
|
+
|
|
14
|
+
def initialize(config)
|
|
15
|
+
@config = config
|
|
18
16
|
end
|
|
19
17
|
|
|
20
|
-
def
|
|
21
|
-
|
|
18
|
+
def get(path, params = {})
|
|
19
|
+
send_request(:get, path, params)
|
|
20
|
+
end
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
req.headers = all_headers(headers)
|
|
26
|
-
end
|
|
22
|
+
def post(path, body = {})
|
|
23
|
+
send_request(:post, path, {}, body)
|
|
27
24
|
end
|
|
28
25
|
|
|
29
|
-
def
|
|
30
|
-
|
|
26
|
+
def put(path, body = {})
|
|
27
|
+
send_request(:put, path, {}, body)
|
|
28
|
+
end
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
end
|
|
30
|
+
def delete(path, params = {})
|
|
31
|
+
send_request(:delete, path, params)
|
|
35
32
|
end
|
|
36
33
|
|
|
37
34
|
private
|
|
38
35
|
|
|
39
|
-
def
|
|
40
|
-
|
|
41
|
-
f.options[:timeout] = request_timeout
|
|
42
|
-
f.request :json
|
|
43
|
-
f.response :json
|
|
44
|
-
f.response :raise_error
|
|
45
|
-
end
|
|
36
|
+
def send_request(method, path, params = {}, body = {})
|
|
37
|
+
uri = URI.parse(config[:url] + path)
|
|
46
38
|
|
|
47
|
-
|
|
39
|
+
path = uri.path + to_query(params)
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
resp =
|
|
42
|
+
if BODY_METHODS.include?(method)
|
|
43
|
+
conn(uri).public_send(method, path, body.to_json, headers)
|
|
44
|
+
else
|
|
45
|
+
conn(uri).public_send(method, path, headers)
|
|
46
|
+
end
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
File.join(base_uri, path) + "?#{URI.encode_www_form(query)}"
|
|
48
|
+
handle_response(resp)
|
|
54
49
|
end
|
|
55
50
|
|
|
56
|
-
def
|
|
51
|
+
def headers
|
|
57
52
|
{
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
'X-Auth-Token' => config[:key],
|
|
54
|
+
'Content-Type' => 'application/json'
|
|
55
|
+
}
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def to_query(params)
|
|
59
|
+
return '' if params.empty?
|
|
60
|
+
|
|
61
|
+
"?#{params.map { |key, value| "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}" }.join('&')}"
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def conn(uri)
|
|
65
|
+
conn = Net::HTTP.new(uri.host, uri.port)
|
|
66
|
+
|
|
67
|
+
conn.read_timeout = config[:read_timeout]
|
|
68
|
+
conn.open_timeout = config[:open_timeout]
|
|
69
|
+
|
|
70
|
+
conn.use_ssl = uri.scheme == 'https'
|
|
71
|
+
|
|
72
|
+
conn
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def handle_response(response)
|
|
76
|
+
case response.code.to_i
|
|
77
|
+
when 200..299
|
|
78
|
+
JSON.parse(response.body)
|
|
79
|
+
else
|
|
80
|
+
raise Api::Error, "API Error #{response.code}: #{response.body}"
|
|
81
|
+
end
|
|
60
82
|
end
|
|
61
83
|
end
|
|
62
84
|
end
|
data/lib/docuseal/version.rb
CHANGED
data/lib/docuseal.rb
CHANGED
|
@@ -1,45 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require_relative "docuseal/http"
|
|
4
|
-
require_relative "docuseal/client"
|
|
5
|
-
require_relative "docuseal/model"
|
|
6
|
-
require_relative "docuseal/submission"
|
|
7
|
-
require_relative "docuseal/submitter"
|
|
8
|
-
require_relative "docuseal/template"
|
|
1
|
+
# frozen_string_literal: true
|
|
9
2
|
|
|
10
3
|
module Docuseal
|
|
11
|
-
|
|
4
|
+
autoload :VERSION, 'docuseal/version'
|
|
5
|
+
autoload :Api, 'docuseal/api'
|
|
6
|
+
autoload :Http, 'docuseal/http'
|
|
12
7
|
|
|
13
|
-
|
|
8
|
+
DEFAULT_CONFIG = {
|
|
9
|
+
url: 'https://api.docuseal.com',
|
|
10
|
+
open_timeout: 60,
|
|
11
|
+
read_timeout: 60
|
|
12
|
+
}.freeze
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
Configuration = Struct.new(:key,
|
|
15
|
+
:url,
|
|
16
|
+
:read_timeout,
|
|
17
|
+
:open_timeout, keyword_init: true)
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
class << self
|
|
20
|
+
require 'forwardable'
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
@api_key = ENV["DOCUSEAL_API_KEY"]
|
|
24
|
-
@request_timeout = DEFAULT_REQUEST_TIMEOUT
|
|
25
|
-
@base_uri = ENV.fetch("DOCUSEAL_BASE_URI", DEFAULT_BASE_URI)
|
|
26
|
-
@global_headers = {}
|
|
27
|
-
end
|
|
22
|
+
extend Forwardable
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
def_delegators :api,
|
|
25
|
+
:list_templates,
|
|
26
|
+
:get_template,
|
|
27
|
+
:create_template_from_docx,
|
|
28
|
+
:create_template_from_html,
|
|
29
|
+
:create_template_from_pdf,
|
|
30
|
+
:merge_templates,
|
|
31
|
+
:clone_template,
|
|
32
|
+
:update_template,
|
|
33
|
+
:update_template_documents,
|
|
34
|
+
:archive_template,
|
|
35
|
+
:permanently_delete_template,
|
|
36
|
+
:list_submissions,
|
|
37
|
+
:get_submission,
|
|
38
|
+
:create_submission,
|
|
39
|
+
:create_submission_from_emails,
|
|
40
|
+
:archive_submission,
|
|
41
|
+
:permanently_delete_submission,
|
|
42
|
+
:list_submitters,
|
|
43
|
+
:get_submitter,
|
|
44
|
+
:update_submitter
|
|
45
|
+
|
|
46
|
+
def_delegators :config,
|
|
47
|
+
:key, :key=,
|
|
48
|
+
:url, :url=,
|
|
49
|
+
:open_timeout, :open_timeout=,
|
|
50
|
+
:read_timeout, :read_timeout=
|
|
51
|
+
|
|
52
|
+
def config
|
|
53
|
+
@config ||= Configuration.new(DEFAULT_CONFIG)
|
|
31
54
|
end
|
|
32
|
-
end
|
|
33
55
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
56
|
+
def setup
|
|
57
|
+
config.tap do |instance|
|
|
58
|
+
yield(instance) if block_given?
|
|
59
|
+
end
|
|
60
|
+
end
|
|
37
61
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
end
|
|
62
|
+
def api(config = nil)
|
|
63
|
+
config = config ? DEFAULT_CONFIG.merge(config) : Docuseal.config
|
|
41
64
|
|
|
42
|
-
|
|
43
|
-
|
|
65
|
+
Docuseal::Api.new(config)
|
|
66
|
+
end
|
|
44
67
|
end
|
|
45
68
|
end
|
metadata
CHANGED
|
@@ -1,79 +1,38 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: docuseal
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
8
|
-
autorequire:
|
|
7
|
+
- DocuSeal
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
12
|
-
dependencies:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - ">="
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1'
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - ">="
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: faraday_middleware
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '1'
|
|
34
|
-
type: :runtime
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '1'
|
|
41
|
-
description: A lightway, simple and non-official docuseal API connector.
|
|
11
|
+
date: 2024-12-24 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: DocuSeal is a document signing platform. This gem provides a Ruby interface
|
|
14
|
+
to the DocuSeal API.
|
|
42
15
|
email:
|
|
43
|
-
-
|
|
16
|
+
- support@docuseal.com
|
|
44
17
|
executables: []
|
|
45
18
|
extensions: []
|
|
46
19
|
extra_rdoc_files: []
|
|
47
20
|
files:
|
|
48
|
-
- ".rspec"
|
|
49
|
-
- ".ruby-version"
|
|
50
|
-
- ".standard.yml"
|
|
51
|
-
- ".vscode/settings.json"
|
|
52
|
-
- CHANGELOG.md
|
|
53
|
-
- CODE_OF_CONDUCT.md
|
|
54
|
-
- CONTRIBUTING.md
|
|
55
|
-
- Gemfile
|
|
56
|
-
- Gemfile.lock
|
|
57
|
-
- LICENSE.txt
|
|
58
21
|
- README.md
|
|
59
|
-
- Rakefile
|
|
60
22
|
- lib/docuseal.rb
|
|
61
|
-
- lib/docuseal/
|
|
23
|
+
- lib/docuseal/api.rb
|
|
62
24
|
- lib/docuseal/http.rb
|
|
63
|
-
- lib/docuseal/model.rb
|
|
64
|
-
- lib/docuseal/submission.rb
|
|
65
|
-
- lib/docuseal/submitter.rb
|
|
66
|
-
- lib/docuseal/template.rb
|
|
67
25
|
- lib/docuseal/version.rb
|
|
68
|
-
|
|
69
|
-
homepage: https://github.com/moraki-finance/docuseal
|
|
26
|
+
homepage: https://www.docuseal.com
|
|
70
27
|
licenses:
|
|
71
28
|
- MIT
|
|
72
29
|
metadata:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
30
|
+
bug_tracker_uri: https://github.com/docusealco/docuseal-ruby/issues
|
|
31
|
+
homepage_uri: https://www.docuseal.com
|
|
32
|
+
source_code_uri: https://github.com/docusealco/docuseal-ruby
|
|
33
|
+
documentation_uri: https://www.docuseal.com/docs/api
|
|
34
|
+
rubygems_mfa_required: 'true'
|
|
35
|
+
post_install_message:
|
|
77
36
|
rdoc_options: []
|
|
78
37
|
require_paths:
|
|
79
38
|
- lib
|
|
@@ -81,15 +40,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
81
40
|
requirements:
|
|
82
41
|
- - ">="
|
|
83
42
|
- !ruby/object:Gem::Version
|
|
84
|
-
version:
|
|
43
|
+
version: 2.5.0
|
|
85
44
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
45
|
requirements:
|
|
87
46
|
- - ">="
|
|
88
47
|
- !ruby/object:Gem::Version
|
|
89
48
|
version: '0'
|
|
90
49
|
requirements: []
|
|
91
|
-
rubygems_version: 3.
|
|
92
|
-
signing_key:
|
|
50
|
+
rubygems_version: 3.2.33
|
|
51
|
+
signing_key:
|
|
93
52
|
specification_version: 4
|
|
94
|
-
summary:
|
|
53
|
+
summary: Ruby bindings for DocuSeal API
|
|
95
54
|
test_files: []
|
data/.rspec
DELETED
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.3.0
|
data/.standard.yml
DELETED
data/.vscode/settings.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"rubyLsp.formatter": "none", // Use standard rbfmt instead
|
|
3
|
-
"editor.formatOnSave": true,
|
|
4
|
-
"editor.codeActionsOnSave": {
|
|
5
|
-
"source.organizeImports": "explicit"
|
|
6
|
-
},
|
|
7
|
-
"[ruby]": {
|
|
8
|
-
"editor.defaultFormatter": "testdouble.vscode-standard-ruby"
|
|
9
|
-
},
|
|
10
|
-
"standardRuby.autofix": true
|
|
11
|
-
}
|
data/CHANGELOG.md
DELETED
data/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
-
|
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
-
|
|
9
|
-
## Our Standards
|
|
10
|
-
|
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
-
|
|
13
|
-
* Demonstrating empathy and kindness toward other people
|
|
14
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
-
* Giving and gracefully accepting constructive feedback
|
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
-
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
-
|
|
19
|
-
Examples of unacceptable behavior include:
|
|
20
|
-
|
|
21
|
-
* The use of sexualized language or imagery, and sexual attention or
|
|
22
|
-
advances of any kind
|
|
23
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
24
|
-
* Public or private harassment
|
|
25
|
-
* Publishing others' private information, such as a physical or email
|
|
26
|
-
address, without their explicit permission
|
|
27
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
28
|
-
professional setting
|
|
29
|
-
|
|
30
|
-
## Enforcement Responsibilities
|
|
31
|
-
|
|
32
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
33
|
-
|
|
34
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
35
|
-
|
|
36
|
-
## Scope
|
|
37
|
-
|
|
38
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
39
|
-
|
|
40
|
-
## Enforcement
|
|
41
|
-
|
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at martin.mochetti@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
|
43
|
-
|
|
44
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
45
|
-
|
|
46
|
-
## Enforcement Guidelines
|
|
47
|
-
|
|
48
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
49
|
-
|
|
50
|
-
### 1. Correction
|
|
51
|
-
|
|
52
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
53
|
-
|
|
54
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
55
|
-
|
|
56
|
-
### 2. Warning
|
|
57
|
-
|
|
58
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
|
59
|
-
|
|
60
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
61
|
-
|
|
62
|
-
### 3. Temporary Ban
|
|
63
|
-
|
|
64
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
65
|
-
|
|
66
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
67
|
-
|
|
68
|
-
### 4. Permanent Ban
|
|
69
|
-
|
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
71
|
-
|
|
72
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
73
|
-
|
|
74
|
-
## Attribution
|
|
75
|
-
|
|
76
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
|
77
|
-
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
78
|
-
|
|
79
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
|
80
|
-
|
|
81
|
-
[homepage]: https://www.contributor-covenant.org
|
|
82
|
-
|
|
83
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
|
84
|
-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/CONTRIBUTING.md
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
## Contributing
|
|
2
|
-
|
|
3
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/moraki-finance/docuseal. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/moraki-finance/docuseal/blob/main/CODE_OF_CONDUCT.md).
|
data/Gemfile
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source "https://rubygems.org"
|
|
4
|
-
|
|
5
|
-
# Specify your gem's dependencies in docuseal.gemspec
|
|
6
|
-
gemspec
|
|
7
|
-
|
|
8
|
-
gem "rake", "~> 13.0"
|
|
9
|
-
|
|
10
|
-
gem "rspec", "~> 3.0"
|
|
11
|
-
|
|
12
|
-
gem "standard", "~> 1.3"
|
|
13
|
-
|
|
14
|
-
group :development, :test do
|
|
15
|
-
gem "webmock", "~> 3.22.0"
|
|
16
|
-
gem "byebug", "~> 11.1"
|
|
17
|
-
gem "pry", "~> 0.14.2"
|
|
18
|
-
gem "pry-byebug", "~> 3.10"
|
|
19
|
-
gem "pry-rescue", "~> 1.5"
|
|
20
|
-
gem "pry-stack_explorer", "~> 0.6.1"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
group :test do
|
|
24
|
-
gem "simplecov"
|
|
25
|
-
gem "simplecov-cobertura"
|
|
26
|
-
end
|
data/Gemfile.lock
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
docuseal (0.1.1)
|
|
5
|
-
faraday (>= 1)
|
|
6
|
-
faraday_middleware (>= 1)
|
|
7
|
-
|
|
8
|
-
GEM
|
|
9
|
-
remote: https://rubygems.org/
|
|
10
|
-
specs:
|
|
11
|
-
addressable (2.8.6)
|
|
12
|
-
public_suffix (>= 2.0.2, < 6.0)
|
|
13
|
-
ast (2.4.2)
|
|
14
|
-
bigdecimal (3.1.6)
|
|
15
|
-
binding_of_caller (1.0.0)
|
|
16
|
-
debug_inspector (>= 0.0.1)
|
|
17
|
-
byebug (11.1.3)
|
|
18
|
-
coderay (1.1.3)
|
|
19
|
-
crack (1.0.0)
|
|
20
|
-
bigdecimal
|
|
21
|
-
rexml
|
|
22
|
-
debug_inspector (1.2.0)
|
|
23
|
-
diff-lcs (1.5.1)
|
|
24
|
-
docile (1.4.0)
|
|
25
|
-
faraday (1.10.3)
|
|
26
|
-
faraday-em_http (~> 1.0)
|
|
27
|
-
faraday-em_synchrony (~> 1.0)
|
|
28
|
-
faraday-excon (~> 1.1)
|
|
29
|
-
faraday-httpclient (~> 1.0)
|
|
30
|
-
faraday-multipart (~> 1.0)
|
|
31
|
-
faraday-net_http (~> 1.0)
|
|
32
|
-
faraday-net_http_persistent (~> 1.0)
|
|
33
|
-
faraday-patron (~> 1.0)
|
|
34
|
-
faraday-rack (~> 1.0)
|
|
35
|
-
faraday-retry (~> 1.0)
|
|
36
|
-
ruby2_keywords (>= 0.0.4)
|
|
37
|
-
faraday-em_http (1.0.0)
|
|
38
|
-
faraday-em_synchrony (1.0.0)
|
|
39
|
-
faraday-excon (1.1.0)
|
|
40
|
-
faraday-httpclient (1.0.1)
|
|
41
|
-
faraday-multipart (1.0.4)
|
|
42
|
-
multipart-post (~> 2)
|
|
43
|
-
faraday-net_http (1.0.1)
|
|
44
|
-
faraday-net_http_persistent (1.2.0)
|
|
45
|
-
faraday-patron (1.0.0)
|
|
46
|
-
faraday-rack (1.0.0)
|
|
47
|
-
faraday-retry (1.0.3)
|
|
48
|
-
faraday_middleware (1.2.0)
|
|
49
|
-
faraday (~> 1.0)
|
|
50
|
-
hashdiff (1.1.0)
|
|
51
|
-
interception (0.5)
|
|
52
|
-
json (2.7.1)
|
|
53
|
-
language_server-protocol (3.17.0.3)
|
|
54
|
-
lint_roller (1.1.0)
|
|
55
|
-
method_source (1.0.0)
|
|
56
|
-
multipart-post (2.4.0)
|
|
57
|
-
parallel (1.24.0)
|
|
58
|
-
parser (3.3.0.5)
|
|
59
|
-
ast (~> 2.4.1)
|
|
60
|
-
racc
|
|
61
|
-
pry (0.14.2)
|
|
62
|
-
coderay (~> 1.1)
|
|
63
|
-
method_source (~> 1.0)
|
|
64
|
-
pry-byebug (3.10.1)
|
|
65
|
-
byebug (~> 11.0)
|
|
66
|
-
pry (>= 0.13, < 0.15)
|
|
67
|
-
pry-rescue (1.6.0)
|
|
68
|
-
interception (>= 0.5)
|
|
69
|
-
pry (>= 0.12.0)
|
|
70
|
-
pry-stack_explorer (0.6.1)
|
|
71
|
-
binding_of_caller (~> 1.0)
|
|
72
|
-
pry (~> 0.13)
|
|
73
|
-
public_suffix (5.0.4)
|
|
74
|
-
racc (1.7.3)
|
|
75
|
-
rainbow (3.1.1)
|
|
76
|
-
rake (13.1.0)
|
|
77
|
-
regexp_parser (2.9.0)
|
|
78
|
-
rexml (3.2.6)
|
|
79
|
-
rspec (3.13.0)
|
|
80
|
-
rspec-core (~> 3.13.0)
|
|
81
|
-
rspec-expectations (~> 3.13.0)
|
|
82
|
-
rspec-mocks (~> 3.13.0)
|
|
83
|
-
rspec-core (3.13.0)
|
|
84
|
-
rspec-support (~> 3.13.0)
|
|
85
|
-
rspec-expectations (3.13.0)
|
|
86
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
87
|
-
rspec-support (~> 3.13.0)
|
|
88
|
-
rspec-mocks (3.13.0)
|
|
89
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
90
|
-
rspec-support (~> 3.13.0)
|
|
91
|
-
rspec-support (3.13.0)
|
|
92
|
-
rubocop (1.60.2)
|
|
93
|
-
json (~> 2.3)
|
|
94
|
-
language_server-protocol (>= 3.17.0)
|
|
95
|
-
parallel (~> 1.10)
|
|
96
|
-
parser (>= 3.3.0.2)
|
|
97
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
98
|
-
regexp_parser (>= 1.8, < 3.0)
|
|
99
|
-
rexml (>= 3.2.5, < 4.0)
|
|
100
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
|
101
|
-
ruby-progressbar (~> 1.7)
|
|
102
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
|
103
|
-
rubocop-ast (1.30.0)
|
|
104
|
-
parser (>= 3.2.1.0)
|
|
105
|
-
rubocop-performance (1.20.2)
|
|
106
|
-
rubocop (>= 1.48.1, < 2.0)
|
|
107
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
|
108
|
-
ruby-progressbar (1.13.0)
|
|
109
|
-
ruby2_keywords (0.0.5)
|
|
110
|
-
simplecov (0.22.0)
|
|
111
|
-
docile (~> 1.1)
|
|
112
|
-
simplecov-html (~> 0.11)
|
|
113
|
-
simplecov_json_formatter (~> 0.1)
|
|
114
|
-
simplecov-cobertura (2.1.0)
|
|
115
|
-
rexml
|
|
116
|
-
simplecov (~> 0.19)
|
|
117
|
-
simplecov-html (0.12.3)
|
|
118
|
-
simplecov_json_formatter (0.1.4)
|
|
119
|
-
standard (1.34.0)
|
|
120
|
-
language_server-protocol (~> 3.17.0.2)
|
|
121
|
-
lint_roller (~> 1.0)
|
|
122
|
-
rubocop (~> 1.60)
|
|
123
|
-
standard-custom (~> 1.0.0)
|
|
124
|
-
standard-performance (~> 1.3)
|
|
125
|
-
standard-custom (1.0.2)
|
|
126
|
-
lint_roller (~> 1.0)
|
|
127
|
-
rubocop (~> 1.50)
|
|
128
|
-
standard-performance (1.3.1)
|
|
129
|
-
lint_roller (~> 1.1)
|
|
130
|
-
rubocop-performance (~> 1.20.2)
|
|
131
|
-
unicode-display_width (2.5.0)
|
|
132
|
-
webmock (3.22.0)
|
|
133
|
-
addressable (>= 2.8.0)
|
|
134
|
-
crack (>= 0.3.2)
|
|
135
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
|
136
|
-
|
|
137
|
-
PLATFORMS
|
|
138
|
-
ruby
|
|
139
|
-
x86_64-darwin-23
|
|
140
|
-
|
|
141
|
-
DEPENDENCIES
|
|
142
|
-
byebug (~> 11.1)
|
|
143
|
-
docuseal!
|
|
144
|
-
pry (~> 0.14.2)
|
|
145
|
-
pry-byebug (~> 3.10)
|
|
146
|
-
pry-rescue (~> 1.5)
|
|
147
|
-
pry-stack_explorer (~> 0.6.1)
|
|
148
|
-
rake (~> 13.0)
|
|
149
|
-
rspec (~> 3.0)
|
|
150
|
-
simplecov
|
|
151
|
-
simplecov-cobertura
|
|
152
|
-
standard (~> 1.3)
|
|
153
|
-
webmock (~> 3.22.0)
|
|
154
|
-
|
|
155
|
-
BUNDLED WITH
|
|
156
|
-
2.5.5
|
data/LICENSE.txt
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Martin Mochetti
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
data/Rakefile
DELETED
data/lib/docuseal/client.rb
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
module Docuseal
|
|
2
|
-
class Client
|
|
3
|
-
include Docuseal::HTTP
|
|
4
|
-
|
|
5
|
-
CONFIG_KEYS = %i[
|
|
6
|
-
api_key request_timeout base_uri global_headers
|
|
7
|
-
].freeze
|
|
8
|
-
|
|
9
|
-
attr_reader(*CONFIG_KEYS)
|
|
10
|
-
|
|
11
|
-
def self.instance
|
|
12
|
-
@instance ||= new
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
def initialize
|
|
18
|
-
CONFIG_KEYS.each do |key|
|
|
19
|
-
# Set instance variables like api_type & access_token. Fall back to global config
|
|
20
|
-
# if not present.
|
|
21
|
-
instance_variable_set(:"@#{key}", Docuseal.configuration.send(key))
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
data/lib/docuseal/model.rb
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
module Docuseal
|
|
2
|
-
class Model
|
|
3
|
-
class << self
|
|
4
|
-
def create(path: self.path, **attrs)
|
|
5
|
-
raise Docuseal::Error, "Method not allowed" if not_allowed_to.include?(:create)
|
|
6
|
-
|
|
7
|
-
response = Docuseal::Client.instance.post(path, data: attrs)
|
|
8
|
-
body = response.body
|
|
9
|
-
|
|
10
|
-
return body.map(&self) if body.is_a?(Array)
|
|
11
|
-
|
|
12
|
-
new(body)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def find(id)
|
|
16
|
-
raise Docuseal::Error, "Method not allowed" if not_allowed_to.include?(:find)
|
|
17
|
-
|
|
18
|
-
response = Docuseal::Client.instance.get("#{path}/#{id}")
|
|
19
|
-
new(response.body)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def update(id, **attrs)
|
|
23
|
-
raise Docuseal::Error, "Method not allowed" if not_allowed_to.include?(:update)
|
|
24
|
-
|
|
25
|
-
response = Docuseal::Client.instance.put("#{path}/#{id}", data: attrs)
|
|
26
|
-
new(response.body)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def list(**)
|
|
30
|
-
raise Docuseal::Error, "Method not allowed" if not_allowed_to.include?(:list)
|
|
31
|
-
|
|
32
|
-
response = Docuseal::Client.instance.get(path, **)
|
|
33
|
-
response.body["data"].map(&self)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def archive(id)
|
|
37
|
-
raise Docuseal::Error, "Method not allowed" if not_allowed_to.include?(:archive)
|
|
38
|
-
|
|
39
|
-
response = Docuseal::Client.instance.delete("#{path}/#{id}")
|
|
40
|
-
new(response.body)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# Auxiliary methods
|
|
44
|
-
|
|
45
|
-
def to_proc
|
|
46
|
-
->(attrs) { new(attrs) }
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def skip_coertion_for(attrs = [])
|
|
50
|
-
@skip_coertion_for ||= attrs
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def not_allowed_to(attrs = [])
|
|
54
|
-
@not_allowed_to ||= attrs
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def to_json
|
|
59
|
-
@_raw.to_json
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
protected
|
|
63
|
-
|
|
64
|
-
def initialize(attrs = {})
|
|
65
|
-
@_raw = attrs
|
|
66
|
-
|
|
67
|
-
attrs.each do |key, value|
|
|
68
|
-
if self.class.skip_coertion_for.include?(key.to_sym)
|
|
69
|
-
instance_variable_set(:"@#{key}", value)
|
|
70
|
-
else
|
|
71
|
-
coerced_value = if value.is_a?(Hash)
|
|
72
|
-
Docuseal::Model.new(value)
|
|
73
|
-
elsif value.is_a?(Array)
|
|
74
|
-
value.map do |v|
|
|
75
|
-
v.is_a?(Hash) ? Docuseal::Model.new(v) : v
|
|
76
|
-
end
|
|
77
|
-
else
|
|
78
|
-
value
|
|
79
|
-
end
|
|
80
|
-
instance_variable_set(:"@#{key}", coerced_value)
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
instance_variables.each { |iv| self.class.send(:attr_reader, iv.to_s[1..].to_sym) }
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
data/lib/docuseal/submission.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module Docuseal
|
|
2
|
-
class Submission < Model
|
|
3
|
-
skip_coertion_for [:values]
|
|
4
|
-
not_allowed_to [:update]
|
|
5
|
-
|
|
6
|
-
def self.path
|
|
7
|
-
"/submissions"
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def self.create(from: nil, **attrs)
|
|
11
|
-
if from
|
|
12
|
-
super(path: "#{path}/#{from}", **attrs)
|
|
13
|
-
else
|
|
14
|
-
super(**attrs)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
data/lib/docuseal/submitter.rb
DELETED
data/lib/docuseal/template.rb
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
module Docuseal
|
|
2
|
-
class Template < Model
|
|
3
|
-
def self.path
|
|
4
|
-
"/templates"
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
# from: :html, :docx or :pdf
|
|
8
|
-
#
|
|
9
|
-
# https://www.docuseal.co/docs/api#create-a-template-from-html
|
|
10
|
-
# https://www.docuseal.co/docs/api#create-a-template-from-word-docx
|
|
11
|
-
# https://www.docuseal.co/docs/api#create-a-template-from-existing-pdf
|
|
12
|
-
def self.create(from:, **attrs)
|
|
13
|
-
super(path: "#{path}/#{from}", **attrs)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# https://www.docuseal.co/docs/api#update-template-documents
|
|
17
|
-
def self.update_documents(id, documents: [])
|
|
18
|
-
return if documents.empty?
|
|
19
|
-
response = Docuseal::Client.instance.put("#{path}/#{id}/documents", data: {documents:})
|
|
20
|
-
new(response.body)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# https://www.docuseal.co/docs/api#clone-a-template
|
|
24
|
-
def self.clone(id, **attrs)
|
|
25
|
-
response = Docuseal::Client.instance.post("#{path}/#{id}/clone", data: attrs)
|
|
26
|
-
new(response.body)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
data/sig/docuseal.rbs
DELETED