Class: HipTail::Message
- Inherits:
-
Object
show all
- Defined in:
- lib/hiptail/atom.rb
Defined Under Namespace
Classes: Notification, Talk
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(params) ⇒ Message
Returns a new instance of Message.
55
56
57
|
# File 'lib/hiptail/atom.rb', line 55
def initialize(params)
@raw = params.dup
end
|
Instance Attribute Details
#date ⇒ Time
67
68
69
70
|
# File 'lib/hiptail/atom.rb', line 67
def date
@date ||= Time.parse(@raw['date'])
@date
end
|
74
75
76
77
|
# File 'lib/hiptail/atom.rb', line 74
def from
@from ||= User.create(@raw['from'])
@from
end
|
#id ⇒ String
61
62
63
|
# File 'lib/hiptail/atom.rb', line 61
def id
@raw['id']
end
|
#is_notification? ⇒ Boolean
104
105
106
|
# File 'lib/hiptail/atom.rb', line 104
def is_notification?
false
end
|
#is_talk? ⇒ Boolean
99
100
101
|
# File 'lib/hiptail/atom.rb', line 99
def is_talk?
false
end
|
#mentions ⇒ Array
Returns Array of HipTail::User.
81
82
83
84
|
# File 'lib/hiptail/atom.rb', line 81
def mentions
@mentions ||= (@raw['mentions'] || []).map { |data| User.create(data) }
@mentions
end
|
#message ⇒ String
88
89
90
|
# File 'lib/hiptail/atom.rb', line 88
def message
@raw['message']
end
|
#raw ⇒ Object
Returns the value of attribute raw.
53
54
55
|
# File 'lib/hiptail/atom.rb', line 53
def raw
@raw
end
|
#text ⇒ String
94
95
96
|
# File 'lib/hiptail/atom.rb', line 94
def text
message
end
|