class DaFace::Twitter::Tweet
Attributes
created_at[R]
id[R]
lang[R]
links[R]
retweet[R]
retweet_count[R]
source[R]
text[R]
user[R]
Public Class Methods
new(data={})
click to toggle source
# File lib/da_face/twitter/tweet.rb, line 9 def initialize data={} allowed_attributes.each do |attr| unless data[attr].nil? self.instance_variable_set("@#{attr}".to_sym, data[attr]) end end normalize_attributes! return self end
Public Instance Methods
allowed_attributes()
click to toggle source
# File lib/da_face/twitter/tweet.rb, line 37 def allowed_attributes [:id, :user, :created_at, :lang, :text, :source, :links, :retweet, :retweet_count] end
id_str()
click to toggle source
# File lib/da_face/twitter/tweet.rb, line 27 def id_str @id.to_s end
normalize_attributes!()
click to toggle source
# File lib/da_face/twitter/tweet.rb, line 31 def normalize_attributes! @created_at = parse_timestamp(@created_at) if @created_at @links = parse_links(@links) if @links @id = @id.to_i if @id end
retweet?()
click to toggle source
# File lib/da_face/twitter/tweet.rb, line 19 def retweet? @retweet || false end
Private Instance Methods
parse_links(links)
click to toggle source
# File lib/da_face/twitter/tweet.rb, line 43 def parse_links links return [] unless links links.collect{|l| parse_uri(l)} end