Class: Dyte::PresetsResource

Inherits:
Resource show all
Defined in:
lib/dyte/resources/presets.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Dyte::Resource

Instance Method Details

#create(**attributes) ⇒ Object



8
9
10
# File 'lib/dyte/resources/presets.rb', line 8

def create(**attributes)
  Preset.new post_request("presets", body: attributes).body.dig("data")
end

#delete(preset_id:) ⇒ Object



16
17
18
# File 'lib/dyte/resources/presets.rb', line 16

def delete(preset_id:)
  Preset.new delete_request("presets/#{preset_id}").body.dig("data")
end

#fetch(preset_id:) ⇒ Object



12
13
14
# File 'lib/dyte/resources/presets.rb', line 12

def fetch(preset_id:)
  Preset.new get_request("presets/#{preset_id}").body.dig("data")
end

#list(**params) ⇒ Object



3
4
5
6
# File 'lib/dyte/resources/presets.rb', line 3

def list(**params)
  response = get_request("presets", params: params)
  Collection.from_response(response, type: Preset)
end

#update(preset_id:, **attributes) ⇒ Object



20
21
22
# File 'lib/dyte/resources/presets.rb', line 20

def update(preset_id:, **attributes)
  Preset.new patch_request("presets/#{preset_id}", body: attributes).body.dig("data")
end