Class: NgrokAPI::Services::EventSourcesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/ngrokapi/services/event_sources_client.rb

Overview

Constant Summary collapse

PATH =

The API path for the requests

'/event_subscriptions/%{subscription_id}/sources'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EventSourcesClient

Returns a new instance of EventSourcesClient.



15
16
17
# File 'lib/ngrokapi/services/event_sources_client.rb', line 15

def initialize(client:)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



13
14
15
# File 'lib/ngrokapi/services/event_sources_client.rb', line 13

def client
  @client
end

Instance Method Details

#create(subscription_id: "", type: "", filter: "", fields: []) ⇒ NgrokAPI::Models::EventSource

Add an additional type for which this event subscription will trigger

ngrok.com/docs/api#api-event-sources-create

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

  • type (string) (defaults to: "")

    Type of event for which an event subscription will trigger

Returns:



27
28
29
30
31
32
33
34
35
36
# File 'lib/ngrokapi/services/event_sources_client.rb', line 27

def create(subscription_id: "", type: "", filter: "", fields: [])
  path = '/event_subscriptions/%{subscription_id}/sources'
  replacements = {
    subscription_id: subscription_id,
  }
  data = {}
  data[:type] = type if type
  result = @client.post(path % replacements, data: data)
  NgrokAPI::Models::EventSource.new(client: self, attrs: result)
end

#create!(subscription_id: "", type: "", filter: "", fields: []) ⇒ NgrokAPI::Models::EventSource

Add an additional type for which this event subscription will trigger Throws an exception if API error.

ngrok.com/docs/api#api-event-sources-create

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

  • type (string) (defaults to: "")

    Type of event for which an event subscription will trigger

Returns:



47
48
49
50
51
52
53
54
55
56
# File 'lib/ngrokapi/services/event_sources_client.rb', line 47

def create!(subscription_id: "", type: "", filter: "", fields: [])
  path = '/event_subscriptions/%{subscription_id}/sources'
  replacements = {
    subscription_id: subscription_id,
  }
  data = {}
  data[:type] = type if type
  result = @client.post(path % replacements, data: data, danger: true)
  NgrokAPI::Models::EventSource.new(client: self, attrs: result)
end

#delete(subscription_id: "", type: "") ⇒ NgrokAPI::Models::Empty

Remove a type for which this event subscription will trigger

ngrok.com/docs/api#api-event-sources-delete

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

  • type (string) (defaults to: "")

    Type of event for which an event subscription will trigger

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



66
67
68
69
70
71
72
73
# File 'lib/ngrokapi/services/event_sources_client.rb', line 66

def delete(subscription_id: "", type: "")
  path = '/event_subscriptions/%{subscription_id}/sources/%{type}'
  replacements = {
    subscription_id: subscription_id,
    type: type,
  }
  @client.delete(path % replacements)
end

#delete!(subscription_id: "", type: "") ⇒ NgrokAPI::Models::Empty

Remove a type for which this event subscription will trigger Throws an exception if API error.

ngrok.com/docs/api#api-event-sources-delete

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

  • type (string) (defaults to: "")

    Type of event for which an event subscription will trigger

Returns:

  • (NgrokAPI::Models::Empty)

    result from the API request



84
85
86
87
88
89
90
91
# File 'lib/ngrokapi/services/event_sources_client.rb', line 84

def delete!(subscription_id: "", type: "")
  path = '/event_subscriptions/%{subscription_id}/sources/%{type}'
  replacements = {
    subscription_id: subscription_id,
    type: type,
  }
  @client.delete(path % replacements, danger: true)
end

#get(subscription_id: "", type: "") ⇒ NgrokAPI::Models::EventSource

Get the details for a given type that triggers for the given event subscription

ngrok.com/docs/api#api-event-sources-get

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

  • type (string) (defaults to: "")

    Type of event for which an event subscription will trigger

Returns:



101
102
103
104
105
106
107
108
109
110
# File 'lib/ngrokapi/services/event_sources_client.rb', line 101

