Class: Apertur::Resources::Destinations
- Inherits:
-
Object
- Object
- Apertur::Resources::Destinations
- Defined in:
- lib/apertur/resources/destinations.rb
Overview
Manage delivery destinations within a project.
Destinations define where uploaded images are delivered (e.g. cloud storage buckets, webhooks, etc.).
Instance Method Summary collapse
-
#create(project_id, **config) ⇒ Hash
Create a new destination.
-
#delete(project_id, dest_id) ⇒ nil
Delete a destination.
-
#initialize(http) ⇒ Destinations
constructor
A new instance of Destinations.
-
#list(project_id) ⇒ Array<Hash>
List all destinations for a project.
-
#test(project_id, dest_id) ⇒ Hash
Send a test payload to a destination.
-
#update(project_id, dest_id, **config) ⇒ Hash
Update an existing destination.
Constructor Details
#initialize(http) ⇒ Destinations
Returns a new instance of Destinations.
11 12 13 |
# File 'lib/apertur/resources/destinations.rb', line 11 def initialize(http) @http = http end |
Instance Method Details
#create(project_id, **config) ⇒ Hash
Create a new destination.
28 29 30 |
# File 'lib/apertur/resources/destinations.rb', line 28 def create(project_id, **config) @http.request(:post, "/api/v1/projects/#{project_id}/destinations", body: config) end |
#delete(project_id, dest_id) ⇒ nil
Delete a destination.
47 48 49 |
# File 'lib/apertur/resources/destinations.rb', line 47 def delete(project_id, dest_id) @http.request(:delete, "/api/v1/projects/#{project_id}/destinations/#{dest_id}") end |
#list(project_id) ⇒ Array<Hash>
List all destinations for a project.
19 20 21 |
# File 'lib/apertur/resources/destinations.rb', line 19 def list(project_id) @http.request(:get, "/api/v1/projects/#{project_id}/destinations") end |
#test(project_id, dest_id) ⇒ Hash
Send a test payload to a destination.
56 57 58 |
# File 'lib/apertur/resources/destinations.rb', line 56 def test(project_id, dest_id) @http.request(:post, "/api/v1/projects/#{project_id}/destinations/#{dest_id}/test") end |
#update(project_id, dest_id, **config) ⇒ Hash
Update an existing destination.
38 39 40 |
# File 'lib/apertur/resources/destinations.rb', line 38 def update(project_id, dest_id, **config) @http.request(:patch, "/api/v1/projects/#{project_id}/destinations/#{dest_id}", body: config) end |