Class: Topsy::Tweet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Tweet

Returns a new instance of Tweet.



23
24
25
26
27
28
29
30
31
# File 'lib/rtopsy/tweet.rb', line 23

def initialize(hash)
  hash.each do |key, value|
    if key == 'author'
      instance_variable_set("@#{key}", Author.new(value))
    else
      instance_variable_set("@#{key}", value)
    end
  end
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



17
18
19
# File 'lib/rtopsy/tweet.rb', line 17

def author
  @author
end

#contentObject

Returns the value of attribute content.



17
18
19
# File 'lib/rtopsy/tweet.rb', line 17

def content
  @content
end

#dateObject

Returns the value of attribute date.



17
18
19
# File 'lib/rtopsy/tweet.rb', line 17

def date
  @date
end

#date_alphaObject

Returns the value of attribute date_alpha.



17
18
19
# File 'lib/rtopsy/tweet.rb', line 17

def date_alpha
  @date_alpha
end

Returns the value of attribute permalink_url.



17
18
19
# File 'lib/rtopsy/tweet.rb', line 17

def permalink_url
  @permalink_url
end

#typeObject

Returns the value of attribute type.



17
18
19
# File 'lib/rtopsy/tweet.rb', line 17

def type
  @type
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/rtopsy/tweet.rb', line 19

def to_s
  "Topsy Tweet: #{permalink_url}, #{content}"
end