Class: Twitter

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_feed.rb

Constant Summary collapse

FEED_URL =
"http://api.twitter.com/1/statuses/user_timeline.xml?screen_name="

Instance Method Summary collapse

Instance Method Details

#getContent(url) ⇒ Object



9
10
11
12
# File 'lib/twitter_feed.rb', line 9

def getContent(url) 
  uri = URI.parse(url)
  @contenido=Net::HTTP.get(uri)
end

#getFeed(username) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/twitter_feed.rb', line 14

def getFeed(username)
 getContent(FEED_URL+username)
 doc = REXML::Document.new @contenido
 @tweets= Array.new
 doc.elements.each("statuses/status/text") { |element,index| 
   @tweets.push(element.text) 
   puts element.text
 }
 
end