Class: RTunesU::ExternalFeed

Inherits:
Entity
  • Object
show all
Defined in:
lib/rtunesu/entities/external_feed.rb

Instance Attribute Summary

Attributes inherited from Entity

#connection, #handle, #parent, #saved, #source_xml

Instance Method Summary collapse

Methods inherited from Entity

attributes, base_connection, #base_connection, base_connection=, #class_name, composed_of, #edited?, #edits, get_base_connection, #handle_from_source, has_a, has_n, #initialize, #inspect, #reload, set_base_connection, validates!, #value_from_edits_or_store

Constructor Details

This class inherits a constructor from RTunesU::Entity

Instance Method Details

#parent_handleObject

As an entirely nested entity ExternalFeed instances don’t have a parent handle. However, something ‘truthy’ needs to be presnet for proper XML document genration.



19
20
21
# File 'lib/rtunesu/entities/external_feed.rb', line 19

def parent_handle # :nodoc:
  ""
end

#to_xml(xml_builder = Builder::XmlMarkup.new) ⇒ Object

an ExternalFeed must serialize in a specific order



9
10
11
12
13
14
15
# File 'lib/rtunesu/entities/external_feed.rb', line 9

def to_xml(xml_builder = Builder::XmlMarkup.new)
  xml_builder.tag!('ExternalFeed') do
    %w(URL OwnerEmail PollingInterval SecurityType SignatureType BasicAuthUsername BasicAuthPassword).each do |tag_name|
      xml_builder.tag!(tag_name, self.edits[tag_name]) if self.edits[tag_name]
    end
  end
end