Class: Increase::Resources::EventSubscriptions

Inherits:
Object
  • Object
show all
Defined in:
lib/increase/resources/event_subscriptions.rb,
sig/increase/resources/event_subscriptions.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EventSubscriptions

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 EventSubscriptions.

Parameters:



126
127
128
# File 'lib/increase/resources/event_subscriptions.rb', line 126

def initialize(client:)
  @client = client
end

Instance Method Details

#create(url:, oauth_connection_id: nil, selected_event_categories: nil, shared_secret: nil, status: nil, request_options: {}) ⇒ Increase::Models::EventSubscription

Create an Event Subscription

Parameters:

  • url (String)

    The URL you'd like us to send webhooks to.

  • oauth_connection_id (String)

    If specified, this subscription will only receive webhooks for Events associated with the specified OAuth Connection.

  • selected_event_categories (Array<Increase::Models::EventSubscriptionCreateParams::SelectedEventCategory>)

    If specified, this subscription will only receive webhooks for Events with the specified category. If specifying a Real-Time Decision event category, only one Event Category can be specified for the Event Subscription.

  • shared_secret (String)

    The key that will be used to sign webhooks. If no value is passed, a random string will be used as default.

  • status (Symbol, Increase::Models::EventSubscriptionCreateParams::Status)

    The status of the event subscription. Defaults to active if not specified.

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

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
# File 'lib/increase/resources/event_subscriptions.rb', line 33

def create(params)
  parsed, options = Increase::EventSubscriptionCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "event_subscriptions",
    body: parsed,
    model: Increase::EventSubscription,
    options: options
  )
end

#list(cursor: nil, idempotency_key: nil, limit: nil, request_options: {}) ⇒ Increase::Internal::Page<Increase::Models::EventSubscription>

List Event Subscriptions

Parameters:

  • cursor (String)

    Return the page of entries after this one.

  • idempotency_key (String)

    Filter records to the one with the specified idempotency_key you chose for that object. This value is unique across Increase and is used to ensure that a request is only processed once. Learn more about idempotency.

  • limit (Integer)

    Limit the size of the list that is returned. The default (and maximum) is 100 objects.

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

Returns:

See Also:



110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/increase/resources/event_subscriptions.rb', line 110

def list(params = {})
  parsed, options = Increase::EventSubscriptionListParams.dump_request(params)
  query = Increase::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "event_subscriptions",
    query: query,
    page: Increase::Internal::Page,
    model: Increase::EventSubscription,
    options: options
  )
end

#retrieve(event_subscription_id, request_options: {}) ⇒ Increase::Models::EventSubscription

Retrieve an Event Subscription

Parameters:

  • event_subscription_id (String)

    The identifier of the Event Subscription.

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

Returns:

See Also:



55
56
57
58
59
60
61
62
# File 'lib/increase/resources/event_subscriptions.rb', line 55

def retrieve(event_subscription_id, params = {})
  @client.request(
    method: :get,
    path: ["event_subscriptions/%1$s", event_subscription_id],
    model: Increase::EventSubscription,
    options: params[:request_options]
  )
end

#update(event_subscription_id, status: nil, request_options: {}) ⇒ Increase::Models::EventSubscription

Update an Event Subscription

Parameters:

Returns:

See Also:



78
79
80
81
82
83
84
85
86
87
# File 'lib/increase/resources/event_subscriptions.rb', line 78

def update(event_subscription_id, params = {})
  parsed, options = Increase::EventSubscriptionUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["event_subscriptions/%1$s", event_subscription_id],
    body: parsed,
    model: Increase::EventSubscription,
    options: options
  )
end