Class: HookSniff::Endpoint
- Inherits:
-
Object
- Object
- HookSniff::Endpoint
- Defined in:
- lib/hooksniff/api/endpoint.rb
Instance Method Summary collapse
- #create(endpoint_in, options = {}) ⇒ Object
- #delete(endpoint_id) ⇒ Object
- #get(endpoint_id) ⇒ Object
- #get_headers(endpoint_id) ⇒ Object
- #get_secret(endpoint_id) ⇒ Object
-
#initialize(client) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #list(options = {}) ⇒ Object
- #patch(endpoint_id, endpoint_patch) ⇒ Object
- #patch_headers(endpoint_id, endpoint_headers_patch_in) ⇒ Object
- #rotate_secret(endpoint_id, endpoint_secret_rotate_in) ⇒ Object
- #update(endpoint_id, endpoint_update) ⇒ Object
- #update_headers(endpoint_id, endpoint_headers_in) ⇒ Object
Constructor Details
#initialize(client) ⇒ Endpoint
Returns a new instance of Endpoint.
7 8 9 |
# File 'lib/hooksniff/api/endpoint.rb', line 7 def initialize(client) @client = client end |
Instance Method Details
#create(endpoint_in, options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hooksniff/api/endpoint.rb', line 24 def create(endpoint_in, = {}) = .transform_keys(&:to_s) res = @client.execute_request( "POST", "/v1/endpoints", headers: { "idempotency-key" => ["idempotency-key"] }, body: endpoint_in ) EndpointOut.deserialize(res) end |
#delete(endpoint_id) ⇒ Object
60 61 62 63 |
# File 'lib/hooksniff/api/endpoint.rb', line 60 def delete(endpoint_id) @client.execute_request("DELETE", "/v1/endpoints/#{endpoint_id}") nil end |
#get(endpoint_id) ⇒ Object
37 38 39 40 |
# File 'lib/hooksniff/api/endpoint.rb', line 37 def get(endpoint_id) res = @client.execute_request("GET", "/v1/endpoints/#{endpoint_id}") EndpointOut.deserialize(res) end |
#get_headers(endpoint_id) ⇒ Object
74 75 76 77 |
# File 'lib/hooksniff/api/endpoint.rb', line 74 def get_headers(endpoint_id) res = @client.execute_request("GET", "/v1/endpoints/#{endpoint_id}/headers") EndpointHeadersOut.deserialize(res) end |
#get_secret(endpoint_id) ⇒ Object
97 98 99 100 |
# File 'lib/hooksniff/api/endpoint.rb', line 97 def get_secret(endpoint_id) res = @client.execute_request("GET", "/v1/endpoints/#{endpoint_id}/secret") EndpointSecretOut.deserialize(res) end |
#list(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hooksniff/api/endpoint.rb', line 11 def list( = {}) = .transform_keys(&:to_s) res = @client.execute_request( "GET", "/v1/endpoints", query_params: { "limit" => ["limit"], "offset" => ["offset"] } ) ListResponseEndpointOut.deserialize(res) end |
#patch(endpoint_id, endpoint_patch) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/hooksniff/api/endpoint.rb', line 51 def patch(endpoint_id, endpoint_patch) res = @client.execute_request( "PATCH", "/v1/endpoints/#{endpoint_id}", body: endpoint_patch ) EndpointOut.deserialize(res) end |
#patch_headers(endpoint_id, endpoint_headers_patch_in) ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/hooksniff/api/endpoint.rb', line 88 def patch_headers(endpoint_id, endpoint_headers_patch_in) @client.execute_request( "PATCH", "/v1/endpoints/#{endpoint_id}/headers", body: endpoint_headers_patch_in ) nil end |
#rotate_secret(endpoint_id, endpoint_secret_rotate_in) ⇒ Object
65 66 67 68 69 70 71 72 |
# File 'lib/hooksniff/api/endpoint.rb', line 65 def rotate_secret(endpoint_id, endpoint_secret_rotate_in) res = @client.execute_request( "POST", "/v1/endpoints/#{endpoint_id}/rotate-secret", body: endpoint_secret_rotate_in ) EndpointSecretOut.deserialize(res) end |
#update(endpoint_id, endpoint_update) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/hooksniff/api/endpoint.rb', line 42 def update(endpoint_id, endpoint_update) res = @client.execute_request( "PUT", "/v1/endpoints/#{endpoint_id}", body: endpoint_update ) EndpointOut.deserialize(res) end |
#update_headers(endpoint_id, endpoint_headers_in) ⇒ Object
79 80 81 82 83 84 85 86 |
# File 'lib/hooksniff/api/endpoint.rb', line 79 def update_headers(endpoint_id, endpoint_headers_in) @client.execute_request( "PUT", "/v1/endpoints/#{endpoint_id}/headers", body: endpoint_headers_in ) nil end |