class Memerator::Notification

A notification

Public Class Methods

new(data) click to toggle source

@!visibility private

# File lib/memerator/notification.rb, line 4
def initialize(data)
  @data = data
end

Public Instance Methods

id() click to toggle source

@return [Integer] the ID of this notification

# File lib/memerator/notification.rb, line 9
def id
  @data['id']
end
memeid() click to toggle source

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
message() click to toggle source

@return [String] the notification, formatted.

# File lib/memerator/notification.rb, line 24
def message
  @data['message']
end
rating() click to toggle source

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
raw() click to toggle source

@return [String] the raw message as it appears on Memerator.me

# File lib/memerator/notification.rb, line 29
def raw
  @data['raw']
end
sender() click to toggle source

@return [User] the sender of this notification.

# File lib/memerator/notification.rb, line 14
def sender
  Memerator::User.new(@data['sender'])
end
timestamp() click to toggle source

@return [Time] the time this was sent

# File lib/memerator/notification.rb, line 19
def timestamp
  Time.parse(@data['timestamp'])
end
type() click to toggle source

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