Class: Viberator::Event
Instance Method Summary
collapse
Methods inherited from Record
#initialize
Instance Method Details
#author ⇒ Object
10
11
12
|
# File 'lib/viberator/event.rb', line 10
def author
@db.author @attrs[:Number]
end
|
#image ⇒ Object
31
32
33
34
|
# File 'lib/viberator/event.rb', line 31
def image
return @db.sticker @attrs[:StickerID] if sticker?
return payload_path if photo?
end
|
#image_thumb ⇒ Object
36
37
38
|
# File 'lib/viberator/event.rb', line 36
def image_thumb
return thumbnail_path if photo?
end
|
#message? ⇒ Boolean
14
15
16
|
# File 'lib/viberator/event.rb', line 14
def message?
!@attrs[:Body].to_s.empty?
end
|
#photo? ⇒ Boolean
18
19
20
|
# File 'lib/viberator/event.rb', line 18
def photo?
!@attrs[:PayloadPath].to_s.empty?
end
|
#sticker? ⇒ Boolean
22
23
24
|
# File 'lib/viberator/event.rb', line 22
def sticker?
0 < @attrs[:StickerID].to_i
end
|
#text ⇒ Object
26
27
28
29
|
# File 'lib/viberator/event.rb', line 26
def text
return @attrs[:Body] if message?
return @attrs[:Subject] if photo?
end
|
#timestamp ⇒ Object
6
7
8
|
# File 'lib/viberator/event.rb', line 6
def timestamp
Time.at @attrs[:TimeStamp]
end
|