class Ruboty::Ragoon::Notification
Attributes
brain[R]
list[R]
Public Class Methods
new(brain)
click to toggle source
# File lib/ruboty/ragoon/notification.rb, line 8 def initialize(brain) @brain = brain @service = ::Ragoon::Services::Notification.new end
Public Instance Methods
empty?()
click to toggle source
# File lib/ruboty/ragoon/notification.rb, line 28 def empty? unread_count == 0 end
list_url()
click to toggle source
# File lib/ruboty/ragoon/notification.rb, line 32 def list_url "#{@service.garoon_endpoint.gsub(/\?.*\Z/, '')}/notification/index" end
retrieve()
click to toggle source
# File lib/ruboty/ragoon/notification.rb, line 13 def retrieve new_notifications = @service.retrieve .map { |data| Item.new(data) } .find_all { |item| item.unread } new_notification_ids = new_notifications.map(&:id) ids_to_notify = not_notified_ids(new_notification_ids) @list = new_notifications.find_all { |n| ids_to_notify.include?(n.id) } end
unread_count()
click to toggle source
# File lib/ruboty/ragoon/notification.rb, line 24 def unread_count @list.count end