Class: Exchanger::Body

Inherits:
Element show all
Defined in:
lib/exchanger/elements/body.rb

Overview

Instance Attribute Summary

Attributes inherited from Element

#tag_name

Instance Method Summary collapse

Methods inherited from Element

#==, #assign_attributes_from_xml, create_element_accessors, element, #errors, #initialize, #inspect, key, new_from_xml, #to_xml_change, #to_xml_updates

Methods included from Persistence

#destroy, #new_record?, #persisted?, #reload, #save

Methods included from Dirty

#attribute_change, #attribute_changed?, #attribute_was, #changed, #changed?, #changes, included, #move_changes, #previous_changes, #reset_attribute!, #reset_modifications, #setup_modifications

Methods included from Attributes

#attributes, #attributes=, #change_key, #id, #identifier, #method_missing, #read_attribute, #respond_to?, #write_attribute

Constructor Details

This class inherits a constructor from Exchanger::Element

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Exchanger::Attributes

Instance Method Details

#to_xml(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/exchanger/elements/body.rb', line 12

def to_xml(options = {})
  doc = Nokogiri::XML::Document.new
  body_attributes = { "BodyType" => body_type || "Text" }
  body_attributes["IsTruncated"] = is_truncated if is_truncated
  root = doc.create_element(tag_name, body_attributes)
  root << doc.create_text_node(text.to_s)
  root
end