assinafy 2.1.1 → 2.3.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/CHANGELOG.md +37 -0
- data/README.en.md +243 -32
- data/README.md +26 -9
- data/docs/API_REFERENCE.md +1085 -663
- data/lib/assinafy/client.rb +6 -0
- data/lib/assinafy/configuration.rb +3 -3
- data/lib/assinafy/errors.rb +3 -2
- data/lib/assinafy/resources/account_resource.rb +190 -2
- data/lib/assinafy/resources/assignment_resource.rb +206 -31
- data/lib/assinafy/resources/base_resource.rb +32 -1
- data/lib/assinafy/resources/contract_resource.rb +14 -5
- data/lib/assinafy/resources/document_resource.rb +170 -31
- data/lib/assinafy/resources/envelope_resource.rb +362 -0
- data/lib/assinafy/resources/field_resource.rb +7 -9
- data/lib/assinafy/resources/oauth_resource.rb +6 -0
- data/lib/assinafy/resources/scheduled_send_resource.rb +122 -0
- data/lib/assinafy/resources/signer_document_resource.rb +93 -26
- data/lib/assinafy/resources/signer_resource.rb +79 -37
- data/lib/assinafy/resources/user_resource.rb +46 -12
- data/lib/assinafy/resources/webhook_resource.rb +38 -6
- data/lib/assinafy/utils.rb +17 -0
- data/lib/assinafy/version.rb +1 -1
- data/lib/assinafy.rb +2 -0
- data/sig/assinafy.rbs +72 -14
- metadata +6 -3
|
@@ -77,7 +77,7 @@ module Assinafy
|
|
|
77
77
|
|
|
78
78
|
# List documents for an account.
|
|
79
79
|
#
|
|
80
|
-
# @param params [Hash]
|
|
80
|
+
# @param params [Hash] `status`, `method`, `search`, `sort`, `tags`, `envelope_id`, `page`, `per_page`.
|
|
81
81
|
# `tags` is a comma-separated String of tag IDs or an Array of them; documents must carry every tag.
|
|
82
82
|
# @param account_id_override [String, nil]
|
|
83
83
|
# @return [Hash{Symbol=>Array,Hash}] `{ data: [...], meta: { current_page:, per_page:, total:, last_page: } }`
|
|
@@ -124,6 +124,7 @@ module Assinafy
|
|
|
124
124
|
acc_id = account_id(account_id_override)
|
|
125
125
|
query = require_payload(params, 'Query parameters').transform_keys(&:to_sym)
|
|
126
126
|
query[:tags] = query[:tags].join(',') if query[:tags].is_a?(Array)
|
|
127
|
+
require_string(query[:envelope_id], 'Envelope ID') unless query[:envelope_id].nil?
|
|
127
128
|
|
|
128
129
|
call_list('Failed to list documents') do
|
|
129
130
|
http_get("accounts/#{acc_id}/documents", query)
|
|
@@ -166,7 +167,8 @@ module Assinafy
|
|
|
166
167
|
# }
|
|
167
168
|
def search(query = nil, params = {}, account_id_override = nil)
|
|
168
169
|
acc_id = account_id(account_id_override)
|
|
169
|
-
filters = require_payload(params, 'Document search parameters')
|
|
170
|
+
filters = require_payload(params, 'Document search parameters').transform_keys(&:to_sym)
|
|
171
|
+
require_string(filters[:envelope_id], 'Envelope ID') unless filters[:envelope_id].nil?
|
|
170
172
|
require_string(query, 'Search query') unless query.nil?
|
|
171
173
|
|
|
172
174
|
call_list('Failed to search documents') do
|
|
@@ -212,6 +214,7 @@ module Assinafy
|
|
|
212
214
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
213
215
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
214
216
|
# @raise [Assinafy::ValidationError] on invalid required input
|
|
217
|
+
# @param expand [String, Array<String>, nil] `envelope_id`, `envelope`, or both comma-separated
|
|
215
218
|
# @see GET /documents/{document_id}
|
|
216
219
|
# @example Fetch a document
|
|
217
220
|
# # Request: GET /documents/{document_id}
|
|
@@ -243,11 +246,12 @@ module Assinafy
|
|
|
243
246
|
# 'created_at' => '2026-06-05T21:21:12Z',
|
|
244
247
|
# 'updated_at' => '2026-06-05T21:21:15Z'
|
|
245
248
|
# }
|
|
246
|
-
def details(document_id)
|
|
249
|
+
def details(document_id, expand: nil)
|
|
247
250
|
doc_id = require_id(document_id, 'Document ID')
|
|
251
|
+
expansions = document_expansions(expand)
|
|
248
252
|
|
|
249
253
|
call('Failed to fetch document details') do
|
|
250
|
-
http_get("documents/#{doc_id}")
|
|
254
|
+
http_get("documents/#{doc_id}", { expand: expansions })
|
|
251
255
|
end
|
|
252
256
|
end
|
|
253
257
|
|
|
@@ -387,6 +391,9 @@ module Assinafy
|
|
|
387
391
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
388
392
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
389
393
|
# @raise [Assinafy::ValidationError] on invalid required input
|
|
394
|
+
# @param artifact [String, nil] `certificated` renders signatures and stamps; other values use the original
|
|
395
|
+
# @note Signed renders require a certificated document and workspace credentials. Rendering can answer
|
|
396
|
+
# 503 with Retry-After; the SDK does not retry. Do not cache signed renders.
|
|
390
397
|
# @see GET /documents/{document_id}/thumbnail
|
|
391
398
|
# @example Download the thumbnail and save it
|
|
392
399
|
# # Request: GET /documents/{document_id}/thumbnail
|
|
@@ -396,11 +403,12 @@ module Assinafy
|
|
|
396
403
|
# bytes.class # => String
|
|
397
404
|
# bytes.byteslice(0, 4) # => "\xFF\xD8\xFF\xE0" (JPEG magic bytes)
|
|
398
405
|
# File.binwrite('thumb.jpg', bytes)
|
|
399
|
-
def thumbnail(document_id)
|
|
406
|
+
def thumbnail(document_id, artifact: nil)
|
|
407
|
+
require_string(artifact, 'Artifact') unless artifact.nil?
|
|
400
408
|
doc_id = require_id(document_id, 'Document ID')
|
|
401
409
|
|
|
402
410
|
call_binary('Failed to download document thumbnail') do
|
|
403
|
-
http_get("documents/#{doc_id}/thumbnail")
|
|
411
|
+
http_get("documents/#{doc_id}/thumbnail", { artifact: artifact })
|
|
404
412
|
end
|
|
405
413
|
end
|
|
406
414
|
|
|
@@ -412,6 +420,10 @@ module Assinafy
|
|
|
412
420
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
413
421
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
414
422
|
# @raise [Assinafy::ValidationError] on invalid required input
|
|
423
|
+
# @param artifact [String, nil] `certificated` renders signatures and stamps; other values use the original
|
|
424
|
+
# @note Signed renders require a certificated document and workspace credentials. Rendering can answer
|
|
425
|
+
# 503 with Retry-After; the SDK does not retry. Certificate pages have no page ID.
|
|
426
|
+
# Digital-certificate seals are visible only in the pades artifact. Do not cache signed renders.
|
|
415
427
|
# @see GET /documents/{document_id}/pages/{page_id}/download
|
|
416
428
|
# @example Download a single page image
|
|
417
429
|
# # Request: GET /documents/{document_id}/pages/{page_id}/download
|
|
@@ -421,22 +433,24 @@ module Assinafy
|
|
|
421
433
|
# # Response: raw image bytes (NOT a JSON envelope):
|
|
422
434
|
# bytes.class # => String
|
|
423
435
|
# File.binwrite('page-1.png', bytes)
|
|
424
|
-
def download_page(document_id, page_id)
|
|
436
|
+
def download_page(document_id, page_id, artifact: nil)
|
|
437
|
+
require_string(artifact, 'Artifact') unless artifact.nil?
|
|
425
438
|
doc_id = require_id(document_id, 'Document ID')
|
|
426
439
|
pid = require_id(page_id, 'Page ID')
|
|
427
440
|
|
|
428
441
|
call_binary('Failed to download page') do
|
|
429
|
-
http_get("documents/#{doc_id}/pages/#{pid}/download")
|
|
442
|
+
http_get("documents/#{doc_id}/pages/#{pid}/download", { artifact: artifact })
|
|
430
443
|
end
|
|
431
444
|
end
|
|
432
445
|
|
|
433
|
-
#
|
|
446
|
+
# Read one page of document activities as an Array. Use {#activities_page} for pagination metadata.
|
|
434
447
|
#
|
|
435
448
|
# @param document_id [String]
|
|
436
449
|
# @return [Array<Hash>] newest-first activity entries (empty Array when there are none)
|
|
437
450
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
438
451
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
439
452
|
# @raise [Assinafy::ValidationError] on invalid required input
|
|
453
|
+
# @param params [Hash] `sort` (`id` or `-id`), `page`, `per_page`
|
|
440
454
|
# @see GET /documents/{documentId}/activities
|
|
441
455
|
# @example List a document's activity log
|
|
442
456
|
# # Request: GET /documents/{document_id}/activities
|
|
@@ -461,11 +475,30 @@ module Assinafy
|
|
|
461
475
|
# 'created_at' => '2026-06-05T21:21:13Z'
|
|
462
476
|
# }
|
|
463
477
|
# ]
|
|
464
|
-
def activities(document_id)
|
|
465
|
-
|
|
478
|
+
def activities(document_id, params = {})
|
|
479
|
+
activities_page(document_id, params).fetch(:data)
|
|
480
|
+
end
|
|
466
481
|
|
|
467
|
-
|
|
468
|
-
|
|
482
|
+
# Read document activities together with pagination metadata (20 entries per page by default).
|
|
483
|
+
#
|
|
484
|
+
# @param document_id [String]
|
|
485
|
+
# @param params [Hash] `sort` (`id` or `-id`), `page`, `per_page`
|
|
486
|
+
# @return [Hash] `{ data: [DocumentActivity, ...], meta: { current_page:, per_page:, total:, last_page: } }`
|
|
487
|
+
# @raise [Assinafy::ValidationError] on invalid document ID or query parameters
|
|
488
|
+
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
489
|
+
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
490
|
+
# @see GET /documents/{documentId}/activities
|
|
491
|
+
# @example Read the oldest activities and their pagination headers
|
|
492
|
+
# client.documents.activities_page('document-id', sort: 'id', page: 1, per_page: 20)
|
|
493
|
+
# # Request: GET /documents/document-id/activities?sort=id&page=1&per-page=20 (no body)
|
|
494
|
+
# # => { data: [{ 'id' => 1, 'event' => 'document_uploaded', 'message' => 'Document created.',
|
|
495
|
+
# # 'payload' => [], 'origin' => nil, 'created_at' => '2026-11-04T12:00:00Z' }],
|
|
496
|
+
# # meta: { current_page: 1, per_page: 20, total: 1, last_page: 1 } }
|
|
497
|
+
def activities_page(document_id, params = {})
|
|
498
|
+
doc_id = require_id(document_id, 'Document ID')
|
|
499
|
+
query = activity_params(params)
|
|
500
|
+
call_list('Failed to fetch document activities') do
|
|
501
|
+
http_get("documents/#{doc_id}/activities", query)
|
|
469
502
|
end
|
|
470
503
|
end
|
|
471
504
|
|
|
@@ -491,15 +524,21 @@ module Assinafy
|
|
|
491
524
|
end
|
|
492
525
|
end
|
|
493
526
|
|
|
494
|
-
# Create a document from a template
|
|
527
|
+
# Create a document from a template; its assignment is created asynchronously.
|
|
528
|
+
# Poll until pending_signature or failed. Placed signer fields use collect; DigitalCertificate
|
|
529
|
+
# requires a template without those fields. Editor roles are filled through editor_fields.
|
|
530
|
+
# The server validates signing-step relationships using the template's role types; copy receivers
|
|
531
|
+
# do not participate in signing steps.
|
|
495
532
|
#
|
|
496
533
|
# @param template_id [String]
|
|
497
|
-
# @param signers_or_payload [Array<Hash>, Hash] signer references (`role_id` + `id`)
|
|
534
|
+
# @param signers_or_payload [Array<Hash>, Hash] signer references (`role_id` + `id` or `email`)
|
|
498
535
|
# or a full payload Hash. When a Hash is passed, `options` is merged into it.
|
|
499
536
|
# @param options [Hash] additional body fields (`name`, `message`,
|
|
500
|
-
# `editor_fields`, `expires_at`, ...)
|
|
537
|
+
# `editor_fields`, `expires_at`, `max_total_credits`, ...)
|
|
538
|
+
# @option options [String] :idempotency_key sent as Idempotency-Key, never in the JSON body;
|
|
539
|
+
# also accepted in a full payload Hash, with options taking precedence
|
|
501
540
|
# @param account_id_override [String, nil]
|
|
502
|
-
# @return [Hash] document
|
|
541
|
+
# @return [Hash] uploaded document with assignment: nil until background processing finishes
|
|
503
542
|
#
|
|
504
543
|
# @raise [Assinafy::ApiError] on an unsuccessful API response
|
|
505
544
|
# @raise [Assinafy::NetworkError] on transport or TLS failure
|
|
@@ -531,15 +570,7 @@ module Assinafy
|
|
|
531
570
|
# 'template_id' => 'template-id',
|
|
532
571
|
# 'name' => 'sample-contract.pdf',
|
|
533
572
|
# 'status' => 'uploaded',
|
|
534
|
-
# 'assignment' =>
|
|
535
|
-
# 'id' => 'assignment-id',
|
|
536
|
-
# 'method' => 'virtual',
|
|
537
|
-
# 'signers' => [{ 'id' => 'fa8c140c...', 'full_name' => 'Suzana Cordeiro',
|
|
538
|
-
# 'email' => 'signer@example.com', 'has_accepted_terms' => false }],
|
|
539
|
-
# 'summary' => { 'signer_count' => 1, 'completed_count' => 0, 'signers' => [] },
|
|
540
|
-
# 'signing_urls' => [{ 'signer_id' => 'customid1', 'url' => 'https://.../sign/...' }]
|
|
541
|
-
# # ... (also items, copy_receivers, expires_at, message)
|
|
542
|
-
# },
|
|
573
|
+
# 'assignment' => nil,
|
|
543
574
|
# 'tags' => [{ 'id' => 'ab12cd34...', 'name' => 'Onboarding' }],
|
|
544
575
|
# 'created_at' => '2024-07-23T15:05:17Z',
|
|
545
576
|
# 'updated_at' => '2024-07-23T15:05:17Z'
|
|
@@ -548,12 +579,14 @@ module Assinafy
|
|
|
548
579
|
def create_from_template(template_id, signers_or_payload, options = {}, account_id_override = nil)
|
|
549
580
|
tmpl_id = require_id(template_id, 'Template ID')
|
|
550
581
|
acc_id = account_id(account_id_override)
|
|
582
|
+
options = require_payload(options, 'Template document options').transform_keys(&:to_s)
|
|
551
583
|
body = template_body(signers_or_payload, options, require_signer_id: true)
|
|
584
|
+
headers = idempotency_headers(body.delete('idempotency_key'))
|
|
552
585
|
|
|
553
586
|
@logger.info("Creating document from template #{tmpl_id} for account #{acc_id}")
|
|
554
587
|
|
|
555
588
|
call('Failed to create document from template') do
|
|
556
|
-
http_post("accounts/#{acc_id}/templates/#{tmpl_id}/documents", body)
|
|
589
|
+
http_post("accounts/#{acc_id}/templates/#{tmpl_id}/documents", body, headers: headers)
|
|
557
590
|
end
|
|
558
591
|
end
|
|
559
592
|
|
|
@@ -884,8 +917,107 @@ module Assinafy
|
|
|
884
917
|
{ signed: signed, total: total, pending: pending, percentage: percentage }
|
|
885
918
|
end
|
|
886
919
|
|
|
920
|
+
# Read the sender's stated signing capacities. Available on staging; requires documents:read.
|
|
921
|
+
# @param document_id [String]
|
|
922
|
+
# @return [Array<Hash>] signer_id and sign_as, or [] before assignment creation
|
|
923
|
+
# @raise [ValidationError] on an invalid ID
|
|
924
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
925
|
+
# @see GET /documents/{documentId}/signer-capacities
|
|
926
|
+
# @example
|
|
927
|
+
# client.documents.signer_capacities('document-id') # GET; no body
|
|
928
|
+
# # => [{ 'signer_id' => 'signer-id', 'sign_as' => 'Witness' }]
|
|
929
|
+
def signer_capacities(document_id)
|
|
930
|
+
id = require_id(document_id, 'Document ID')
|
|
931
|
+
call_array('Failed to read signer capacities') { http_get("documents/#{id}/signer-capacities") }
|
|
932
|
+
end
|
|
933
|
+
|
|
934
|
+
# Read invitation delivery/open timestamps. Opens are hints, not proof a person read the message.
|
|
935
|
+
# Available on staging; requires documents:read.
|
|
936
|
+
# @param document_id [String]
|
|
937
|
+
# @return [Array<Hash>] signer_id and notification_history, or [] before assignment creation
|
|
938
|
+
# @raise [ValidationError] on an invalid ID
|
|
939
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
940
|
+
# @see GET /documents/{documentId}/notification-history
|
|
941
|
+
# @example
|
|
942
|
+
# client.documents.notification_history('document-id') # GET; no body
|
|
943
|
+
# # => [{ 'signer_id' => 'signer-id', 'notification_history' => [{ 'event' => 'signature_request',
|
|
944
|
+
# # 'status' => 'sent', 'error_code' => nil, 'error_message' => nil, 'failed_at' => nil,
|
|
945
|
+
# # 'sent_at' => '2026-12-01T12:00:00Z', 'delivered_at' => nil, 'opened_at' => nil }] }]
|
|
946
|
+
def notification_history(document_id)
|
|
947
|
+
id = require_id(document_id, 'Document ID')
|
|
948
|
+
call_array('Failed to read notification history') { http_get("documents/#{id}/notification-history") }
|
|
949
|
+
end
|
|
950
|
+
|
|
951
|
+
# Read contacts following this document without signing. Available on staging; requires documents:read.
|
|
952
|
+
# @param document_id [String]
|
|
953
|
+
# @return [Array<Hash>] Signer objects, in configured order, excluding deleted contacts
|
|
954
|
+
# @raise [ValidationError] on an invalid ID
|
|
955
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
956
|
+
# @see GET /documents/{documentId}/watchers
|
|
957
|
+
# @example
|
|
958
|
+
# client.documents.watchers('document-id') # GET; no body
|
|
959
|
+
# # => [{ 'id' => 'contact-id', 'full_name' => 'Example Watcher', 'email' => 'watcher@example.com',
|
|
960
|
+
# # 'whatsapp_phone_number' => nil, 'government_id' => nil, 'has_accepted_terms' => false }]
|
|
961
|
+
def watchers(document_id)
|
|
962
|
+
id = require_id(document_id, 'Document ID')
|
|
963
|
+
call_array('Failed to read document watchers') { http_get("documents/#{id}/watchers") }
|
|
964
|
+
end
|
|
965
|
+
|
|
966
|
+
# Replace watchers before a document ends. They receive a completion/decline/expiry email without a file/link.
|
|
967
|
+
# Available on staging; requires documents:write. Workspace notification policy does not suppress these emails.
|
|
968
|
+
# @param document_id [String]
|
|
969
|
+
# @param watcher_ids [Array<String>] at most ten workspace contact IDs with email; [] clears all
|
|
970
|
+
# @return [Array<Hash>] Signer objects, as returned by watchers
|
|
971
|
+
# @raise [ValidationError] on invalid IDs or list shape
|
|
972
|
+
# @raise [ApiError, NetworkError] on API or transport failure
|
|
973
|
+
# @see PUT /documents/{documentId}/watchers
|
|
974
|
+
# @example
|
|
975
|
+
# client.documents.set_watchers('document-id', ['contact-id'])
|
|
976
|
+
# # PUT body: { "watcher_ids": ["contact-id"] }
|
|
977
|
+
# # => [{ 'id' => 'contact-id', 'full_name' => 'Example Watcher', 'email' => 'watcher@example.com',
|
|
978
|
+
# # 'whatsapp_phone_number' => nil, 'government_id' => nil, 'has_accepted_terms' => false }]
|
|
979
|
+
def set_watchers(document_id, watcher_ids)
|
|
980
|
+
id = require_id(document_id, 'Document ID')
|
|
981
|
+
unless watcher_ids.is_a?(Array) && watcher_ids.length <= 10
|
|
982
|
+
raise ValidationError.new('watcher_ids must be an Array with at most ten contacts')
|
|
983
|
+
end
|
|
984
|
+
|
|
985
|
+
watcher_ids.each { |watcher| require_id(watcher, 'Watcher ID') }
|
|
986
|
+
call_array('Failed to set document watchers') do
|
|
987
|
+
http_put("documents/#{id}/watchers", { 'watcher_ids' => watcher_ids })
|
|
988
|
+
end
|
|
989
|
+
end
|
|
990
|
+
|
|
887
991
|
private
|
|
888
992
|
|
|
993
|
+
def document_expansions(expand)
|
|
994
|
+
return nil if expand.nil?
|
|
995
|
+
|
|
996
|
+
values = expand.is_a?(String) ? expand.split(',', -1) : expand
|
|
997
|
+
unless values.is_a?(Array) && !values.empty? && (values - %w[envelope_id envelope]).empty?
|
|
998
|
+
raise ValidationError.new('expand must contain envelope_id and/or envelope')
|
|
999
|
+
end
|
|
1000
|
+
|
|
1001
|
+
values.join(',')
|
|
1002
|
+
end
|
|
1003
|
+
|
|
1004
|
+
def activity_params(params)
|
|
1005
|
+
query = query_params(require_payload(params, 'Activity parameters'))
|
|
1006
|
+
if query.key?('sort') && !%w[id -id].include?(query['sort'])
|
|
1007
|
+
raise ValidationError.new('Activity sort must be id or -id')
|
|
1008
|
+
end
|
|
1009
|
+
|
|
1010
|
+
%w[page per-page].each do |key|
|
|
1011
|
+
next unless query.key?(key)
|
|
1012
|
+
|
|
1013
|
+
value = query[key]
|
|
1014
|
+
unless value.is_a?(Integer) && value > 0 && (key != 'per-page' || value <= 100)
|
|
1015
|
+
raise ValidationError.new("#{key} must be a positive Integer (per_page at most 100)")
|
|
1016
|
+
end
|
|
1017
|
+
end
|
|
1018
|
+
query
|
|
1019
|
+
end
|
|
1020
|
+
|
|
889
1021
|
def uploaded_document_id(document)
|
|
890
1022
|
id = document['id'] if document.is_a?(Hash)
|
|
891
1023
|
require_id(id, 'Uploaded document ID')
|
|
@@ -919,8 +1051,9 @@ module Assinafy
|
|
|
919
1051
|
body = body_params(body)
|
|
920
1052
|
validate_template_signers!(body['signers'], require_signer_id)
|
|
921
1053
|
normalised = AssignmentResource.build_payload(
|
|
922
|
-
{ signers: body['signers'], expires_at: body['expires_at'], message: body['message']
|
|
923
|
-
|
|
1054
|
+
{ signers: body['signers'], expires_at: body['expires_at'], message: body['message'],
|
|
1055
|
+
max_total_credits: body['max_total_credits'] },
|
|
1056
|
+
allow_signers_without_id: true, validate_steps: false
|
|
924
1057
|
)
|
|
925
1058
|
body['signers'].zip(normalised['signers']).each { |signer, ref| signer.merge!(ref) }
|
|
926
1059
|
validate_editor_fields!(body['editor_fields']) if body.key?('editor_fields')
|
|
@@ -931,7 +1064,13 @@ module Assinafy
|
|
|
931
1064
|
require_array(signers, 'Signers').each do |signer|
|
|
932
1065
|
require_payload(signer, 'Signer')
|
|
933
1066
|
require_id(signer['role_id'], 'Template role ID')
|
|
934
|
-
|
|
1067
|
+
if signer.key?('id')
|
|
1068
|
+
require_id(signer['id'], 'Signer ID')
|
|
1069
|
+
elsif require_signer_id
|
|
1070
|
+
Utils.require_email(signer['email'])
|
|
1071
|
+
require_string(signer['name'], 'Signer name') if signer.key?('name')
|
|
1072
|
+
require_string(signer['whatsapp_phone_number'], 'WhatsApp number') if signer.key?('whatsapp_phone_number')
|
|
1073
|
+
end
|
|
935
1074
|
end
|
|
936
1075
|
%w[role_id id].each do |key|
|
|
937
1076
|
values = signers.filter_map { |signer| signer[key] }
|
|
@@ -945,7 +1084,7 @@ module Assinafy
|
|
|
945
1084
|
fields.each do |field|
|
|
946
1085
|
require_payload(field, 'Editor field')
|
|
947
1086
|
require_id(field['field_id'], 'Editor field ID')
|
|
948
|
-
|
|
1087
|
+
require_string(field['value'], 'Editor field value')
|
|
949
1088
|
end
|
|
950
1089
|
end
|
|
951
1090
|
|