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
- #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 |
#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 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.
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/groupdocs/signature/envelope.rb', line 162 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.
479 480 481 482 483 484 485 |
# File 'lib/groupdocs/signature/envelope.rb', line 479 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.
548 549 550 551 552 553 554 |
# File 'lib/groupdocs/signature/envelope.rb', line 548 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.
708 709 710 711 712 713 714 715 716 717 718 719 |
# File 'lib/groupdocs/signature/envelope.rb', line 708 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.
360 361 362 363 364 365 366 367 368 369 |
# File 'lib/groupdocs/signature/envelope.rb', line 360 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.
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/groupdocs/signature/envelope.rb', line 234 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.
292 293 294 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 |
# File 'lib/groupdocs/signature/envelope.rb', line 292 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.
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
# File 'lib/groupdocs/signature/envelope.rb', line 516 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.
442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/groupdocs/signature/envelope.rb', line 442 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.
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
# File 'lib/groupdocs/signature/envelope.rb', line 614 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.
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/groupdocs/signature/envelope.rb', line 196 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.
644 645 646 647 648 649 650 651 652 653 654 655 |
# File 'lib/groupdocs/signature/envelope.rb', line 644 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.
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 |
# File 'lib/groupdocs/signature/envelope.rb', line 672 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.
732 733 734 735 736 737 738 |
# File 'lib/groupdocs/signature/envelope.rb', line 732 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.
494 495 496 497 498 499 500 |
# File 'lib/groupdocs/signature/envelope.rb', line 494 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.
563 564 565 566 567 568 569 |
# File 'lib/groupdocs/signature/envelope.rb', line 563 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.
463 464 465 466 467 468 469 470 |
# File 'lib/groupdocs/signature/envelope.rb', line 463 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.
338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/groupdocs/signature/envelope.rb', line 338 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.
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/groupdocs/signature/envelope.rb', line 415 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.
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/groupdocs/signature/envelope.rb', line 382 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.
579 580 581 582 583 584 585 586 587 588 |
# File 'lib/groupdocs/signature/envelope.rb', line 579 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 |