Class: RTunesU::Group

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

Overview

A Group in iTunes U. A Group is expressed as a tab in the iTunes interface.

Constant Summary collapse

ACCESS =
{
  :no_access => "No Access",
  :steaming  => "Streaming",
  :download  => "Download",
  :drop_box  => "Drop Box",
  :shared    => "Shared",
  :edit      => "Edit"
}
TYPES =
{
  :feed => "Feed"
}

Instance Attribute Summary

Attributes inherited from Entity

#connection, #handle, #parent, #parent_handle, #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

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

a Group must serialize in a specific order



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rtunesu/entities/group.rb', line 23

def to_xml(xml_builder = Builder::XmlMarkup.new)
  xml_builder.tag!('Group') do
    %w(Name Handle GroupType Explicit).each do |tag_name|
      xml_builder.tag!(tag_name, self.edits[tag_name]) if self.edits[tag_name]
    end
    
    self.tracks.to_xml(xml_builder)
    self.permissions.to_xml(xml_builder)
    
    %w(AllowSubscription).each do |tag_name|
      xml_builder.tag!(tag_name, self.edits[tag_name]) if self.edits[tag_name]
    end
    self.external_feed.to_xml(xml_builder) if self.external_feed
  end
end