Class: Moonbase::Resources::WebhookEndpoints

Inherits:
Object
  • Object
show all
Defined in:
lib/moonbase/resources/webhook_endpoints.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ WebhookEndpoints

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of WebhookEndpoints.

Parameters:



134
135
136
# File 'lib/moonbase/resources/webhook_endpoints.rb', line 134

def initialize(client:)
  @client = client
end

Instance Method Details

#create(status:, url:, subscriptions: nil, request_options: {}) ⇒ Moonbase::Models::Endpoint

Create a new endpoint.

Parameters:

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
# File 'lib/moonbase/resources/webhook_endpoints.rb', line 21

def create(params)
  parsed, options = Moonbase::WebhookEndpointCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "webhook_endpoints",
    body: parsed,
    model: Moonbase::Endpoint,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ nil

Permanently deletes an endpoint.

Parameters:

  • id (String)

    The ID of the Webhook Endpoint to delete.

  • request_options (Moonbase::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



122
123
124
125
126
127
128
129
# File 'lib/moonbase/resources/webhook_endpoints.rb', line 122

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["webhook_endpoints/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end

#list(after: nil, before: nil, limit: nil, request_options: {}) ⇒ Moonbase::Internal::CursorPage<Moonbase::Models::Endpoint>

Some parameter documentations has been truncated, see Models::WebhookEndpointListParams for more details.

Returns a list of endpoints.

Parameters:

  • after (String)

    When specified, returns results starting immediately after the item identified b

  • before (String)

    When specified, returns results starting immediately before the item identified

  • limit (Integer)

    Maximum number of items to return per page. Must be between 1 and 100. Defaults

  • request_options (Moonbase::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/moonbase/resources/webhook_endpoints.rb', line 98

def list(params = {})
  parsed, options = Moonbase::WebhookEndpointListParams.dump_request(params)
  query = Moonbase::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "webhook_endpoints",
    query: query,
    page: Moonbase::Internal::CursorPage,
    model: Moonbase::Endpoint,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Moonbase::Models::Endpoint

Retrieves the details of an existing endpoint.

Parameters:

  • id (String)

    The ID of the Webhook Endpoint to retrieve.

  • request_options (Moonbase::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



43
44
45
46
47
48
49
50
# File 'lib/moonbase/resources/webhook_endpoints.rb', line 43

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["webhook_endpoints/%1$s", id],
    model: Moonbase::Endpoint,
    options: params[:request_options]
  )
end

#update(id, status: nil, subscriptions: nil, url: nil, request_options: {}) ⇒ Moonbase::Models::Endpoint

Updates an endpoint.

Parameters:

Returns:

See Also:



69
70
71
72
73
74
75
76
77
78
# File 'lib/moonbase/resources/webhook_endpoints.rb', line 69

def update(id, params = {})
  parsed, options = Moonbase::WebhookEndpointUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["webhook_endpoints/%1$s", id],
    body: parsed,
    model: Moonbase::Endpoint,
    options: options
  )
end