module Tacokit::Client::Notifications

Methods for the Notifications API @see developers.trello.com/advanced-reference/notification

Public Instance Methods

mark_notification_read(notification_id) click to toggle source

Mark a notification as read @param notification_id [String] the notification identifier @example Mark a notification as read

Tacokit.mark_notification_read("aNotificationId") #=> Tacokit::Resource<Notification>

@see developers.trello.com/advanced-reference/notification#put-1-notifications-idnotification

# File lib/tacokit/client/notifications.rb, line 31
def mark_notification_read(notification_id)
  update_notification notification_id, unread: false
end
mark_notification_unread(notification_id) click to toggle source

Mark a notification as unread @param notification_id [String] the notification identifier @example Mark a notification as unread

Tacokit.mark_notification_unread("aNotificationId") #=> Tacokit::Resource<Notification>

@see developers.trello.com/advanced-reference/notification#put-1-notifications-idnotification

# File lib/tacokit/client/notifications.rb, line 22
def mark_notification_unread(notification_id)
  update_notification notification_id, unread: true
end
notification(notification_id, options = nil) click to toggle source

Retrieve a notification @param notification_id [String] the notification identifier @param options [Hash] options to fetch the notification with @return [Tacokit::Resource] the notification resource @example Retrieve a notification with its board

Tacokit.notification("aNotificationId", board: true) #=> Tacokit::Resource<Notification>

@see developers.trello.com/advanced-reference/notification#get-1-notifications-idnotification

# File lib/tacokit/client/notifications.rb, line 13
def notification(notification_id, options = nil)
  get notification_path(notification_id), options
end
update_notification(notification_id, options = {}) click to toggle source

Update read/unread status of notification @param notification_id [String] the notification identifier @param options [Hash] options to update the notification with @example Mark a notification as unread

Tacokit.update_notification("aNotificationId", unread: true) #=> Tacokit::Resource<Notification>

@see developers.trello.com/advanced-reference/notification#put-1-notifications-idnotification

# File lib/tacokit/client/notifications.rb, line 41
def update_notification(notification_id, options = {})
  put notification_path(notification_id), options
end

Private Instance Methods

notification_path(notification_id, *paths) click to toggle source
# File lib/tacokit/client/notifications.rb, line 52
def notification_path(notification_id, *paths)
  resource_path "notifications", notification_id, *paths
end
notification_resource(notification_id, resource, *paths) click to toggle source
# File lib/tacokit/client/notifications.rb, line 47
def notification_resource(notification_id, resource, *paths)
  paths, options = extract_options(camp(resource), *paths)
  get notification_path(notification_id, *paths), options
end