class Docusign::Builder::TabBuilder

Attributes

document[RW]
recipient[RW]

Public Class Methods

new(document = nil, recipient = nil) click to toggle source
Calls superclass method Docusign::Builder::Base::new
# File lib/docusign/builder/tab_builder.rb, line 10
def initialize(document = nil, recipient = nil)
  super
  self.document, self.recipient = document, recipient
end

Public Instance Methods

build(options = {}, &block) click to toggle source
Calls superclass method Docusign::Builder::Base#build
# File lib/docusign/builder/tab_builder.rb, line 15
def build(options = {}, &block)
  anchor_options = options.delete(:anchor)
  
  returning super(options, &block) do |tab|
    tab.anchor anchor_options if anchor_options && !tab.anchor_tab_item
    tab.document_id  ||= document.id  if document
    tab.recipient_id ||= recipient.id if recipient
    
    # Default tab_label to the tab name if none is explicitly given
    tab.tab_label ||= tab.name
    
    # Provide a custom tab type if none has already been provided
    tab.type ||= Docusign::TabTypeCode::Custom
  end
end