class DocuSign::Envelope

Constants

ATTRIBUTES

Attributes

document_builder[W]
notification_builder[W]
recipient_builder[W]
tab_builder[W]

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/docu_sign/envelope.rb, line 16
def initialize(attributes = {})
  ATTRIBUTES.each do |attr|
    self.send("#{attr}=", attributes[attr])
  end
end

Public Instance Methods

document(options = {}, &block) click to toggle source
# File lib/docu_sign/envelope.rb, line 36
def document(options = {}, &block)
  document_builder.build(options, &block).tap do |d|
    documents << d
  end
end
document_builder() click to toggle source
# File lib/docu_sign/envelope.rb, line 42
def document_builder
  @document_builder ||= DocuSign::Builder::DocumentBuilder.new()
end
documents() { |self| ... } click to toggle source

Documents

# File lib/docu_sign/envelope.rb, line 24
def documents(&block)
  @documents ||= DocuSign::ArrayOfDocument.new

  return @documents unless block_given?

  self.document_builder = DocuSign::Builder::DocumentBuilder.new()

  @documents.tap do |a|
    yield self if block_given?
  end
end
notification(options = {}, &block) click to toggle source
# File lib/docu_sign/envelope.rb, line 94
def notification(options = {}, &block)
  @notification ||= notification_builder.build(options, &block)
end
notification_builder() click to toggle source
# File lib/docu_sign/envelope.rb, line 98
def notification_builder
  @notification_builder ||= DocuSign::Builder::NotificationBuilder.new
end
recipient(options = {}, &block) click to toggle source
# File lib/docu_sign/envelope.rb, line 60
def recipient(options = {}, &block)
  recipient_builder.build(options, &block).tap do |r|
    recipients << r
  end
end
recipient_builder() click to toggle source
# File lib/docu_sign/envelope.rb, line 66
def recipient_builder
  @recipient_builder ||= DocuSign::Builder::RecipientBuilder.new()
end
recipients() { |self| ... } click to toggle source

Recipients

# File lib/docu_sign/envelope.rb, line 48
def recipients(&block)
  @recipients ||= DocuSign::ArrayOfRecipient.new

  return @recipients unless block_given?

  self.recipient_builder = DocuSign::Builder::RecipientBuilder.new()

  @recipients.tap do |r|
    yield self if block_given?
  end
end
tab(options = {}, &block) click to toggle source
# File lib/docu_sign/envelope.rb, line 84
def tab(options = {}, &block)
  tab_builder.build(options, &block).tap do |t|
    tabs << t
  end
end
tab_builder() click to toggle source
# File lib/docu_sign/envelope.rb, line 90
def tab_builder
  @tab_builder ||= DocuSign::Builder::TabBuilder.new(nil)
end
tabs(recipient = nil) { |self| ... } click to toggle source

Tabs

# File lib/docu_sign/envelope.rb, line 72
def tabs(recipient = nil, &block)
  @tabs ||= DocuSign::ArrayOfTab.new

  return @tabs unless block_given?

  self.tab_builder = DocuSign::Builder::TabBuilder.new(nil, recipient)

  @tabs.tap do |a|
    yield self if block_given?
  end
end
to_savon() click to toggle source
# File lib/docu_sign/envelope.rb, line 102
def to_savon
  {"Envelope" => {
    "TransactionID" => self.transaction_id,
    "Asynchronous" => self.asynchronous?,
    "AccountId" => self.account_id,
    "Documents" => {
      "Document" => self.documents.collect(&:to_savon)
    },
    "Recipients" => {
      "Recipient" => self.recipients.collect(&:to_savon)
    },
    "Tabs" => {
      "Tab" => self.tabs.collect(&:to_savon)
    },
    "Subject" => self.subject,
    "EmailBlurb" => self.email_blurb,
    "SigningLocation" => self.signing_location,
    # TODO: CustomFields
    # TODO: VaultingOptions
    "AutoNavigation" => self.auto_navigation?,
    "EnvelopeIDStamping" => self.envelope_id_stamping?,
    "AuthoritativeCopy" => self.authoritative_copy?,
    # TODO: EnvelopeAttachment
    "Notification" => self.notification.try(:to_savon),
    "EnforceSignerVisibility" => self.enforce_signer_visibility?,
    "EnableWetSign" => self.enable_wet_sign?,
    "AllowMarkup" => self.allow_markup?,
    # TODO: EventNotification
    "AllowReassign" => self.allow_reassign?
  }.delete_if{|key, value| value.nil?}}
end