assinafy 2.3.0 → 2.4.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 +57 -6
- data/README.en.md +164 -1138
- data/README.md +29 -24
- data/docs/API_REFERENCE.md +113 -137
- data/docs/GUIDE.md +1079 -0
- data/lib/assinafy/client.rb +79 -45
- data/lib/assinafy/configuration.rb +8 -7
- data/lib/assinafy/oauth.rb +12 -15
- data/lib/assinafy/resources/account_resource.rb +13 -10
- data/lib/assinafy/resources/assignment_resource.rb +63 -92
- data/lib/assinafy/resources/base_resource.rb +66 -114
- data/lib/assinafy/resources/contract_resource.rb +17 -33
- data/lib/assinafy/resources/document_resource.rb +73 -61
- data/lib/assinafy/resources/envelope_resource.rb +10 -12
- data/lib/assinafy/resources/field_resource.rb +3 -11
- data/lib/assinafy/resources/oauth_resource.rb +26 -20
- data/lib/assinafy/resources/scheduled_send_resource.rb +10 -5
- data/lib/assinafy/resources/signer_document_resource.rb +24 -14
- data/lib/assinafy/resources/signer_resource.rb +46 -72
- data/lib/assinafy/resources/tag_resource.rb +16 -22
- data/lib/assinafy/resources/template_resource.rb +5 -6
- data/lib/assinafy/resources/user_resource.rb +7 -2
- data/lib/assinafy/resources/webhook_resource.rb +55 -47
- data/lib/assinafy/support/webhook_verifier.rb +2 -2
- data/lib/assinafy/utils.rb +14 -21
- data/lib/assinafy/validation.rb +80 -0
- data/lib/assinafy/version.rb +1 -1
- data/lib/assinafy.rb +1 -1
- data/sig/assinafy.rbs +7 -30
- metadata +6 -6
- data/lib/assinafy/resources/auth_resource.rb +0 -502
|
@@ -19,19 +19,20 @@ module Assinafy
|
|
|
19
19
|
#
|
|
20
20
|
# - `Email` — one-time code sent to the signer's email. Free.
|
|
21
21
|
# - `Whatsapp` — one-time code over WhatsApp. The verification itself is
|
|
22
|
-
# not billed, but it requires the WhatsApp notification channel,
|
|
23
|
-
#
|
|
22
|
+
# not billed, but it requires the WhatsApp notification channel, which
|
|
23
|
+
# costs 0.45 credits per signer (0.4 on Pro; paid subscriptions only).
|
|
24
24
|
# - `DigitalCertificate` — the signer signs with their own ICP-Brasil
|
|
25
25
|
# certificate (A1 or A3), producing a qualified PAdES signature.
|
|
26
26
|
# Requires the Digital Certificate feature, a CPF or CNPJ in the
|
|
27
27
|
# signer's `government_id`, and that the signer is alone in its signing
|
|
28
|
-
# step on a virtual assignment. Charged
|
|
29
|
-
# (breakdown code `SignatureDigitalCertificate`)
|
|
30
|
-
# certificate (an e-CPF, or an e-CNPJ naming them as legal
|
|
28
|
+
# step on a virtual assignment. Charged per certificate signer at the plan's price, on top of its
|
|
29
|
+
# notification (breakdown code `SignatureDigitalCertificate`); {#estimate_cost} returns the exact
|
|
30
|
+
# charge. A CPF requires that person's certificate (an e-CPF, or an e-CNPJ naming them as legal
|
|
31
31
|
# representative); a CNPJ requires an e-CNPJ for that company, from any
|
|
32
32
|
# of its representatives.
|
|
33
33
|
# - `IdDocumentFaceMatchBasic` — government ID photos, face match and liveness.
|
|
34
|
-
# Requires its account feature and a valid CPF in `government_id
|
|
34
|
+
# Requires its account feature and a valid CPF in `government_id`. Priced per signer by plan
|
|
35
|
+
# (Free 1.5, Standard 1, Pro 0.5, others 0.25 credits); use {#estimate_cost} for exact prices.
|
|
35
36
|
VERIFICATION_METHODS = %w[Email Whatsapp DigitalCertificate IdDocumentFaceMatchBasic].freeze
|
|
36
37
|
IDENTITY_REVIEW_IMAGES = %w[document_front document_back document_pdf face].freeze
|
|
37
38
|
|
|
@@ -49,11 +50,14 @@ module Assinafy
|
|
|
49
50
|
SIGN_ITEM_KEY_MAP = {
|
|
50
51
|
'item_id' => 'itemId',
|
|
51
52
|
'field_id' => 'fieldId',
|
|
52
|
-
'page_id' => 'pageId'
|
|
53
|
-
'value' => 'value'
|
|
53
|
+
'page_id' => 'pageId'
|
|
54
54
|
}.freeze
|
|
55
|
+
HOSTED_VERIFICATION_METHODS = %w[DigitalCertificate IdDocumentFaceMatchBasic].freeze
|
|
56
|
+
private_constant :HOSTED_VERIFICATION_METHODS
|
|
55
57
|
|
|
56
58
|
class << self
|
|
59
|
+
include Validation
|
|
60
|
+
|
|
57
61
|
# Normalise a flexible Ruby-side assignment payload into the body
|
|
58
62
|
# shape the API expects. Accepts:
|
|
59
63
|
#
|
|
@@ -69,7 +73,8 @@ module Assinafy
|
|
|
69
73
|
# payloads where method-only signer descriptors carry no id
|
|
70
74
|
# @option options [Boolean] :require_signers (true) false for collect estimates without signer IDs
|
|
71
75
|
# @option options [Boolean] :validate_steps (true) false when template role metadata is needed
|
|
72
|
-
# to distinguish signers from copy receivers;
|
|
76
|
+
# to distinguish signers from copy receivers; it also skips the check that a DigitalCertificate
|
|
77
|
+
# signer is alone in its step. Individual steps are always validated
|
|
73
78
|
# @return [Hash] string-keyed body suitable for {#create} / {#estimate_cost}
|
|
74
79
|
# @raise [Assinafy::ValidationError] on missing required fields
|
|
75
80
|
# @example Bare signer IDs are normalised into { id: } hashes (virtual method)
|
|
@@ -143,9 +148,7 @@ module Assinafy
|
|
|
143
148
|
private
|
|
144
149
|
|
|
145
150
|
def validate_method!(method, signers, entries, payload, require_signers)
|
|
146
|
-
|
|
147
|
-
raise ValidationError.new("Assignment method must be one of: #{METHODS.join(', ')}")
|
|
148
|
-
end
|
|
151
|
+
require_one_of(method, METHODS, 'Assignment method')
|
|
149
152
|
if signers.empty? && (require_signers || method == 'virtual')
|
|
150
153
|
raise ValidationError.new(
|
|
151
154
|
'At least one signer is required',
|
|
@@ -162,12 +165,10 @@ module Assinafy
|
|
|
162
165
|
# wrong type here would only fail server-side — after the caller has
|
|
163
166
|
# already uploaded a document and created signers.
|
|
164
167
|
def validate_optional_fields!(payload)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
next if value.nil? || value.is_a?(String)
|
|
168
|
-
|
|
169
|
-
raise ValidationError.new("#{key} must be a String", { key => value })
|
|
168
|
+
unless payload[:message].nil? || payload[:message].is_a?(String)
|
|
169
|
+
raise ValidationError.new('message must be a String', { message: payload[:message] })
|
|
170
170
|
end
|
|
171
|
+
|
|
171
172
|
Utils.require_expiration(payload[:expires_at])
|
|
172
173
|
Utils.require_credit_ceiling(payload[:max_total_credits])
|
|
173
174
|
|
|
@@ -194,11 +195,9 @@ module Assinafy
|
|
|
194
195
|
end
|
|
195
196
|
|
|
196
197
|
page = Utils.body_params(entry)
|
|
197
|
-
|
|
198
|
+
require_string(page['page_id'], 'Collect page ID')
|
|
198
199
|
fields = page['fields']
|
|
199
|
-
|
|
200
|
-
raise ValidationError.new('Collect fields must be a non-empty Array')
|
|
201
|
-
end
|
|
200
|
+
raise ValidationError.new('Collect fields must be an Array') unless fields.is_a?(Array)
|
|
202
201
|
|
|
203
202
|
fields.map { |field| validate_collect_field!(field, signer_ids) }
|
|
204
203
|
end
|
|
@@ -210,7 +209,7 @@ module Assinafy
|
|
|
210
209
|
def validate_collect_field!(field, signer_ids)
|
|
211
210
|
raise ValidationError.new('Collect field must be a Hash') unless field.is_a?(Hash)
|
|
212
211
|
|
|
213
|
-
|
|
212
|
+
require_string(field['field_id'], 'Collect field ID')
|
|
214
213
|
unless signer_ids.include?(field['signer_id'])
|
|
215
214
|
raise ValidationError.new('Collect field signer must appear in signers')
|
|
216
215
|
end
|
|
@@ -227,12 +226,6 @@ module Assinafy
|
|
|
227
226
|
field['signer_id']
|
|
228
227
|
end
|
|
229
228
|
|
|
230
|
-
def require_payload_id!(value, name)
|
|
231
|
-
return if value.is_a?(String) && !value.strip.empty?
|
|
232
|
-
|
|
233
|
-
raise ValidationError.new("#{name} must be a non-empty String")
|
|
234
|
-
end
|
|
235
|
-
|
|
236
229
|
def extract_signer_refs(payload)
|
|
237
230
|
return payload[:signers] if payload[:signers].is_a?(Array) && !payload[:signers].empty?
|
|
238
231
|
|
|
@@ -241,18 +234,12 @@ module Assinafy
|
|
|
241
234
|
end
|
|
242
235
|
|
|
243
236
|
def normalise_signer_ref(ref, options)
|
|
244
|
-
return
|
|
237
|
+
return { id: require_string(ref, 'Signer ID') } if ref.is_a?(String)
|
|
245
238
|
return hash_signer_ref(ref, options) if ref.is_a?(Hash)
|
|
246
239
|
|
|
247
240
|
raise ValidationError.new('Invalid signer reference', { ref: ref })
|
|
248
241
|
end
|
|
249
242
|
|
|
250
|
-
def string_signer_ref(ref)
|
|
251
|
-
raise ValidationError.new('Signer ID cannot be empty') if ref.strip.empty?
|
|
252
|
-
|
|
253
|
-
{ id: ref }
|
|
254
|
-
end
|
|
255
|
-
|
|
256
243
|
def hash_signer_ref(ref, options)
|
|
257
244
|
r = ref.transform_keys(&:to_sym)
|
|
258
245
|
id = r[:id] || r[:signer_id]
|
|
@@ -270,8 +257,10 @@ module Assinafy
|
|
|
270
257
|
normalised[:verification_method] = verification_method!(r) unless r[:verification_method].nil?
|
|
271
258
|
normalised[:notification_methods] = notification_methods!(r) unless r[:notification_methods].nil?
|
|
272
259
|
normalised[:step] = signer_step!(r[:step]) unless r[:step].nil?
|
|
273
|
-
normalised[:embedded] = embedded_signer!(r)
|
|
274
|
-
|
|
260
|
+
normalised[:embedded] = embedded_signer!(r) unless r[:embedded].nil?
|
|
261
|
+
unless r[:sign_as].nil?
|
|
262
|
+
normalised[:sign_as] = require_one_of(r[:sign_as], SIGNER_CAPACITIES, 'sign_as')
|
|
263
|
+
end
|
|
275
264
|
validate_method_pair!(normalised)
|
|
276
265
|
|
|
277
266
|
normalised
|
|
@@ -282,13 +271,7 @@ module Assinafy
|
|
|
282
271
|
# for it already exist. Checking locally keeps the failure cheap and
|
|
283
272
|
# names the accepted values.
|
|
284
273
|
def verification_method!(ref)
|
|
285
|
-
|
|
286
|
-
return value if VERIFICATION_METHODS.include?(value)
|
|
287
|
-
|
|
288
|
-
raise ValidationError.new(
|
|
289
|
-
"verification_method must be one of: #{VERIFICATION_METHODS.join(', ')}",
|
|
290
|
-
{ verification_method: value }
|
|
291
|
-
)
|
|
274
|
+
require_one_of(ref[:verification_method], VERIFICATION_METHODS, 'verification_method')
|
|
292
275
|
end
|
|
293
276
|
|
|
294
277
|
def notification_methods!(ref)
|
|
@@ -304,9 +287,8 @@ module Assinafy
|
|
|
304
287
|
end
|
|
305
288
|
|
|
306
289
|
def embedded_signer!(ref)
|
|
307
|
-
value = ref[:embedded]
|
|
308
|
-
|
|
309
|
-
if value && %w[DigitalCertificate IdDocumentFaceMatchBasic].include?(ref[:verification_method])
|
|
290
|
+
value = require_boolean(ref[:embedded], 'embedded')
|
|
291
|
+
if value && HOSTED_VERIFICATION_METHODS.include?(ref[:verification_method])
|
|
310
292
|
raise ValidationError.new('Embedded signing requires Email or Whatsapp verification')
|
|
311
293
|
end
|
|
312
294
|
|
|
@@ -319,17 +301,10 @@ module Assinafy
|
|
|
319
301
|
raise ValidationError.new('step must be a positive Integer', { step: step })
|
|
320
302
|
end
|
|
321
303
|
|
|
322
|
-
def signer_capacity!(value)
|
|
323
|
-
return value if SIGNER_CAPACITIES.include?(value)
|
|
324
|
-
|
|
325
|
-
raise ValidationError.new("sign_as must be one of: #{SIGNER_CAPACITIES.join(', ')}")
|
|
326
|
-
end
|
|
327
|
-
|
|
328
304
|
def validate_method_pair!(signer)
|
|
329
305
|
verification = signer[:verification_method]
|
|
330
306
|
notification = signer[:notification_methods]&.first
|
|
331
|
-
return if verification.nil? || notification.nil? ||
|
|
332
|
-
%w[DigitalCertificate IdDocumentFaceMatchBasic].include?(verification)
|
|
307
|
+
return if verification.nil? || notification.nil? || HOSTED_VERIFICATION_METHODS.include?(verification)
|
|
333
308
|
return if verification == notification
|
|
334
309
|
|
|
335
310
|
raise ValidationError.new('notification_methods must match the verification_method')
|
|
@@ -370,9 +345,10 @@ module Assinafy
|
|
|
370
345
|
|
|
371
346
|
# List assignments for an account. API keys need accountId; OAuth tokens can infer their workspace.
|
|
372
347
|
#
|
|
373
|
-
# @param params [Hash] documented `page` and `per_page` query parameters
|
|
348
|
+
# @param params [Hash] documented `sort`, `page` and `per_page` query parameters
|
|
374
349
|
# @param account_id_override [String, nil]
|
|
375
|
-
# @return [Hash{Symbol=>Array,Hash}] `{ data: [assignment, ...], meta: {..}
|
|
350
|
+
# @return [Hash{Symbol=>Array,Hash}] `{ data: [assignment, ...], meta: {..} }`; the `meta` key is
|
|
351
|
+
# left out, not nil, when the response carries no pagination headers
|
|
376
352
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
377
353
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
378
354
|
# @raise [Assinafy::ValidationError] on invalid required input
|
|
@@ -419,7 +395,8 @@ module Assinafy
|
|
|
419
395
|
# @param payload [Hash]
|
|
420
396
|
# @return [Hash] the assignment object (resource, id, method, expires_at, message, signers[],
|
|
421
397
|
# items[], summary{signer_count, completed_count, signers[]}, signing_urls[], copy_receivers[])
|
|
422
|
-
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
398
|
+
# @raise [Assinafy::ApiError] on an unsuccessful API response; `429` (`FreePlanEmailLimit`, with
|
|
399
|
+
# Retry-After) once a free plan reaches its daily signer email limit
|
|
423
400
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
424
401
|
# @raise [Assinafy::ValidationError] on invalid required input
|
|
425
402
|
# @see POST /documents/{documentId}/assignments
|
|
@@ -446,7 +423,7 @@ module Assinafy
|
|
|
446
423
|
# # "display_settings" => [], "value" => nil, "completed" => false }],
|
|
447
424
|
# # "summary" => { "signer_count" => 1, "completed_count" => 0, "signers" => [{ ... }] },
|
|
448
425
|
# # "signing_urls" => [{ "signer_id" => "signer-id",
|
|
449
|
-
# # "url" => "https://app
|
|
426
|
+
# # "url" => "https://app.assinafy.com.br/sign/document-id?email=signer%40example.com" }]
|
|
450
427
|
# # } # ... (see docs for full shape)
|
|
451
428
|
def create(document_id, payload)
|
|
452
429
|
doc_id = require_id(document_id, 'Document ID')
|
|
@@ -460,7 +437,6 @@ module Assinafy
|
|
|
460
437
|
end
|
|
461
438
|
|
|
462
439
|
# Schedule an assignment without creating or charging it now. Requires documents:write.
|
|
463
|
-
# Available on staging; the environment must publish scheduled sends.
|
|
464
440
|
# @param document_id [String]
|
|
465
441
|
# @param payload [Hash] the same assignment payload as create, including sign_as when needed
|
|
466
442
|
# @param send_at [String, Integer] from one hour to 90 days ahead; absent offset means UTC
|
|
@@ -476,6 +452,7 @@ module Assinafy
|
|
|
476
452
|
# # => { 'resource' => 'scheduled_send', 'id' => 'send-id', 'type' => 'assignment',
|
|
477
453
|
# # 'document_ids' => ['document-id'], 'status' => 'pending', 'send_at' => '2026-12-01T12:00:00Z',
|
|
478
454
|
# # 'assignment_id' => nil, 'envelope_id' => nil, 'failure_reason' => nil,
|
|
455
|
+
# # 'next_attempt_at' => nil,
|
|
479
456
|
# # 'created_at' => '2026-12-01T10:00:00Z', 'processed_at' => nil }
|
|
480
457
|
def schedule(document_id, payload, send_at:)
|
|
481
458
|
id = require_id(document_id, 'Document ID')
|
|
@@ -577,13 +554,9 @@ module Assinafy
|
|
|
577
554
|
# # (no request body)
|
|
578
555
|
# # => { "is_sent" => true, "document_id" => "document-id", "signer_id" => "signer-id" }
|
|
579
556
|
def resend_notification(document_id, assignment_id, signer_id)
|
|
580
|
-
|
|
581
|
-
asg_id = require_id(assignment_id, 'Assignment ID')
|
|
582
|
-
sid = require_id(signer_id, 'Signer ID')
|
|
557
|
+
path = signer_path(document_id, assignment_id, signer_id)
|
|
583
558
|
|
|
584
|
-
call('Failed to resend signer notification')
|
|
585
|
-
http_put("documents/#{doc_id}/assignments/#{asg_id}/signers/#{sid}/resend")
|
|
586
|
-
end
|
|
559
|
+
call('Failed to resend signer notification') { http_put("#{path}/resend") }
|
|
587
560
|
end
|
|
588
561
|
|
|
589
562
|
# Estimate the credit cost of resending the notification to a signer.
|
|
@@ -608,13 +581,9 @@ module Assinafy
|
|
|
608
581
|
# # "has_sufficient_credits" => true
|
|
609
582
|
# # }
|
|
610
583
|
def estimate_resend_cost(document_id, assignment_id, signer_id)
|
|
611
|
-
|
|
612
|
-
asg_id = require_id(assignment_id, 'Assignment ID')
|
|
613
|
-
sid = require_id(signer_id, 'Signer ID')
|
|
584
|
+
path = signer_path(document_id, assignment_id, signer_id)
|
|
614
585
|
|
|
615
|
-
call('Failed to estimate resend cost')
|
|
616
|
-
http_post("documents/#{doc_id}/assignments/#{asg_id}/signers/#{sid}/estimate-resend-cost")
|
|
617
|
-
end
|
|
586
|
+
call('Failed to estimate resend cost') { http_post("#{path}/estimate-resend-cost") }
|
|
618
587
|
end
|
|
619
588
|
|
|
620
589
|
# Read the account review of a signer's biometric identity verification.
|
|
@@ -642,7 +611,7 @@ module Assinafy
|
|
|
642
611
|
# # 'ruleset_version' => '2026-10-12.2', 'evidence_sha256' => 'sha256-placeholder',
|
|
643
612
|
# # 'reviewed_by' => nil, 'reviewed_at' => nil, 'review_note' => nil, 'completed_at' => nil }
|
|
644
613
|
def identity_review(document_id, assignment_id, signer_id)
|
|
645
|
-
path =
|
|
614
|
+
path = "#{signer_path(document_id, assignment_id, signer_id)}/identity-verification"
|
|
646
615
|
|
|
647
616
|
call('Failed to fetch signer identity review') { http_get(path) }
|
|
648
617
|
end
|
|
@@ -658,15 +627,14 @@ module Assinafy
|
|
|
658
627
|
# @raise [Assinafy::ApiError] on failure; 404 after a decision or when evidence is unavailable
|
|
659
628
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
660
629
|
# @raise [Assinafy::ValidationError] on invalid IDs or image name
|
|
661
|
-
# @see GET
|
|
630
|
+
# @see GET
|
|
631
|
+
# /documents/{documentId}/assignments/{assignmentId}/signers/{signerId}/identity-verification/images/{name}
|
|
662
632
|
# @example Read the face image (no request body; workspace credentials)
|
|
663
633
|
# client.assignments.identity_review_image('document-id', 'assignment-id', 'signer-id', 'face')
|
|
664
634
|
# # => "\x89PNG\r\n\x1A\n..." # binary String
|
|
665
635
|
def identity_review_image(document_id, assignment_id, signer_id, name)
|
|
666
|
-
path =
|
|
667
|
-
|
|
668
|
-
raise ValidationError.new("Image name must be one of: #{IDENTITY_REVIEW_IMAGES.join(', ')}")
|
|
669
|
-
end
|
|
636
|
+
path = "#{signer_path(document_id, assignment_id, signer_id)}/identity-verification"
|
|
637
|
+
require_one_of(name, IDENTITY_REVIEW_IMAGES, 'Image name')
|
|
670
638
|
|
|
671
639
|
call_binary('Failed to download signer identity review image') { http_get("#{path}/images/#{name}") }
|
|
672
640
|
end
|
|
@@ -693,10 +661,8 @@ module Assinafy
|
|
|
693
661
|
# # 'reviewed_by' => { 'id' => 'user-id', 'name' => 'Example Reviewer' },
|
|
694
662
|
# # 'reviewed_at' => '2026-10-16T12:00:00Z', 'review_note' => 'Identity checked'
|
|
695
663
|
def decide_identity_review(document_id, assignment_id, signer_id, decision:, note: nil)
|
|
696
|
-
path =
|
|
697
|
-
|
|
698
|
-
raise ValidationError.new('Decision must be Approved or Rejected')
|
|
699
|
-
end
|
|
664
|
+
path = "#{signer_path(document_id, assignment_id, signer_id)}/identity-verification"
|
|
665
|
+
require_one_of(decision, %w[Approved Rejected], 'Decision')
|
|
700
666
|
unless note.nil? || (note.is_a?(String) && note.length <= 2000)
|
|
701
667
|
raise ValidationError.new('Review note must be a String of at most 2000 characters')
|
|
702
668
|
end
|
|
@@ -721,13 +687,9 @@ module Assinafy
|
|
|
721
687
|
# # => { 'url' => 'https://app.assinafy.com.br/embed/session-token',
|
|
722
688
|
# # 'expires_at' => '2026-11-11T12:05:00Z' }
|
|
723
689
|
def create_embed_session(document_id, assignment_id, signer_id)
|
|
724
|
-
|
|
725
|
-
asg_id = require_id(assignment_id, 'Assignment ID')
|
|
726
|
-
sid = require_id(signer_id, 'Signer ID')
|
|
690
|
+
path = signer_path(document_id, assignment_id, signer_id)
|
|
727
691
|
|
|
728
|
-
call('Failed to create embed session')
|
|
729
|
-
http_post("documents/#{doc_id}/assignments/#{asg_id}/signers/#{sid}/embed-sessions")
|
|
730
|
-
end
|
|
692
|
+
call('Failed to create embed session') { http_post("#{path}/embed-sessions") }
|
|
731
693
|
end
|
|
732
694
|
|
|
733
695
|
# Exchange the token on Assinafy's embed page. Integrations normally load the session URL instead.
|
|
@@ -780,12 +742,21 @@ module Assinafy
|
|
|
780
742
|
# # "thumbnail" => "https://.../thumbnail" },
|
|
781
743
|
# # "is_closed" => false, "signing_url" => "%ui_base_url%/sign/doc1",
|
|
782
744
|
# # "decline_reason" => nil, "declined_by" => nil,
|
|
745
|
+
# # "is_signer_access_closed" => false,
|
|
746
|
+
# # "certified_copy" => { "available" => false, "notification_method" => "Email",
|
|
747
|
+
# # "resends_left" => nil },
|
|
783
748
|
# # "current_signer" => { "id" => "signer-id", "full_name" => "Signer Name",
|
|
784
|
-
# # "email" => "signer@example.com", "has_accepted_terms" => false,
|
|
749
|
+
# # "email" => "signer@example.com", "has_accepted_terms" => false, "completed" => false,
|
|
785
750
|
# # "verification_method" => "Email", "notification_methods" => ["Email"] },
|
|
786
751
|
# # "assignment" => { "id" => "1", "method" => "virtual", "expires_at" => nil,
|
|
787
752
|
# # "items" => [{ "id" => "assignment-item-id", "field" => { "type" => "virtual" }, ... }] }
|
|
788
753
|
# # } # ... (see docs for full shape)
|
|
754
|
+
# # Once the signer's access has closed, only the status remains:
|
|
755
|
+
# # => { "id" => "document-id", "name" => "my_document.pdf", "status" => "certificated",
|
|
756
|
+
# # "is_signer_access_closed" => true,
|
|
757
|
+
# # "certified_copy" => { "available" => true, "notification_method" => "Email",
|
|
758
|
+
# # "resends_left" => nil },
|
|
759
|
+
# # "current_signer" => { "completed" => true } }
|
|
789
760
|
def signer_document(signer_access_code:, has_accepted_terms: nil, expand: nil, document_id: nil)
|
|
790
761
|
access_code = require_signer_access_code(signer_access_code)
|
|
791
762
|
accepted = has_accepted_terms.nil? ? nil : require_boolean(has_accepted_terms, 'has_accepted_terms')
|
|
@@ -812,7 +783,7 @@ module Assinafy
|
|
|
812
783
|
# @param assignment_id [String]
|
|
813
784
|
# @param items [Array<Hash>] [] for virtual; the API validates required collect values
|
|
814
785
|
# @param signer_access_code [String]
|
|
815
|
-
# @return [Hash] signing result
|
|
786
|
+
# @return [Hash] signing result: the signer's assignment with only their items,
|
|
816
787
|
# without signing URLs or other parties' contact details and government IDs
|
|
817
788
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
818
789
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
@@ -905,11 +876,11 @@ module Assinafy
|
|
|
905
876
|
|
|
906
877
|
private
|
|
907
878
|
|
|
908
|
-
def
|
|
879
|
+
def signer_path(document_id, assignment_id, signer_id)
|
|
909
880
|
doc_id = require_id(document_id, 'Document ID')
|
|
910
881
|
asg_id = require_id(assignment_id, 'Assignment ID')
|
|
911
882
|
sid = require_id(signer_id, 'Signer ID')
|
|
912
|
-
"documents/#{doc_id}/assignments/#{asg_id}/signers/#{sid}
|
|
883
|
+
"documents/#{doc_id}/assignments/#{asg_id}/signers/#{sid}"
|
|
913
884
|
end
|
|
914
885
|
|
|
915
886
|
def normalise_sign_item(item)
|