Class: Fizzy::Services::NotificationsService

Inherits:
BaseService
  • Object
show all
Defined in:
lib/fizzy/generated/services/notifications_service.rb

Overview

Service for Notifications operations

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Fizzy::Services::BaseService

Instance Method Details

#bulk_read(account_id:, notification_ids: nil) ⇒ void

This method returns an undefined value.

bulk_read operation

Parameters:

  • account_id (String)

    account id ID

  • notification_ids (Array, nil) (defaults to: nil)

    notification ids



25
26
27
28
29
30
# File 'lib/fizzy/generated/services/notifications_service.rb', line 25

def bulk_read(account_id:, notification_ids: nil)
  with_operation(service: "notifications", operation: "BulkReadNotifications", is_mutation: true, resource_id: ) do
    http_post("/#{}/notifications/bulk_reading.json", body: compact_params(notification_ids: notification_ids))
    nil
  end
end

#list(account_id:, read: nil) ⇒ Enumerator<Hash>

list operation

Parameters:

  • account_id (String)

    account id ID

  • read (Boolean, nil) (defaults to: nil)

    read

Returns:

  • (Enumerator<Hash>)

    paginated results



14
15
16
17
18
19
# File 'lib/fizzy/generated/services/notifications_service.rb', line 14

def list(account_id:, read: nil)
  wrap_paginated(service: "notifications", operation: "ListNotifications", is_mutation: false, resource_id: ) do
    params = compact_params(read: read)
    paginate("/#{}/notifications.json", params: params)
  end
end

#read(account_id:, notification_id:) ⇒ void

This method returns an undefined value.

read operation

Parameters:

  • account_id (String)

    account id ID

  • notification_id (String)

    notification id ID



46
47
48
49
50
51
# File 'lib/fizzy/generated/services/notifications_service.rb', line 46

def read(account_id:, notification_id:)
  with_operation(service: "notifications", operation: "ReadNotification", is_mutation: true, resource_id: notification_id) do
    http_post("/#{}/notifications/#{notification_id}/reading.json", retryable: true)
    nil
  end
end

#tray(account_id:, include_read: nil) ⇒ Hash

tray operation

Parameters:

  • account_id (String)

    account id ID

  • include_read (Boolean, nil) (defaults to: nil)

    include read

Returns:

  • (Hash)

    response data



36
37
38
39
40
# File 'lib/fizzy/generated/services/notifications_service.rb', line 36

def tray(account_id:, include_read: nil)
  with_operation(service: "notifications", operation: "GetNotificationTray", is_mutation: false, resource_id: ) do
    http_get("/#{}/notifications/tray.json", params: compact_params(include_read: include_read)).json
  end
end

#unread(account_id:, notification_id:) ⇒ void

This method returns an undefined value.

unread operation

Parameters:

  • account_id (String)

    account id ID

  • notification_id (String)

    notification id ID



57
58
59
60
61
62
# File 'lib/fizzy/generated/services/notifications_service.rb', line 57

def unread(account_id:, notification_id:)
  with_operation(service: "notifications", operation: "UnreadNotification", is_mutation: true, resource_id: notification_id) do
    http_delete("/#{}/notifications/#{notification_id}/reading.json")
    nil
  end
end