class Memerator::Notification
A notification
Public Class Methods
@!visibility private
# File lib/memerator/notification.rb, line 4 def initialize(data) @data = data end
Public Instance Methods
@return [Integer] the ID of this notification
# File lib/memerator/notification.rb, line 9 def id @data['id'] end
For meme ratings, the meme ID is returned, if you need it! @return [String, nil] the meme ID, if type == 0
# File lib/memerator/notification.rb, line 45 def memeid return nil if @data['meme'].nil? @data['meme']['memeid'] end
@return [String] the notification, formatted.
# File lib/memerator/notification.rb, line 24 def message @data['message'] end
For meme ratings, the meme rating is returned, if you need it! @return [Integer, nil] the meme rating, if type == 0
# File lib/memerator/notification.rb, line 53 def rating return nil if @data['meme'].nil? @data['meme']['rating'] end
@return [String] the raw message as it appears on Memerator.me
# File lib/memerator/notification.rb, line 29 def raw @data['raw'] end
@return [User] the sender of this notification.
# File lib/memerator/notification.rb, line 14 def sender Memerator::User.new(@data['sender']) end
@return [Time] the time this was sent
# File lib/memerator/notification.rb, line 19 def timestamp Time.parse(@data['timestamp']) end
The type is mostly used internally but is useful for clients implementing notification sorting. Type 0 is a meme rating notification Type 1 is a follow notification Type 2 is a notice. Type 3 is a report status update @return [Integer] the type of this message
# File lib/memerator/notification.rb, line 39 def type @data['type'] end