Class: Twitter::Status

Inherits:
Object
  • Object
show all
Includes:
EasyClassMaker
Defined in:
lib/twitter/status.rb

Class Method Summary collapse

Methods included from EasyClassMaker

included, #initialize

Class Method Details

.new_from_xml(xml) ⇒ Object

Creates a new status from a piece of xml



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/twitter/status.rb', line 8

def self.new_from_xml(xml)
  s = new
  s.id                    = (xml).at('id').innerHTML
  s.created_at            = (xml).at('created_at').innerHTML
  s.text                  = (xml).get_elements_by_tag_name('text').innerHTML
  s.source                = (xml).at('source').innerHTML
  s.truncated             = (xml).at('truncated').innerHTML == 'false' ? false : true
  s.favorited             = (xml).at('favorited').innerHTML == 'false' ? false : true
  s.in_reply_to_status_id = (xml).at('in_reply_to_status_id').innerHTML
  s.in_reply_to_user_id   = (xml).at('in_reply_to_user_id').innerHTML
  s.user                  = User.new_from_xml(xml.at('user')) if (xml).at('user')
  s
end