Class: TweepML
- Inherits:
-
Object
- Object
- TweepML
- Defined in:
- lib/tweepml.rb
Instance Attribute Summary collapse
-
#contact_name ⇒ Object
Returns the value of attribute contact_name.
-
#contact_screen_name ⇒ Object
Returns the value of attribute contact_screen_name.
-
#copyright ⇒ Object
Returns the value of attribute copyright.
-
#date_created ⇒ Object
Returns the value of attribute date_created.
-
#date_modified ⇒ Object
Returns the value of attribute date_modified.
-
#description ⇒ Object
Returns the value of attribute description.
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#error_description ⇒ Object
Returns the value of attribute error_description.
-
#generator ⇒ Object
Returns the value of attribute generator.
-
#generator_link ⇒ Object
Returns the value of attribute generator_link.
-
#link ⇒ Object
Returns the value of attribute link.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
-
#tweep_list ⇒ Object
Returns the value of attribute tweep_list.
Instance Method Summary collapse
-
#initialize(source = nil) ⇒ TweepML
constructor
Create a new TweepML representation.
-
#to_xml ⇒ Object
XML representation of the TweepML.
Constructor Details
Instance Attribute Details
#contact_name ⇒ Object
Returns the value of attribute contact_name.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def contact_name @contact_name end |
#contact_screen_name ⇒ Object
Returns the value of attribute contact_screen_name.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def contact_screen_name @contact_screen_name end |
#copyright ⇒ Object
Returns the value of attribute copyright.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def copyright @copyright end |
#date_created ⇒ Object
Returns the value of attribute date_created.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def date_created @date_created end |
#date_modified ⇒ Object
Returns the value of attribute date_modified.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def date_modified @date_modified end |
#description ⇒ Object
Returns the value of attribute description.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def description @description end |
#error_code ⇒ Object
Returns the value of attribute error_code.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def error_code @error_code end |
#error_description ⇒ Object
Returns the value of attribute error_description.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def error_description @error_description end |
#generator ⇒ Object
Returns the value of attribute generator.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def generator @generator end |
#generator_link ⇒ Object
Returns the value of attribute generator_link.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def generator_link @generator_link end |
#link ⇒ Object
Returns the value of attribute link.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def link @link end |
#tags ⇒ Object
Returns the value of attribute tags.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def @tags end |
#title ⇒ Object
Returns the value of attribute title.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def title @title end |
#tweep_list ⇒ Object
Returns the value of attribute tweep_list.
11 12 13 |
# File 'lib/tweepml.rb', line 11 def tweep_list @tweep_list end |
Instance Method Details
#to_xml ⇒ Object
XML representation of the TweepML
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/tweepml.rb', line 53 def to_xml doc = Document.new tml = doc.add_element 'tweepml', {'version' => '1.0'} # Add the header elements head = tml.add_element 'head' [:title, :description, :link, :date_created, :date_modified, :contact_name, :contact_screen_name, :copyright, :error_code, :error_description, :tags].each do |prop| unless self.send(prop).nil? t = head.add_element prop.to_s t.text = self.send(prop) end end head.add_element("generator").text = "TweepML Ruby Generator v0.1" head.add_element("generator_link").text = "http://github.com/dacort/tweepml" # Add the tweep_list element tweep_list = tml.add_element 'tweep_list' # Iterate through all tweeps/tweep_lists - should probably use nodes self.tweep_list.tweep_lists.each do|tl| tweep_list.add_element(tl.to_xml) end doc end |