hookdeck 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rubocop.yml +42 -0
- data/.standard.yml +3 -0
- data/CHANGELOG.md +33 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/Makefile +22 -0
- data/README.md +249 -0
- data/Rakefile +10 -0
- data/lib/hookdeck/client.rb +168 -0
- data/lib/hookdeck/configuration.rb +31 -0
- data/lib/hookdeck/errors.rb +123 -0
- data/lib/hookdeck/http_client.rb +39 -0
- data/lib/hookdeck/middlewares/error_handler.rb +68 -0
- data/lib/hookdeck/middlewares/logging.rb +144 -0
- data/lib/hookdeck/middlewares/request_id.rb +39 -0
- data/lib/hookdeck/resources/attempt.rb +24 -0
- data/lib/hookdeck/resources/base.rb +174 -0
- data/lib/hookdeck/resources/bookmark.rb +70 -0
- data/lib/hookdeck/resources/bulk_event_retry.rb +40 -0
- data/lib/hookdeck/resources/bulk_ignored_event_retry.rb +36 -0
- data/lib/hookdeck/resources/bulk_request_retry.rb +31 -0
- data/lib/hookdeck/resources/connection.rb +62 -0
- data/lib/hookdeck/resources/custom_domain.rb +17 -0
- data/lib/hookdeck/resources/destination.rb +49 -0
- data/lib/hookdeck/resources/event.rb +29 -0
- data/lib/hookdeck/resources/issue.rb +32 -0
- data/lib/hookdeck/resources/issue_trigger.rb +56 -0
- data/lib/hookdeck/resources/notification.rb +30 -0
- data/lib/hookdeck/resources/request.rb +33 -0
- data/lib/hookdeck/resources/source.rb +49 -0
- data/lib/hookdeck/resources/transformation.rb +54 -0
- data/lib/hookdeck/resources.rb +20 -0
- data/lib/hookdeck/version.rb +5 -0
- data/lib/hookdeck.rb +39 -0
- data/sig/hookdeck.rbs +4 -0
- metadata +253 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Hookdeck
|
4
|
+
module Resources
|
5
|
+
# @example Create a new bookmark
|
6
|
+
# client.bookmarks.create(
|
7
|
+
# label: "Product Update – Out of Stock",
|
8
|
+
# event_data_id: "evtreq_HlJhb39nsjIP0FDsU3SY0fo7",
|
9
|
+
# webhook_id: "web_UfM5ZY2wxLD6sLhDaKMcx5wp"
|
10
|
+
# )
|
11
|
+
#
|
12
|
+
# @example Trigger a bookmark
|
13
|
+
# client.bookmarks.trigger('bkm_123')
|
14
|
+
#
|
15
|
+
class Bookmark < Base
|
16
|
+
def list(params = {})
|
17
|
+
get('bookmarks', params)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Retrieves a bookmark by ID.
|
21
|
+
#
|
22
|
+
# @param id [String] The ID of the bookmark.
|
23
|
+
# @return [Hash] The bookmark.
|
24
|
+
def retrieve(id)
|
25
|
+
validate_id!(id, 'bkm_')
|
26
|
+
get("bookmarks/#{id}")
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates a bookmark.
|
30
|
+
# {
|
31
|
+
# "label": "Product Update – Out of Stock",
|
32
|
+
# "event_data_id": "evtreq_HlJhb39nsjIP0FDsU3SY0fo7",
|
33
|
+
# "webhook_id": "web_UfM5ZY2wxLD6sLhDaKMcx5wp"
|
34
|
+
# }
|
35
|
+
# @param params [Hash] The parameters.
|
36
|
+
# @return [Hash] The bookmark.
|
37
|
+
def create(params)
|
38
|
+
post('bookmarks', params)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Updates a bookmark.
|
42
|
+
# @param id [String] The ID of the bookmark.
|
43
|
+
# @param params [Hash] The parameters.
|
44
|
+
# {
|
45
|
+
# "label": "Product Update – Out of Stock",
|
46
|
+
# "event_data_id": "evtreq_HlJhb39nsjIP0FDsU3SY0fo7",
|
47
|
+
# "webhook_id": "web_UfM5ZY2wxLD6sLhDaKMcx5wp"
|
48
|
+
# }
|
49
|
+
# @return [Hash] The bookmark.
|
50
|
+
def update(id, params)
|
51
|
+
validate_id!(id, 'bkm_')
|
52
|
+
put("bookmarks/#{id}", params)
|
53
|
+
end
|
54
|
+
|
55
|
+
# This endpoint uses a bookmark to create events.
|
56
|
+
# @param id [String] The ID of the bookmark.
|
57
|
+
# @param params [Hash] The parameters.
|
58
|
+
# @return [Hash] The bookmark.
|
59
|
+
def trigger(id, params = {})
|
60
|
+
validate_id!(id, 'bkm_')
|
61
|
+
post("bookmarks/#{id}/trigger", params)
|
62
|
+
end
|
63
|
+
|
64
|
+
def delete(id)
|
65
|
+
validate_id!(id, 'bkm_')
|
66
|
+
delete("bookmarks/#{id}")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class BulkEventRetry < Base
|
4
|
+
# List all pending bulk retries
|
5
|
+
def list(params = {})
|
6
|
+
get('bulk/events/retry', params)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a single bulk retry
|
10
|
+
# @param [String] id Bulk retry ID
|
11
|
+
def retrieve(id)
|
12
|
+
validate_id!(id, 'bulkr_')
|
13
|
+
get("bulk/events/retry/#{id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
# Cancel a pending bulk retry
|
17
|
+
# @param [String] id Bulk retry ID
|
18
|
+
def cancel(id)
|
19
|
+
validate_id!(id, 'blkr_')
|
20
|
+
post("bulk/events/retry/#{id}/cancel")
|
21
|
+
end
|
22
|
+
|
23
|
+
# Create a new bulk retry
|
24
|
+
# @param [Hash] params Bulk retry attributes
|
25
|
+
# @option params [Array<String>] :event_ids Event IDs to retry
|
26
|
+
# @option params [Hash] :config Override default retry configuration
|
27
|
+
def create(params)
|
28
|
+
post('bulk/events/retry', params)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get the plan for a bulk retry
|
32
|
+
# @param [Hash] params Bulk retry planning parameters
|
33
|
+
# @option params [Array<String>] :event_ids Event IDs to plan for
|
34
|
+
# @option params [Hash] :config Override default retry configuration
|
35
|
+
def plan(params)
|
36
|
+
get('bulk/events/retry/plan', params)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class BulkIgnoredEventsRetry < Base
|
4
|
+
# Cancel a pending bulk ignored events retry
|
5
|
+
def cancel_retry(id)
|
6
|
+
post("bulk/ignored-events/retry/#{id}/cancel")
|
7
|
+
end
|
8
|
+
|
9
|
+
# Get the plan for a bulk ignored events retry
|
10
|
+
def plan_retry(params)
|
11
|
+
get('bulk/ignored-events/retry/plan', params)
|
12
|
+
end
|
13
|
+
|
14
|
+
# List all pending bulk ignored events retries
|
15
|
+
def list_retries(params = {})
|
16
|
+
get('bulk/ignored-events/retry', params)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Retrieve a single bulk ignored events retry
|
20
|
+
# @param [String] id Bulk ignored events retry ID
|
21
|
+
def retrieve_retry(id)
|
22
|
+
get("bulk/ignored-events/retry/#{id}")
|
23
|
+
end
|
24
|
+
|
25
|
+
# Create a new bulk ignored events retry
|
26
|
+
def create_retry(params)
|
27
|
+
post('bulk/ignored-events/retry', params)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Cancel a bulk of ignored events
|
31
|
+
def cancel_ignored_events(id)
|
32
|
+
post("bulk/ignored-events/#{id}/cancel")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class BulkRequestsRetry < Base
|
4
|
+
# Cancel a pending bulk requests retry
|
5
|
+
def cancel_retry(id)
|
6
|
+
post("bulk/requests/retry/#{id}/cancel")
|
7
|
+
end
|
8
|
+
|
9
|
+
# Get the plan for a bulk requests retry
|
10
|
+
def plan_retry(params)
|
11
|
+
get('bulk/requests/retry/plan', params)
|
12
|
+
end
|
13
|
+
|
14
|
+
# List all pending bulk requests retries
|
15
|
+
def list_retries(params = {})
|
16
|
+
get('bulk/requests/retry', params)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Retrieve a single bulk requests retry
|
20
|
+
# @param [String] id Bulk requests retry ID
|
21
|
+
def retrieve_retry(id)
|
22
|
+
get("bulk/requests/retry/#{id}")
|
23
|
+
end
|
24
|
+
|
25
|
+
# Create a new bulk requests retry
|
26
|
+
def create_retry(params)
|
27
|
+
post('bulk/requests/retry', params)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# lib/hookdeck/resources/connection.rb
|
2
|
+
module Hookdeck
|
3
|
+
module Resources
|
4
|
+
class Connection < Base
|
5
|
+
# List all connections
|
6
|
+
def list(params = {})
|
7
|
+
get('connections', params)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Retrieve a single connection
|
11
|
+
# @param [String] id Connection ID
|
12
|
+
def retrieve(id)
|
13
|
+
get("connections/#{id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
# Create a new connection
|
17
|
+
def create(params)
|
18
|
+
post('connections', params)
|
19
|
+
end
|
20
|
+
|
21
|
+
# Upsert (create or update) a connection
|
22
|
+
def upsert(params)
|
23
|
+
put('connections', params)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Update a connection
|
27
|
+
def update(id, params)
|
28
|
+
put("connections/#{id}", params)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Disable a connection
|
32
|
+
# @param [String] id Connection ID
|
33
|
+
def disable(id)
|
34
|
+
put("connections/#{id}/disable")
|
35
|
+
end
|
36
|
+
|
37
|
+
# Enable a connection
|
38
|
+
# @param [String] id Connection ID
|
39
|
+
def enable(id)
|
40
|
+
put("connections/#{id}/enable")
|
41
|
+
end
|
42
|
+
|
43
|
+
# Pause a connection
|
44
|
+
# @param [String] id Connection ID
|
45
|
+
def pause(id)
|
46
|
+
put("connections/#{id}/pause")
|
47
|
+
end
|
48
|
+
|
49
|
+
# Unpause a connection
|
50
|
+
# @param [String] id Connection ID
|
51
|
+
def unpause(id)
|
52
|
+
put("connections/#{id}/unpause")
|
53
|
+
end
|
54
|
+
|
55
|
+
# Delete a connection
|
56
|
+
# @param [String] id Connection ID
|
57
|
+
def delete(id)
|
58
|
+
delete("connections/#{id}")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class CustomDomain < Base
|
4
|
+
def list(params = {})
|
5
|
+
get('teams/current/custom_domains', params)
|
6
|
+
end
|
7
|
+
|
8
|
+
def create(params = {})
|
9
|
+
post('teams/current/custom_domains', params)
|
10
|
+
end
|
11
|
+
|
12
|
+
def delete(id)
|
13
|
+
delete("teams/current/custom_domains/#{id}")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class Destination < Base
|
4
|
+
# List all destinations
|
5
|
+
def list(params = {})
|
6
|
+
get('destinations', params)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a single destination
|
10
|
+
# @param [String] id Destination ID
|
11
|
+
def retrieve(id)
|
12
|
+
get("destinations/#{id}")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Create a new destination
|
16
|
+
def create(params)
|
17
|
+
post('destinations', params)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Upsert (create or update) a destination
|
21
|
+
def upsert(params)
|
22
|
+
put('destinations', params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Update a destination
|
26
|
+
def update(id, params)
|
27
|
+
put("destinations/#{id}", params)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Disable a destination
|
31
|
+
# @param [String] id Destination ID
|
32
|
+
def disable(id)
|
33
|
+
put("destinations/#{id}/disable")
|
34
|
+
end
|
35
|
+
|
36
|
+
# Enable a destination
|
37
|
+
# @param [String] id Destination ID
|
38
|
+
def enable(id)
|
39
|
+
put("destinations/#{id}/enable")
|
40
|
+
end
|
41
|
+
|
42
|
+
# Delete a destination
|
43
|
+
# @param [String] id Destination ID
|
44
|
+
def delete(id)
|
45
|
+
delete("destinations/#{id}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class Event < Base
|
4
|
+
# List all events
|
5
|
+
def list(params = {})
|
6
|
+
get('events', params)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a single event
|
10
|
+
# @param [String] id Event ID
|
11
|
+
def retrieve(id)
|
12
|
+
validate_id!(id, 'evt_')
|
13
|
+
get("events/#{id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
# Retry an event
|
17
|
+
def retry(id, params = {})
|
18
|
+
validate_id!(id, 'evt_')
|
19
|
+
post("events/#{id}/retry", params)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Mute an event
|
23
|
+
def mute(id, params = {})
|
24
|
+
validate_id!(id, 'evt_')
|
25
|
+
put("events/#{id}/mute", params)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class Issue < Base
|
4
|
+
# List all issues
|
5
|
+
def list(params = {})
|
6
|
+
get('issues', params)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a single issue
|
10
|
+
# @param [String] id Issue ID
|
11
|
+
def retrieve(id)
|
12
|
+
get("issues/#{id}")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Create a new issue
|
16
|
+
def create(params)
|
17
|
+
post('issues', params)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Update an existing issue
|
21
|
+
def update(id, params)
|
22
|
+
put("issues/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Delete an issue
|
26
|
+
# @param [String] id Issue ID
|
27
|
+
def delete(id)
|
28
|
+
delete("issues/#{id}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class IssueTrigger < Base
|
4
|
+
# List all issue triggers
|
5
|
+
def list(params = {})
|
6
|
+
get('issue-triggers', params)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a single issue trigger
|
10
|
+
# @param [String] id Issue trigger ID
|
11
|
+
def retrieve(id)
|
12
|
+
get("issue-triggers/#{id}")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Create a new issue trigger
|
16
|
+
def create(params)
|
17
|
+
post('issue-triggers', params)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Update an issue trigger
|
21
|
+
def update(id, params)
|
22
|
+
put("issue-triggers/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Upsert (create or update) an issue trigger
|
26
|
+
def upsert(params)
|
27
|
+
put('issue-triggers', params)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Trigger an issue manually
|
31
|
+
# @param [String] id Issue trigger ID
|
32
|
+
# @param [Hash] params Optional trigger parameters
|
33
|
+
def trigger(id, params = {})
|
34
|
+
post("issue-triggers/#{id}", params)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Disable an issue trigger
|
38
|
+
# @param [String] id Issue trigger ID
|
39
|
+
def disable(id)
|
40
|
+
put("issue-triggers/#{id}/disable")
|
41
|
+
end
|
42
|
+
|
43
|
+
# Enable an issue trigger
|
44
|
+
# @param [String] id Issue trigger ID
|
45
|
+
def enable(id)
|
46
|
+
put("issue-triggers/#{id}/enable")
|
47
|
+
end
|
48
|
+
|
49
|
+
# Delete an issue trigger
|
50
|
+
# @param [String] id Issue trigger ID
|
51
|
+
def delete(id)
|
52
|
+
delete("issue-triggers/#{id}")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class Notification < Base
|
4
|
+
# Configure webhook notifications for the project
|
5
|
+
def configure_webhooks(params)
|
6
|
+
validate_webhook_params!(params)
|
7
|
+
put('notifications/webhooks', params)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def validate_webhook_params!(params)
|
13
|
+
required_keys = %i[enabled topics source_id]
|
14
|
+
validate_params!(params, required_keys)
|
15
|
+
|
16
|
+
# Validate enabled is boolean
|
17
|
+
validate_boolean!(params[:enabled], 'enabled')
|
18
|
+
|
19
|
+
# Validate topics is array of strings
|
20
|
+
validate_array!(params[:topics], 'topics')
|
21
|
+
params[:topics].each do |topic|
|
22
|
+
validate_string!(topic, 'topic')
|
23
|
+
end
|
24
|
+
|
25
|
+
# Validate source_id format
|
26
|
+
validate_id!(params[:source_id], 'src_')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class Request < Base
|
4
|
+
# List all requests
|
5
|
+
def list(params = {})
|
6
|
+
get('requests', params)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a single request
|
10
|
+
# @param [String] id Request ID
|
11
|
+
def retrieve(id)
|
12
|
+
get("requests/#{id}")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Retry a request
|
16
|
+
# @param [String] id Request ID
|
17
|
+
def retry(id, params = {})
|
18
|
+
post("requests/#{id}/retry", params)
|
19
|
+
end
|
20
|
+
|
21
|
+
# List events for a request
|
22
|
+
# @param [String] id Request ID
|
23
|
+
def list_events(id, params = {})
|
24
|
+
get("requests/#{id}/events", params)
|
25
|
+
end
|
26
|
+
|
27
|
+
# List ignored events for a request
|
28
|
+
def list_ignored_events(id, params = {})
|
29
|
+
get("requests/#{id}/ignored_events", params)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class Source < Base
|
4
|
+
# List all sources
|
5
|
+
def list(params = {})
|
6
|
+
get('sources', params)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a single source
|
10
|
+
# @param [String] id Source ID
|
11
|
+
def retrieve(id)
|
12
|
+
get("sources/#{id}")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Create a new source
|
16
|
+
def create(params)
|
17
|
+
post('sources', params)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Upsert (create or update) a source
|
21
|
+
def upsert(params)
|
22
|
+
put('sources', params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Update a source
|
26
|
+
def update(id, params)
|
27
|
+
put("sources/#{id}", params)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Disable a source
|
31
|
+
# @param [String] id Source ID
|
32
|
+
def disable(id)
|
33
|
+
put("sources/#{id}/disable")
|
34
|
+
end
|
35
|
+
|
36
|
+
# Enable a source
|
37
|
+
# @param [String] id Source ID
|
38
|
+
def enable(id)
|
39
|
+
put("sources/#{id}/enable")
|
40
|
+
end
|
41
|
+
|
42
|
+
# Delete a source
|
43
|
+
# @param [String] id Source ID
|
44
|
+
def delete(id)
|
45
|
+
delete("sources/#{id}")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
class Transformation < Base
|
4
|
+
# List all transformations
|
5
|
+
def list(params = {})
|
6
|
+
get('transformations', params)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Retrieve a single transformation
|
10
|
+
# @param [String] id Transformation ID
|
11
|
+
def retrieve(id)
|
12
|
+
get("transformations/#{id}")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Create a new transformation
|
16
|
+
def create(params)
|
17
|
+
post('transformations', params)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Update a transformation
|
21
|
+
def update(id, params)
|
22
|
+
put("transformations/#{id}", params)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Upsert (create or update) a transformation
|
26
|
+
def upsert(params)
|
27
|
+
put('transformations', params)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Run a transformation
|
31
|
+
def run(params)
|
32
|
+
put('transformations/run', params)
|
33
|
+
end
|
34
|
+
|
35
|
+
# List executions for a transformation
|
36
|
+
def list_executions(id, params = {})
|
37
|
+
get("transformations/#{id}/executions", params)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Get a specific execution
|
41
|
+
# @param [String] id Transformation ID
|
42
|
+
# @param [String] execution_id Execution ID
|
43
|
+
def retrieve_execution(id, execution_id)
|
44
|
+
get("transformations/#{id}/executions/#{execution_id}")
|
45
|
+
end
|
46
|
+
|
47
|
+
# Delete a transformation
|
48
|
+
# @param [String] id Transformation ID
|
49
|
+
def delete(id)
|
50
|
+
delete("transformations/#{id}")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Hookdeck
|
2
|
+
module Resources
|
3
|
+
autoload :Base, 'hookdeck/resources/base'
|
4
|
+
autoload :Bookmark, 'hookdeck/resources/bookmark'
|
5
|
+
autoload :Attempt, 'hookdeck/resources/attempt'
|
6
|
+
autoload :Connection, 'hookdeck/resources/connection'
|
7
|
+
autoload :CustomDomain, 'hookdeck/resources/custom_domain'
|
8
|
+
autoload :Destination, 'hookdeck/resources/destination'
|
9
|
+
autoload :Event, 'hookdeck/resources/event'
|
10
|
+
autoload :EventBulkRetry, 'hookdeck/resources/event_bulk_retry'
|
11
|
+
autoload :IgnoredEventBulkRetry, 'hookdeck/resources/ignored_event_bulk_retry'
|
12
|
+
autoload :Issue, 'hookdeck/resources/issue'
|
13
|
+
autoload :IssueTrigger, 'hookdeck/resources/issue_trigger'
|
14
|
+
autoload :Notification, 'hookdeck/resources/notification'
|
15
|
+
autoload :Request, 'hookdeck/resources/request'
|
16
|
+
autoload :RequestBulkRetry, 'hookdeck/resources/request_bulk_retry'
|
17
|
+
autoload :Source, 'hookdeck/resources/source'
|
18
|
+
autoload :Transformation, 'hookdeck/resources/transformation'
|
19
|
+
end
|
20
|
+
end
|
data/lib/hookdeck.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
require 'faraday'
|
3
|
+
require 'faraday_middleware'
|
4
|
+
require 'json'
|
5
|
+
require 'logger'
|
6
|
+
require 'uri'
|
7
|
+
|
8
|
+
require_relative 'hookdeck/version'
|
9
|
+
require_relative 'hookdeck/errors'
|
10
|
+
require_relative 'hookdeck/configuration'
|
11
|
+
require_relative 'hookdeck/client'
|
12
|
+
require_relative 'hookdeck/http_client'
|
13
|
+
require_relative 'hookdeck/resources'
|
14
|
+
|
15
|
+
module Hookdeck
|
16
|
+
autoload :VERSION, 'hookdeck/version'
|
17
|
+
autoload :Configuration, 'hookdeck/configuration'
|
18
|
+
autoload :Client, 'hookdeck/client'
|
19
|
+
autoload :Resources, 'hookdeck/resources'
|
20
|
+
autoload :Error, 'hookdeck/errors'
|
21
|
+
|
22
|
+
class << self
|
23
|
+
def new(api_key = nil, options = {})
|
24
|
+
Client.new(api_key, options)
|
25
|
+
end
|
26
|
+
|
27
|
+
def configure
|
28
|
+
yield(configuration)
|
29
|
+
end
|
30
|
+
|
31
|
+
def configuration
|
32
|
+
@configuration ||= Configuration.new
|
33
|
+
end
|
34
|
+
|
35
|
+
def reset!
|
36
|
+
@configuration = nil
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/sig/hookdeck.rbs
ADDED