Module: Tacokit::Client::Notifications

Included in:
Tacokit::Client
Defined in:
lib/tacokit/client/notifications.rb

Overview

Methods for the Notifications API

Instance Method Summary collapse

Instance Method Details

#mark_notification_read(notification_id) ⇒ Object

Mark a notification as read

Examples:

Mark a notification as read

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

Parameters:

  • notification_id (String)

    the notification identifier

See Also:


31
32
33
# 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) ⇒ Object

Mark a notification as unread

Examples:

Mark a notification as unread

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

Parameters:

  • notification_id (String)

    the notification identifier

See Also:


22
23
24
# 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) ⇒ Tacokit::Resource

Retrieve a notification

Examples:

Retrieve a notification with its board

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

Parameters:

  • notification_id (String)

    the notification identifier

  • options (Hash) (defaults to: nil)

    options to fetch the notification with

Returns:

See Also:


13
14
15
# 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 = {}) ⇒ Object

Update read/unread status of notification

Examples:

Mark a notification as unread

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

Parameters:

  • notification_id (String)

    the notification identifier

  • options (Hash) (defaults to: {})

    options to update the notification with

See Also:


41
42
43
# File 'lib/tacokit/client/notifications.rb', line 41

def update_notification(notification_id, options = {})
  put notification_path(notification_id), options
end