Class: Signatory::MergeField

Inherits:
API::Base
  • Object
show all
Defined in:
lib/signatory/merge_field.rb

Instance Method Summary collapse

Methods inherited from API::Base

all, connection, escape_url_attrs, formatted_collection_name, formatted_name, #has_many, instantiate_collection, #instantiate_record, #persisted?

Instance Method Details

#idObject



7
# File 'lib/signatory/merge_field.rb', line 7

def id; attributes['id']; end

#lockedObject



3
4
5
# File 'lib/signatory/merge_field.rb', line 3

def locked
  attributes['locked'] || true
end

#to_xml(options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/signatory/merge_field.rb', line 9

def to_xml(options = {})
  identifier = {}
  identifier.merge!({:merge_field_id => id}) unless attributes['id'].nil?
  identifier.merge!({:merge_field_name => name}) unless attributes['name'].nil?
  require 'builder' unless defined? ::Builder
  options[:indent] ||= 2
  xml = options[:builder] ||= ::Builder::XmlMarkup.new(:indent => options[:indent])
  xml.tag!('merge_field', identifier) do
    if attributes.has_key?(:page)
      xml.page page
      xml.name name
      xml.id id
    else
      xml.value value
      xml.locked locked
    end
  end
end