Module: BWAPI::Client::User::Notifications

Included in:
BWAPI::Client::User
Defined in:
lib/bwapi/client/user/notifications.rb

Overview

Notifications module for projects/notifications endpoints

Instance Method Summary collapse

Instance Method Details

#create_notification(opts = {}) ⇒ Hash

Post a new user notification

Parameters:

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

    options hash of parameters

Options Hash (opts):

  • hidden (Boolean)

    if the notification is hidden from users

  • read (Boolean)

    if the notification has been read

  • body (String)

    the body text of the notification

  • subject (String)

    the subject text of the notification

  • type (String)

    the type of notification

Returns:

  • (Hash)

    new user notification



15
16
17
# File 'lib/bwapi/client/user/notifications.rb', line 15

def create_notification(opts = {})
  post 'user/notifications', opts
end

#notifications(opts = {}) ⇒ Hash

Get the current user notifications

Parameters:

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

    options hash of parameters

Options Hash (opts):

  • page (Integer)

    Page of projects to retrieve

  • pageSize (Integer)

    Results per page of results

Returns:

  • (Hash)

    user notifications



25
26
27
# File 'lib/bwapi/client/user/notifications.rb', line 25

def notifications(opts = {})
  get 'user/notifications', opts
end

#patch_notification(notification_id, opts = {}) ⇒ Hash

Patch a users existing notification

Parameters:

  • notification_id (Integer)

    Id of notification

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

    options Hash of parameters

Options Hash (opts):

  • read (Boolean)

    if the notification has been read

Returns:

  • (Hash)

    patched user notifications



49
50
51
# File 'lib/bwapi/client/user/notifications.rb', line 49

def patch_notification(notification_id, opts = {})
  patch "user/notifications/#{notification_id}", opts
end

#update_notification(notification_id, opts = {}) ⇒ Hash

Update users existing notification

Parameters:

  • notification_id (Integer)

    Id of notification

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

    options hash of parameters

Options Hash (opts):

  • hidden (Boolean)

    if the notification is hidden from users

  • read (Boolean)

    if the notification has been read

  • body (String)

    the body text of the notification

  • subject (String)

    the subject text of the notification

  • type (String)

    the type of notification

Returns:

  • (Hash)

    edited user notification



39
40
41
# File 'lib/bwapi/client/user/notifications.rb', line 39

def update_notification(notification_id, opts = {})
  put "user/notifications/#{notification_id}", opts
end