def get(subscription_id: "", type: "")
  path = '/event_subscriptions/%{subscription_id}/sources/%{type}'
  replacements = {
    subscription_id: subscription_id,
    type: type,
  }
  data = {}
  result = @client.get(path % replacements, data: data)
  NgrokAPI::Models::EventSource.new(client: self, attrs: result)
end

#get!(subscription_id: "", type: "") ⇒ NgrokAPI::Models::EventSource

Get the details for a given type that triggers for the given event subscription Throws an exception if API error.

ngrok.com/docs/api#api-event-sources-get

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

  • type (string) (defaults to: "")

    Type of event for which an event subscription will trigger

Returns:



121
122
123
124
125
126
127
128
129
130
# File 'lib/ngrokapi/services/event_sources_client.rb', line 121

def get!(subscription_id: "", type: "")
  path = '/event_subscriptions/%{subscription_id}/sources/%{type}'
  replacements = {
    subscription_id: subscription_id,
    type: type,
  }
  data = {}
  result = @client.get(path % replacements, data: data, danger: true)
  NgrokAPI::Models::EventSource.new(client: self, attrs: result)
end

#list(subscription_id: "") ⇒ NgrokAPI::Models::EventSourceList

List the types for which this event subscription will trigger

ngrok.com/docs/api#api-event-sources-list

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

Returns:



139
140
141
142
143
144
145
146
147
# File 'lib/ngrokapi/services/event_sources_client.rb', line 139

def list(subscription_id: "")
  path = '/event_subscriptions/%{subscription_id}/sources'
  replacements = {
    subscription_id: subscription_id,
  }
  data = {}
  result = @client.get(path % replacements, data: data)
  NgrokAPI::Models::EventSourceList.new(client: self, attrs: result)
end

#list!(subscription_id: "") ⇒ NgrokAPI::Models::EventSourceList

List the types for which this event subscription will trigger Throws an exception if API error.

ngrok.com/docs/api#api-event-sources-list

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

Returns:



157
158
159
160
161
162
163
164
165
# File 'lib/ngrokapi/services/event_sources_client.rb', line 157

def list!(subscription_id: "")
  path = '/event_subscriptions/%{subscription_id}/sources'
  replacements = {
    subscription_id: subscription_id,
  }
  data = {}
  result = @client.get(path % replacements, data: data, danger: true)
  NgrokAPI::Models::EventSourceList.new(client: self, attrs: result)
end

#update(subscription_id: "", type: "", filter: nil, fields: nil) ⇒ NgrokAPI::Models::EventSource

Update the type for which this event subscription will trigger

ngrok.com/docs/api#api-event-sources-update

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

  • type (string) (defaults to: "")

    Type of event for which an event subscription will trigger

Returns:



175
176
177
178
179
180
181
182
183
184
# File 'lib/ngrokapi/services/event_sources_client.rb', line 175

def update(subscription_id: "", type: "", filter: nil, fields: nil)
  path = '/event_subscriptions/%{subscription_id}/sources/%{type}'
  replacements = {
    subscription_id: subscription_id,
    type: type,
  }
  data = {}
  result = @client.patch(path % replacements, data: data)
  NgrokAPI::Models::EventSource.new(client: self, attrs: result)
end

#update!(subscription_id: "", type: "", filter: nil, fields: nil) ⇒ NgrokAPI::Models::EventSource

Update the type for which this event subscription will trigger Throws an exception if API error.

ngrok.com/docs/api#api-event-sources-update

Parameters:

  • subscription_id (string) (defaults to: "")

    The unique identifier for the Event Subscription that this Event Source is attached to.

  • type (string) (defaults to: "")

    Type of event for which an event subscription will trigger

Returns:



195
196
197
198
199
200
201
202
203
204
# File 'lib/ngrokapi/services/event_sources_client.rb', line 195

def update!(subscription_id: "", type: "", filter: nil, fields: nil)
  path = '/event_subscriptions/%{subscription_id}/sources/%{type}'
  replacements = {
    subscription_id: subscription_id,
    type: type,
  }
  data = {}
  result = @client.patch(path % replacements, data: data, danger: true)
  NgrokAPI::Models::EventSource.new(client: self, attrs: result)
end