Class: Paddle::NotificationSetting

Inherits:
Object
  • Object
show all
Defined in:
lib/paddle/models/notification_setting.rb

Class Method Summary collapse

Methods inherited from Object

#initialize, #to_ostruct, #update

Constructor Details

This class inherits a constructor from Paddle::Object

Class Method Details

.create(description:, destination:, type:, subscribed_events:, **params) ⇒ Object



9
10
11
12
13
# File 'lib/paddle/models/notification_setting.rb', line 9

def create(description:, destination:, type:, subscribed_events:, **params)
  attrs = { description: description, destination: destination, type: type, subscribed_events: subscribed_events }
  response = Client.post_request("notification-settings", body: attrs.merge(params))
  NotificationSetting.new(response.body["data"])
end

.delete(id:) ⇒ Object



25
26
27
# File 'lib/paddle/models/notification_setting.rb', line 25

def delete(id:)
  Client.delete_request("notification-settings/#{id}")
end

.list(**params) ⇒ Object



4
5
6
7
# File 'lib/paddle/models/notification_setting.rb', line 4

def list(**params)
  response = Client.get_request("notification-settings", params: params)
  Collection.from_response(response, type: NotificationSetting)
end

.retrieve(id:) ⇒ Object



15
16
17
18
# File 'lib/paddle/models/notification_setting.rb', line 15

def retrieve(id:)
  response = Client.get_request("notification-settings/#{id}")
  NotificationSetting.new(response.body["data"])
end

.update(id:, **params) ⇒ Object



20
21
22
23
# File 'lib/paddle/models/notification_setting.rb', line 20

def update(id:, **params)
  response = Client.patch_request("notification-settings/#{id}", body: params)
  NotificationSetting.new(response.body["data"])
end