assinafy 2.0.1 → 2.1.1
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/CHANGELOG.md +23 -0
- data/README.en.md +27 -4
- data/README.md +100 -1047
- data/docs/API_REFERENCE.md +154 -18
- data/lib/assinafy/client.rb +4 -0
- data/lib/assinafy/resources/account_resource.rb +2 -1
- data/lib/assinafy/resources/assignment_resource.rb +10 -11
- data/lib/assinafy/resources/base_resource.rb +3 -0
- data/lib/assinafy/resources/contract_resource.rb +450 -0
- data/lib/assinafy/resources/document_resource.rb +3 -0
- data/lib/assinafy/resources/field_resource.rb +2 -0
- data/lib/assinafy/resources/signer_resource.rb +3 -0
- data/lib/assinafy/resources/tag_resource.rb +5 -1
- data/lib/assinafy/resources/user_resource.rb +19 -7
- data/lib/assinafy/resources/webhook_resource.rb +35 -5
- data/lib/assinafy/version.rb +1 -1
- data/lib/assinafy.rb +1 -0
- data/sig/assinafy.rbs +18 -0
- metadata +4 -3
|
@@ -28,7 +28,8 @@ module Assinafy
|
|
|
28
28
|
# @option payload [Array<String>] :events event-type IDs (see {#list_event_types})
|
|
29
29
|
# @option payload [Boolean] :is_active default `true` when omitted
|
|
30
30
|
# @param account_id_override [String, nil]
|
|
31
|
-
# @return [Hash] the subscription object: { events:, is_active:, url:, email:,
|
|
31
|
+
# @return [Hash] the subscription object: { events:, is_active:, is_held:, held_since:, url:, email:,
|
|
32
|
+
# updated_at: }
|
|
32
33
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
33
34
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
34
35
|
# @raise [Assinafy::ValidationError] on invalid required input
|
|
@@ -51,6 +52,8 @@ module Assinafy
|
|
|
51
52
|
# # {
|
|
52
53
|
# # 'events' => ["document_ready", "document_prepared"],
|
|
53
54
|
# # 'is_active' => true,
|
|
55
|
+
# # 'is_held' => false,
|
|
56
|
+
# # 'held_since' => nil,
|
|
54
57
|
# # 'url' => "https://example.com/webhook",
|
|
55
58
|
# # 'email' => "ops@example.com",
|
|
56
59
|
# # 'updated_at' => "2026-06-05T21:13:24Z"
|
|
@@ -84,6 +87,8 @@ module Assinafy
|
|
|
84
87
|
# # {
|
|
85
88
|
# # 'events' => ["document_ready", "signer_signed_document"],
|
|
86
89
|
# # 'is_active' => false,
|
|
90
|
+
# # 'is_held' => false,
|
|
91
|
+
# # 'held_since' => nil,
|
|
87
92
|
# # 'url' => "https://example.com/sdk-smoke-webhook",
|
|
88
93
|
# # 'email' => "webhook@example.com",
|
|
89
94
|
# # 'updated_at' => "2026-06-05T21:13:24Z"
|
|
@@ -113,6 +118,8 @@ module Assinafy
|
|
|
113
118
|
# # {
|
|
114
119
|
# # 'events' => ["document_ready", "document_prepared"],
|
|
115
120
|
# # 'is_active' => false,
|
|
121
|
+
# # 'is_held' => false,
|
|
122
|
+
# # 'held_since' => nil,
|
|
116
123
|
# # 'url' => "https://example.com/webhook",
|
|
117
124
|
# # 'email' => "ops@example.com",
|
|
118
125
|
# # 'updated_at' => "2026-06-05T21:13:24Z"
|
|
@@ -178,6 +185,10 @@ module Assinafy
|
|
|
178
185
|
# # endpoint: "https://example.com/webhook",
|
|
179
186
|
# # payload: { 'id' => 15431, event: "signature_requested", object: {}, subject: {}, payload: {} },
|
|
180
187
|
# # delivered: false,
|
|
188
|
+
# # webhook_id: "webhook-id-placeholder",
|
|
189
|
+
# # attempt: 2,
|
|
190
|
+
# # kind: "scheduled",
|
|
191
|
+
# # will_retry: false,
|
|
181
192
|
# # http_status: 404,
|
|
182
193
|
# # response_body: "{\"success\":false,...}",
|
|
183
194
|
# # error: "Client error: `POST https://example.com/webhook` resulted in a 404 ...",
|
|
@@ -217,6 +228,10 @@ module Assinafy
|
|
|
217
228
|
# # endpoint: "https://example.com/webhook",
|
|
218
229
|
# # payload: { 'id' => 15431, event: "signature_requested", object: {}, subject: {} },
|
|
219
230
|
# # delivered: true,
|
|
231
|
+
# # webhook_id: "webhook-id-placeholder",
|
|
232
|
+
# # attempt: 1,
|
|
233
|
+
# # kind: "manual",
|
|
234
|
+
# # will_retry: false,
|
|
220
235
|
# # http_status: 200,
|
|
221
236
|
# # response_body: "OK",
|
|
222
237
|
# # error: nil,
|
|
@@ -247,12 +262,15 @@ module Assinafy
|
|
|
247
262
|
# # => unwrapped data payload returned:
|
|
248
263
|
# # [
|
|
249
264
|
# # {
|
|
265
|
+
# # 'resource' => "activity_event_subscription",
|
|
250
266
|
# # 'id' => "webhook-endpoint-id",
|
|
251
267
|
# # 'name' => "ERP",
|
|
252
268
|
# # 'url' => "https://example.com/webhooks/assinafy",
|
|
253
269
|
# # 'email' => "ops@example.com",
|
|
254
270
|
# # 'events' => ["document_ready", "signer_signed_document"],
|
|
255
271
|
# # 'is_active' => true,
|
|
272
|
+
# # 'is_held' => false,
|
|
273
|
+
# # 'held_since' => nil,
|
|
256
274
|
# # 'signing_enabled' => true,
|
|
257
275
|
# # 'created_at' => "2026-10-01T12:00:00Z",
|
|
258
276
|
# # 'updated_at' => "2026-10-01T12:00:00Z"
|
|
@@ -274,7 +292,7 @@ module Assinafy
|
|
|
274
292
|
# especially for OAuth apps, which cannot call {#endpoint_secret}.
|
|
275
293
|
#
|
|
276
294
|
# @param payload [Hash]
|
|
277
|
-
# @option payload [String] :url
|
|
295
|
+
# @option payload [String] :url HTTPS URL that receives the events (required)
|
|
278
296
|
# @option payload [String] :email contact email for delivery-failure notices (required)
|
|
279
297
|
# @option payload [Array<String>] :events event-type IDs (see {#list_event_types}) (required)
|
|
280
298
|
# @option payload [String] :name label to tell endpoints apart
|
|
@@ -304,8 +322,10 @@ module Assinafy
|
|
|
304
322
|
# # "signing_enabled": true
|
|
305
323
|
# # }
|
|
306
324
|
# # => unwrapped data payload returned (same shape as {#list_endpoints} entries):
|
|
307
|
-
# # { '
|
|
308
|
-
# # '
|
|
325
|
+
# # { 'resource' => "activity_event_subscription", 'id' => "webhook-endpoint-id", 'name' => "ERP",
|
|
326
|
+
# # 'url' => "https://example.com/webhooks/assinafy", 'email' => "ops@example.com",
|
|
327
|
+
# # 'events' => [...], 'is_active' => true, 'is_held' => false, 'held_since' => nil,
|
|
328
|
+
# # 'signing_enabled' => true,
|
|
309
329
|
# # 'created_at' => "2026-10-01T12:00:00Z", 'updated_at' => "2026-10-01T12:00:00Z",
|
|
310
330
|
# # 'secret' => 'whsec_secret-placeholder' } # secret appears only on creation with signing enabled
|
|
311
331
|
def create_endpoint(payload, account_id_override = nil)
|
|
@@ -481,7 +501,7 @@ module Assinafy
|
|
|
481
501
|
end
|
|
482
502
|
|
|
483
503
|
def validate_webhook_fields!(body)
|
|
484
|
-
|
|
504
|
+
validate_webhook_url!(body[:url]) if body.key?(:url)
|
|
485
505
|
Utils.require_email(body[:email]) if body.key?(:email)
|
|
486
506
|
require_string(body[:name], 'Webhook name') if body.key?(:name)
|
|
487
507
|
%i[is_active signing_enabled].each { |key| require_boolean(body[key], key.to_s) if body.key?(key) }
|
|
@@ -492,6 +512,16 @@ module Assinafy
|
|
|
492
512
|
|
|
493
513
|
raise ValidationError.new('Webhook events must be non-empty Strings')
|
|
494
514
|
end
|
|
515
|
+
|
|
516
|
+
def validate_webhook_url!(value)
|
|
517
|
+
url = require_string(value, 'Webhook URL')
|
|
518
|
+
uri = URI.parse(url)
|
|
519
|
+
return if uri.is_a?(URI::HTTPS) && uri.host && !uri.host.empty?
|
|
520
|
+
|
|
521
|
+
raise ValidationError.new('Webhook URL must be an absolute HTTPS URL')
|
|
522
|
+
rescue URI::InvalidURIError
|
|
523
|
+
raise ValidationError.new('Webhook URL must be an absolute HTTPS URL')
|
|
524
|
+
end
|
|
495
525
|
end
|
|
496
526
|
end
|
|
497
527
|
end
|
data/lib/assinafy/version.rb
CHANGED
data/lib/assinafy.rb
CHANGED
|
@@ -17,6 +17,7 @@ require_relative 'assinafy/resources/oauth_resource'
|
|
|
17
17
|
require_relative 'assinafy/resources/account_resource'
|
|
18
18
|
require_relative 'assinafy/resources/user_resource'
|
|
19
19
|
require_relative 'assinafy/resources/document_resource'
|
|
20
|
+
require_relative 'assinafy/resources/contract_resource'
|
|
20
21
|
require_relative 'assinafy/resources/signer_resource'
|
|
21
22
|
require_relative 'assinafy/resources/signer_document_resource'
|
|
22
23
|
require_relative 'assinafy/resources/assignment_resource'
|
data/sig/assinafy.rbs
CHANGED
|
@@ -283,6 +283,23 @@ module Assinafy
|
|
|
283
283
|
def signing_progress: (String document_id) -> signing_progress
|
|
284
284
|
end
|
|
285
285
|
|
|
286
|
+
class ContractResource < BaseResource
|
|
287
|
+
STATUSES: Array[String]
|
|
288
|
+
RELATION_TYPES: Array[String]
|
|
289
|
+
SORTS: Array[String]
|
|
290
|
+
LIST_FIELDS: Array[String]
|
|
291
|
+
UPDATE_FIELDS: Array[String]
|
|
292
|
+
RENEW_FIELDS: Array[String]
|
|
293
|
+
TERMINATE_FIELDS: Array[String]
|
|
294
|
+
|
|
295
|
+
def list: (?params params, ?String? account_id_override) -> list_result
|
|
296
|
+
def get: (String document_id, ?String? account_id_override) -> api_object?
|
|
297
|
+
def update: (String document_id, params payload, ?String? account_id_override) -> api_object
|
|
298
|
+
def related: (String document_id, ?String? account_id_override) -> api_object?
|
|
299
|
+
def renew: (String document_id, params payload, ?String? account_id_override) -> api_object
|
|
300
|
+
def terminate: (String document_id, ?params payload, ?String? account_id_override) -> api_object
|
|
301
|
+
end
|
|
302
|
+
|
|
286
303
|
class SignerResource < BaseResource
|
|
287
304
|
EMAIL_REGEX: Regexp
|
|
288
305
|
SIGNATURE_TYPES: Array[String]
|
|
@@ -445,6 +462,7 @@ module Assinafy
|
|
|
445
462
|
attr_reader accounts: Resources::AccountResource
|
|
446
463
|
attr_reader users: Resources::UserResource
|
|
447
464
|
attr_reader documents: Resources::DocumentResource
|
|
465
|
+
attr_reader contracts: Resources::ContractResource
|
|
448
466
|
attr_reader signers: Resources::SignerResource
|
|
449
467
|
attr_reader signer_documents: Resources::SignerDocumentResource
|
|
450
468
|
attr_reader assignments: Resources::AssignmentResource
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: assinafy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Assinafy SDK Contributors
|
|
@@ -134,8 +134,8 @@ dependencies:
|
|
|
134
134
|
- !ruby/object:Gem::Version
|
|
135
135
|
version: '3.0'
|
|
136
136
|
description: Ruby SDK for Assinafy. Covers the documented authentication, OAuth 2.1,
|
|
137
|
-
account, user, document, signer, assignment, webhook, template, tag, and
|
|
138
|
-
plus the high-level upload_and_request_signatures helper.
|
|
137
|
+
account, user, document, contract, signer, assignment, webhook, template, tag, and
|
|
138
|
+
field APIs, plus the high-level upload_and_request_signatures helper.
|
|
139
139
|
email:
|
|
140
140
|
- sdk@assinafy.com.br
|
|
141
141
|
executables: []
|
|
@@ -157,6 +157,7 @@ files:
|
|
|
157
157
|
- lib/assinafy/resources/assignment_resource.rb
|
|
158
158
|
- lib/assinafy/resources/auth_resource.rb
|
|
159
159
|
- lib/assinafy/resources/base_resource.rb
|
|
160
|
+
- lib/assinafy/resources/contract_resource.rb
|
|
160
161
|
- lib/assinafy/resources/document_resource.rb
|
|
161
162
|
- lib/assinafy/resources/field_resource.rb
|
|
162
163
|
- lib/assinafy/resources/oauth_resource.rb
|