Class: Increase::Resources::EventSubscriptions

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EventSubscriptions

Returns a new instance of EventSubscriptions.



6
7
8
# File 'lib/increase/resources/event_subscriptions.rb', line 6

def initialize(client:)
  @client = client
end

Instance Method Details

#create(params = {}, opts = {}) ⇒ Increase::Models::EventSubscription

Create an Event Subscription

Parameters:

  • params (Hash) (defaults to: {})

    Attributes to send in this request.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Options Hash (params):

  • :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_category (Symbol)

    If specified, this subscription will only receive webhooks for Events with the specified category.

  • :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.

Returns:



24
25
26
27
28
29
30
31
# File 'lib/increase/resources/event_subscriptions.rb', line 24

def create(params = {}, opts = {})
  req = {}
  req[:method] = :post
  req[:path] = "/event_subscriptions"
  req[:body] = params
  req[:model] = Increase::Models::EventSubscription
  @client.request(req, opts)
end

#list(params = {}, opts = {}) ⇒ Increase::Page<Increase::Models::EventSubscription>

List Event Subscriptions

Parameters:

  • params (Hash) (defaults to: {})

    Attributes to send in this request.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Options Hash (params):

  • :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.

Returns:



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

def list(params = {}, opts = {})
  req = {}
  req[:method] = :get
  req[:path] = "/event_subscriptions"
  req[:query] = params
  req[:page] = Increase::Page
  req[:model] = Increase::Models::EventSubscription
  @client.request(req, opts)
end

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

Retrieve an Event Subscription

Parameters:

  • event_subscription_id (String)

    The identifier of the Event Subscription.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Returns:



39
40
41
42
43
44
45
# File 'lib/increase/resources/event_subscriptions.rb', line 39

def retrieve(event_subscription_id, opts = {})
  req = {}
  req[:method] = :get
  req[:path] = "/event_subscriptions/#{event_subscription_id}"
  req[:model] = Increase::Models::EventSubscription
  @client.request(req, opts)
end

#update(event_subscription_id, params = {}, opts = {}) ⇒ Increase::Models::EventSubscription

Update an Event Subscription

Parameters:

  • event_subscription_id (String)

    The identifier of the Event Subscription.

  • params (Hash) (defaults to: {})

    Attributes to send in this request.

  • opts (Hash|RequestOptions) (defaults to: {})

    Options to specify HTTP behaviour for this request.

Options Hash (params):

  • :status (Symbol)

    The status to update the Event Subscription with.

Returns:



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

def update(event_subscription_id, params = {}, opts = {})
  req = {}
  req[:method] = :patch
  req[:path] = "/event_subscriptions/#{event_subscription_id}"
  req[:body] = params
  req[:model] = Increase::Models::EventSubscription
  @client.request(req, opts)
end