Class: GroupDocs::Signature::Envelope
- Inherits:
-
Api::Entity
- Object
- Api::Entity
- GroupDocs::Signature::Envelope
- Extended by:
- ResourceMethods
- Includes:
- Api::Helpers::SignaturePublic, DocumentMethods, EntityFields, EntityMethods, FieldMethods, RecipientMethods
- Defined in:
- lib/groupdocs/signature/envelope.rb
Defined Under Namespace
Classes: Log
Constant Summary collapse
- STATUSES =
{ :draft => -1, :annotation => 0, :in_progress => 1, :expired => 2, :canceled => 3, :failed => 4, :completed => 5, :archived => 6, :scheduled => 99, }
Instance Attribute Summary collapse
- #attachSignedDocument ⇒ Object
- #canBeCommented ⇒ Object
- #creationDateTime ⇒ Object
- #enableTypedSignature ⇒ Object
- #enableUploadedSignature ⇒ Object
- #envelopeExpireTime ⇒ Object
- #includeViewLink ⇒ Object
- #inPersonSign ⇒ Object
- #isDemo ⇒ Object
-
#lockDuringSign ⇒ Object
added in release 1.9.0.
- #ownerName ⇒ Object
- #requestUserAuthByPhoto ⇒ Object
- #requireUserAuthForSign ⇒ Object
- #showRecipientCommentInSignedDocument ⇒ Object
-
#status ⇒ Symbol
Converts status to human-readable format.
- #statusDateTime ⇒ Object
- #tags ⇒ Object
-
#updatedDateTime ⇒ Object
added in release 1.7.0.
Attributes included from EntityFields
#documentsCount, #documentsPages, #emailBody, #emailSubject, #id, #name, #orderedSignature, #ownerGuid, #ownerId, #ownerShouldSign, #recipients, #reminderTime, #stepExpireTime, #waterMarkImage, #waterMarkText
Class Method Summary collapse
-
.all!(options = {}, access = {}) ⇒ Array<GroupDocs::Signature::Envelope>
Changed in release 1.7.0.
-
.for_me!(options = {}, access = {}) ⇒ Array<GroupDocs::Signature::Envelope>
Returns a list of all envelopes where user is recipient.
Instance Method Summary collapse
-
#add_recipient!(recipient, access = {}) ⇒ Object
Changed in release 1.5.8.
-
#archive!(access = {}) ⇒ Object
Archives completed envelope.
-
#cancel!(access = {}) ⇒ Object
Cancel envelope.
-
#date!(recipient, field, access = {}) ⇒ Array
Changed in release 1.5.8.
-
#decline!(recipient, access = {}) ⇒ Object
Declines envelope.
-
#delegate_recipient!(old, new, access = {}) ⇒ Object
Delegates recipient to another one.
-
#fill_field!(value, field, document, recipient, options = {}, access = {}) ⇒ GroupDocs::Signature::Field
Fills field with value.
-
#get_envelope!(path, document, access = {}) ⇒ Object
Get signed envelope document.
-
#logs!(access = {}) ⇒ Array<GroupDocs::Signature::Envelope::Log>
Returns a list of audit logs.
-
#modify_field_location!(location, field, document, recipient, order, access = {}) ⇒ Object
Modify signature envelope field location.
-
#modify_recipient!(recipient, access = {}) ⇒ Object
Modify recipient of envelope.
-
#public_get!(recipient, access = {}) ⇒ Array
Changed in release 1.5.8.
-
#public_signed_documents!(path, recipient, access = {}) ⇒ Array
Changed in release 1.5.8.
-
#resend!(access = {}) ⇒ Object
added in release 1.6.0.
-
#restart!(access = {}) ⇒ Object
Restarts expired envelope.
-
#retry!(access = {}) ⇒ Object
Retry sign envelope.
-
#send!(webhook = {}, access = {}) ⇒ Object
Sends envelope.
-
#sign!(recipient, settings = {}, options = {}, access = {}) ⇒ Object
Changed in release 1.7.0.
-
#signed_document!(document, path, access = {}) ⇒ String
Path to file.
-
#signed_documents!(path, access = {}) ⇒ String
Downloads signed documents to given path.
-
#update_envelope!(template, access = {}) ⇒ Array
Update envelope.
Methods included from ResourceMethods
Methods included from RecipientMethods
#recipients!, #remove_recipient!
Methods included from FieldMethods
#add_field!, #assign_field!, #delete_field!, #delete_field_location!, #fields!, #modify_field!
Methods included from EntityMethods
#create!, #delete!, included, #modify!, #rename!
Methods included from Api::Helpers::Accessor
Methods included from DocumentMethods
#add_document!, #documents!, #remove_document!, #rename_document!
Methods inherited from Api::Entity
#initialize, #inspect, #to_hash
Constructor Details
This class inherits a constructor from GroupDocs::Api::Entity
Instance Attribute Details
#attachSignedDocument ⇒ Object
104 105 106 |
# File 'lib/groupdocs/signature/envelope.rb', line 104 def attachSignedDocument @attachSignedDocument end |
#canBeCommented ⇒ Object
108 109 110 |
# File 'lib/groupdocs/signature/envelope.rb', line 108 def canBeCommented @canBeCommented end |
#creationDateTime ⇒ Object
90 91 92 |
# File 'lib/groupdocs/signature/envelope.rb', line 90 def creationDateTime @creationDateTime end |
#enableTypedSignature ⇒ Object
114 115 116 |
# File 'lib/groupdocs/signature/envelope.rb', line 114 def enableTypedSignature @enableTypedSignature end |
#enableUploadedSignature ⇒ Object
116 117 118 |
# File 'lib/groupdocs/signature/envelope.rb', line 116 def enableUploadedSignature @enableUploadedSignature end |
#envelopeExpireTime ⇒ Object
96 97 98 |
# File 'lib/groupdocs/signature/envelope.rb', line 96 def envelopeExpireTime @envelopeExpireTime end |
#includeViewLink ⇒ Object
106 107 108 |
# File 'lib/groupdocs/signature/envelope.rb', line 106 def includeViewLink @includeViewLink end |
#inPersonSign ⇒ Object
110 111 112 |
# File 'lib/groupdocs/signature/envelope.rb', line 110 def inPersonSign @inPersonSign end |
#isDemo ⇒ Object
98 99 100 |
# File 'lib/groupdocs/signature/envelope.rb', line 98 def isDemo @isDemo end |
#lockDuringSign ⇒ Object
added in release 1.9.0
128 129 130 |
# File 'lib/groupdocs/signature/envelope.rb', line 128 def lockDuringSign @lockDuringSign end |
#ownerName ⇒ Object
112 113 114 |
# File 'lib/groupdocs/signature/envelope.rb', line 112 def ownerName @ownerName end |
#requestUserAuthByPhoto ⇒ Object
120 121 122 |
# File 'lib/groupdocs/signature/envelope.rb', line 120 def requestUserAuthByPhoto @requestUserAuthByPhoto end |
#requireUserAuthForSign ⇒ Object
118 119 120 |
# File 'lib/groupdocs/signature/envelope.rb', line 118 def requireUserAuthForSign @requireUserAuthForSign end |
#showRecipientCommentInSignedDocument ⇒ Object
122 123 124 |
# File 'lib/groupdocs/signature/envelope.rb', line 122 def showRecipientCommentInSignedDocument @showRecipientCommentInSignedDocument end |
#status ⇒ Symbol
Converts status to human-readable format.
92 93 94 |
# File 'lib/groupdocs/signature/envelope.rb', line 92 def status @status end |
#statusDateTime ⇒ Object
94 95 96 |
# File 'lib/groupdocs/signature/envelope.rb', line 94 def statusDateTime @statusDateTime end |
#tags ⇒ Object
124 125 126 |
# File 'lib/groupdocs/signature/envelope.rb', line 124 def @tags end |
#updatedDateTime ⇒ Object
added in release 1.7.0
102 103 104 |
# File 'lib/groupdocs/signature/envelope.rb', line 102 def updatedDateTime @updatedDateTime end |
Class Method Details
.all!(options = {}, access = {}) ⇒ Array<GroupDocs::Signature::Envelope>
Changed in release 1.7.0
Returns a list of all envelopes.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/groupdocs/signature/envelope.rb', line 46 def self.all!( = {}, access = {}) status_id = .delete(:status_id) [:statusId] = status_id if status_id api = Api::Request.new do |request| request[:access] = access request[:method] = :GET request[:path] = '/signature/{{client_id}}/envelopes' end api.add_params() json = api.execute! json[:envelopes].map do |envelope| new(envelope) end end |
.for_me!(options = {}, access = {}) ⇒ Array<GroupDocs::Signature::Envelope>
Returns a list of all envelopes where user is recipient.
75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/groupdocs/signature/envelope.rb', line 75 def self.for_me!( = {}, access = {}) api = Api::Request.new do |request| request[:access] = access request[:method] = :GET request[:path] = '/signature/{{client_id}}/envelopes/recipient' end api.add_params() json = api.execute! json[:envelopes].map do |envelope| new(envelope) end end |
Instance Method Details
#add_recipient!(recipient, access = {}) ⇒ Object
Changed in release 1.5.8
Adds recipient to envelope.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/groupdocs/signature/envelope.rb', line 165 def add_recipient!(recipient, access = {}) recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}" api = Api::Request.new do |request| request[:access] = access request[:method] = :POST request[:path] = "/signature/{{client_id}}/envelopes/#{id}/recipient" end api.add_params(:email => recipient.email, :firstname => recipient.first_name, :lastname => recipient.last_name, :role => recipient.role_id, :order => recipient.order) json = api.execute! Signature::Recipient.new(json[:recipient]) end |
#archive!(access = {}) ⇒ Object
Archives completed envelope.
482 483 484 485 486 487 488 |
# File 'lib/groupdocs/signature/envelope.rb', line 482 def archive!(access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/{{client_id}}/envelopes/#{id}/archive" end.execute! end |
#cancel!(access = {}) ⇒ Object
Cancel envelope.
551 552 553 554 555 556 557 |
# File 'lib/groupdocs/signature/envelope.rb', line 551 def cancel!( access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/{{client_id}}/envelopes/#{id}/cancel" end.execute! end |
#date!(recipient, field, access = {}) ⇒ Array
Changed in release 1.5.8
Get signed envelope field data.
711 712 713 714 715 716 717 718 719 720 721 722 |
# File 'lib/groupdocs/signature/envelope.rb', line 711 def date!(recipient, field, access = {}) field.is_a?(GroupDocs::Signature::Field) or raise ArgumentError, "Field should be GroupDocs::Signature::Field object, received: #{field.inspect}" recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}" Api::Request.new do |request| request[:access] = access request[:method] = :GET request[:path] = "/signature/public/envelopes/#{id}/fields/recipient/#{recipient.id}/field/#{field.id}" end.execute! end |
#decline!(recipient, access = {}) ⇒ Object
Declines envelope.
363 364 365 366 367 368 369 370 371 372 |
# File 'lib/groupdocs/signature/envelope.rb', line 363 def decline!(recipient, access = {}) recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}" Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/{{client_id}}/envelopes/#{id}/recipient/#{recipient.id}/decline" end.execute! end |
#delegate_recipient!(old, new, access = {}) ⇒ Object
Delegates recipient to another one.
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/groupdocs/signature/envelope.rb', line 237 def delegate_recipient!(old, new, access = {}) old.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Old recipient should be GroupDocs::Signature::Recipient object, received: #{old.inspect}" new.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "New recipient should be GroupDocs::Signature::Recipient object, received: #{new.inspect}" api = Api::Request.new do |request| request[:access] = access request[:method] = :POST request[:path] = "/signature/{{client_id}}/envelopes/#{id}/recipient/#{old.id}/delegate" end api.add_params(:email => new.email, :firstname => new.first_name, :lastname => new.last_name) api.execute! end |
#fill_field!(value, field, document, recipient, options = {}, access = {}) ⇒ GroupDocs::Signature::Field
Fills field with value.
Value differs depending on field type. See examples below.
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/groupdocs/signature/envelope.rb', line 295 def fill_field!(value, field, document, recipient, = {}, access = {}) field.is_a?(GroupDocs::Signature::Field) or raise ArgumentError, "Field should be GroupDocs::Signature::Field object, received: #{field.inspect}" document.is_a?(GroupDocs::Document) or raise ArgumentError, "Document should be GroupDocs::Document object, received: #{document.inspect}" recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}" client_id = client_id([:public]) api = Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/#{client_id}/envelopes/#{id}/documents/#{document.file.guid}/recipient/#{recipient.id}/field/#{field.id}" end type = field.field_type if type == :signature && value.is_a?(GroupDocs::Signature) api.add_params(:signatureId => value.id) else if type == :checkbox value = (value ? 'on' : 'off') end api.[:request_body] = value api.[:plain] = true end json = api.execute! Signature::Field.new(json[:field]) end |
#get_envelope!(path, document, access = {}) ⇒ Object
Get signed envelope document.
519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
# File 'lib/groupdocs/signature/envelope.rb', line 519 def get_envelope!(path, document, access = {}) document.is_a?(GroupDocs::Document) or raise ArgumentError, "Document should be GroupDocs::Document object, received: #{document.inspect}" response = Api::Request.new do |request| request[:access] = access request[:method] = :GET request[:path] = "/signature/{{client_id}}/envelopes/#{id}/document/#{document.file.guid}" end.execute! filepath = "#{path}/#{name}." if documents!.size == 1 filepath << 'pdf' else filepath << 'zip' end Object::File.open(filepath, 'wb') do |file| file.write(response) end filepath end |
#logs!(access = {}) ⇒ Array<GroupDocs::Signature::Envelope::Log>
Returns a list of audit logs.
445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/groupdocs/signature/envelope.rb', line 445 def logs!(access = {}) json = Api::Request.new do |request| request[:access] = access request[:method] = :GET request[:path] = "/signature/{{client_id}}/envelopes/#{id}/logs" end.execute! json[:logs].map do |log| Log.new(log) end end |
#modify_field_location!(location, field, document, recipient, order, access = {}) ⇒ Object
Modify signature envelope field location.
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 |
# File 'lib/groupdocs/signature/envelope.rb', line 617 def modify_field_location!(location, field, document, recipient, order, access = {}) location.is_a?(GroupDocs::Signature::Field::Location) or raise ArgumentError, "Location should be GroupDocs::Signature::Field::Location object, received: #{location.inspect}" field.is_a?(GroupDocs::Signature::Field) or raise ArgumentError, "Field should be GroupDocs::Signature::Field object, received: #{field.inspect}" document.is_a?(GroupDocs::Document) or raise ArgumentError, "Document should be GroupDocs::Document object, received: #{document.inspect}" recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}" api = Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/{{client_id}}/envelopes/#{id}/documents/#{document.file.guid}/recipient/#{recipient.id}/fields/#{field.id}/locations/#{location.id}" end api.add_params(:order => order) api.execute! end |
#modify_recipient!(recipient, access = {}) ⇒ Object
Modify recipient of envelope.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/groupdocs/signature/envelope.rb', line 199 def modify_recipient!(recipient, access = {}) recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}" api = Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/{{client_id}}/envelopes/#{id}/recipient/#{recipient.id}" end api.add_params(:email => recipient.email, :firstname => recipient.first_name, :lastname => recipient.last_name, :role => recipient.role_id, :order => recipient.order) api.execute! end |
#public_get!(recipient, access = {}) ⇒ Array
Changed in release 1.5.8
Get signature envelope.
647 648 649 650 651 652 653 654 655 656 657 658 |
# File 'lib/groupdocs/signature/envelope.rb', line 647 def public_get!(recipient, access = {}) recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}" json = Api::Request.new do |request| request[:access] = access request[:method] = :GET request[:path] = "/signature/public/envelopes/#{id}/recipient/#{recipient.id}" end.execute! Signature::Envelope.new(json[:envelope]) end |
#public_signed_documents!(path, recipient, access = {}) ⇒ Array
Changed in release 1.5.8
Public downloads signed documents to given path.
If there is only one file in envelope, it’s saved as PDF. If there are two or more files in envelope, it’s saved as ZIP.
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 |
# File 'lib/groupdocs/signature/envelope.rb', line 675 def public_signed_documents!(path, recipient, access = {}) recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}" json = Api::Request.new do |request| request[:access] = access request[:method] = :DOWNLOAD request[:path] = "/signature/public/envelopes/#{id}/recipient/#{recipient.id}/documents/get" end.execute! filepath = "#{path}/#{name}." if documents!.size == 1 filepath << 'pdf' else filepath << 'zip' end Object::File.open(filepath, 'wb') do |file| file.write(json) end filepath end |
#resend!(access = {}) ⇒ Object
added in release 1.6.0
Resend envelope email notification.
735 736 737 738 739 740 741 |
# File 'lib/groupdocs/signature/envelope.rb', line 735 def resend!(access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/{{client_id}}/envelopes/#{id}/resend-notification" end.execute! end |
#restart!(access = {}) ⇒ Object
Restarts expired envelope.
497 498 499 500 501 502 503 |
# File 'lib/groupdocs/signature/envelope.rb', line 497 def restart!(access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/{{client_id}}/envelopes/#{id}/restart" end.execute! end |
#retry!(access = {}) ⇒ Object
Retry sign envelope.
566 567 568 569 570 571 572 |
# File 'lib/groupdocs/signature/envelope.rb', line 566 def retry!(access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/{{client_id}}/envelopes/#{id}/retry" end.execute! end |
#send!(webhook = {}, access = {}) ⇒ Object
Sends envelope.
466 467 468 469 470 471 472 473 |
# File 'lib/groupdocs/signature/envelope.rb', line 466 def send!(webhook = {}, access = {}) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/{{client_id}}/envelopes/#{id}/send" request[:request_body] = webhook end.execute! end |
#sign!(recipient, settings = {}, options = {}, access = {}) ⇒ Object
Changed in release 1.7.0
Signs envelope.
341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/groupdocs/signature/envelope.rb', line 341 def sign!(recipient, settings = {}, = {}, access = {}) recipient.is_a?(GroupDocs::Signature::Recipient) or raise ArgumentError, "Recipient should be GroupDocs::Signature::Recipient object, received: #{recipient.inspect}" client_id = client_id([:public]) Api::Request.new do |request| request[:access] = access request[:method] = :PUT request[:path] = "/signature/#{client_id}/envelopes/#{id}/recipient/#{recipient.id}/sign" request[:request_body] = settings end.execute! end |
#signed_document!(document, path, access = {}) ⇒ String
Returns path to file.
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File 'lib/groupdocs/signature/envelope.rb', line 418 def signed_document!(document, path, access = {}) document.is_a?(GroupDocs::Document) or raise ArgumentError, "Document should be GroupDocs::Document object, received: #{document.inspect}" response = Api::Request.new do |request| request[:access] = access request[:method] = :DOWNLOAD request[:path] = "/signature/{{client_id}}/envelopes/#{id}/document/#{document.file.guid}" end.execute! document.file.name ? filepath = "#{path}/#{document.file.name}" : filepath = "#{path}/#{name}.pdf" Object::File.open(filepath, 'wb') do |file| file.write(response) end filepath end |
#signed_documents!(path, access = {}) ⇒ String
Downloads signed documents to given path. If there is only one file in envelope, it’s saved as PDF. If there are two or more files in envelope, it’s saved as ZIP.
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/groupdocs/signature/envelope.rb', line 385 def signed_documents!(path, access = {}) response = Api::Request.new do |request| request[:access] = access request[:method] = :DOWNLOAD request[:path] = "/signature/{{client_id}}/envelopes/#{id}/documents/get" end.execute! filepath = "#{path}/#{name}." if documents!.size == 1 filepath << 'pdf' else filepath << 'zip' end Object::File.open(filepath, 'wb') do |file| file.write(response) end filepath end |
#update_envelope!(template, access = {}) ⇒ Array
Update envelope.
582 583 584 585 586 587 588 589 590 591 |
# File 'lib/groupdocs/signature/envelope.rb', line 582 def update_envelope!(template, access = {}) json = Api::Request.new do |request| request[:access] = access request[:method] = :POST request[:path] = "/signature/{{client_id}}/envelopes/#{id}/templates/#{template}" end.execute! json[:envelope] end |