Class: Modulr::API::NotificationsService
- Inherits:
-
Service
- Object
- Service
- Modulr::API::NotificationsService
show all
- Defined in:
- lib/modulr/api/notifications_service.rb
Instance Attribute Summary
Attributes inherited from Service
#client
Instance Method Summary
collapse
Methods inherited from Service
#format_datetime, #initialize
Instance Method Details
#create(type:, channel:, destinations:, config:, **opts) ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/modulr/api/notifications_service.rb', line 16
def create(type:, channel:, destinations:, config:, **opts)
payload = {
type: type,
channel: channel,
destinations: destinations,
config: config,
}
response = client.post("#{base_notification_url(opts)}/notifications", payload)
Resources::Notifications::Notification.new(response.env[:raw_body], response.body)
end
|
#find(id:, **opts) ⇒ Object
6
7
8
9
|
# File 'lib/modulr/api/notifications_service.rb', line 6
def find(id:, **opts)
response = client.get("#{base_notification_url(opts)}/notifications/#{id}")
Resources::Notifications::Notification.new(response.env[:raw_body], response.body)
end
|
#list(**opts) ⇒ Object
11
12
13
14
|
# File 'lib/modulr/api/notifications_service.rb', line 11
def list(**opts)
response = client.get("#{base_notification_url(opts)}/notifications")
Resources::Notifications::Collection.new(response.env[:raw_body], response.body)
end
|
#update(id:, status:, destinations:, config:, **opts) ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'lib/modulr/api/notifications_service.rb', line 27
def update(id:, status:, destinations:, config:, **opts)
payload = {
status: status,
destinations: destinations,
config: config,
}
response = client.put("#{base_notification_url(opts)}/notifications/#{id}", payload)
Resources::Notifications::Notification.new(response.env[:raw_body], response.body)
end
|