Class: NgrokAPI::Services::EventSourcesClient
- Inherits:
-
Object
- Object
- NgrokAPI::Services::EventSourcesClient
- 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
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(subscription_id: "", type: "", filter: "", fields: []) ⇒ NgrokAPI::Models::EventSource
Add an additional type for which this event subscription will trigger.
-
#delete(subscription_id: "", type: "") ⇒ NgrokAPI::Models::Empty
Remove a type for which this event subscription will trigger.
-
#delete!(subscription_id: "", type: "") ⇒ NgrokAPI::Models::Empty
Remove a type for which this event subscription will trigger Throws an exception if API error.
-
#get(subscription_id: "", type: "") ⇒ NgrokAPI::Models::EventSource
Get the details for a given type that triggers for the given event subscription.
-
#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.
-
#initialize(client:) ⇒ EventSourcesClient
constructor
A new instance of EventSourcesClient.
-
#update(subscription_id: "", type: "", filter: nil, fields: nil) ⇒ NgrokAPI::Models::EventSource
Update the type for which this event subscription will trigger.
-
#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.
Constructor Details
#initialize(client:) ⇒ EventSourcesClient
Returns a new instance of EventSourcesClient.
13 14 15 |
# File 'lib/ngrokapi/services/event_sources_client.rb', line 13 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
11 12 13 |
# File 'lib/ngrokapi/services/event_sources_client.rb', line 11 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
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ngrokapi/services/event_sources_client.rb', line 25 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, result: result) end |
#delete(subscription_id: "", type: "") ⇒ NgrokAPI::Models::Empty
Remove a type for which this event subscription will trigger
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ngrokapi/services/event_sources_client.rb', line 49 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.
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ngrokapi/services/event_sources_client.rb', line 70 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
90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/ngrokapi/services/event_sources_client.rb', line 90 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, result: 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.
113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/ngrokapi/services/event_sources_client.rb', line 113 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, result: result) end |
#update(subscription_id: "", type: "", filter: nil, fields: nil) ⇒ NgrokAPI::Models::EventSource
Update the type for which this event subscription will trigger
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/ngrokapi/services/event_sources_client.rb', line 135 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, result: 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.
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/ngrokapi/services/event_sources_client.rb', line 160 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, result: result) end |