Class: NgrokAPI::Services::EndpointsClient
- Inherits:
-
Object
- Object
- NgrokAPI::Services::EndpointsClient
- Defined in:
- lib/ngrokapi/services/endpoints_client.rb
Overview
Endpoints provides an API for querying the endpoint objects which define what tunnel or edge is used to serve a hostport. Only active endpoints associated with a tunnel or backend are returned.
Constant Summary collapse
- PATH =
The API path for the requests
'/endpoints'
- LIST_PROPERTY =
The List Property from the resulting API for list calls
'endpoints'
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(url:, type:, traffic_policy:, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) ⇒ NgrokAPI::Models::Endpoint
Create an endpoint, currently available only for cloud endpoints.
-
#create!(url:, type:, traffic_policy:, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) ⇒ NgrokAPI::Models::Endpoint
Create an endpoint, currently available only for cloud endpoints Throws an exception if API error.
-
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete an Endpoint by ID, currently available only for cloud endpoints.
-
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete an Endpoint by ID, currently available only for cloud endpoints Throws an exception if API error.
-
#get(id: "") ⇒ NgrokAPI::Models::Endpoint
Get the status of an endpoint by ID.
-
#get!(id: "") ⇒ NgrokAPI::Models::Endpoint
Get the status of an endpoint by ID Throws an exception if API error.
-
#initialize(client:) ⇒ EndpointsClient
constructor
A new instance of EndpointsClient.
-
#list(before_id: nil, limit: nil, id: [], url: nil) ⇒ NgrokAPI::Models::Listable
List all active endpoints on the account.
-
#list!(before_id: nil, limit: nil, id: [], url: nil) ⇒ NgrokAPI::Models::Listable
List all active endpoints on the account Throws an exception if API error.
-
#update(id: "", url: nil, traffic_policy: nil, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) ⇒ NgrokAPI::Models::Endpoint
Update an Endpoint by ID, currently available only for cloud endpoints.
-
#update!(id: "", url: nil, traffic_policy: nil, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) ⇒ NgrokAPI::Models::Endpoint
Update an Endpoint by ID, currently available only for cloud endpoints Throws an exception if API error.
Constructor Details
#initialize(client:) ⇒ EndpointsClient
Returns a new instance of EndpointsClient.
21 22 23 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 21 def initialize(client:) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
19 20 21 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 19 def client @client end |
Instance Method Details
#create(url:, type:, traffic_policy:, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) ⇒ NgrokAPI::Models::Endpoint
Create an endpoint, currently available only for cloud endpoints
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 38 def create(url:, type:, traffic_policy:, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) path = '/endpoints' replacements = { } data = {} data[:url] = url if url data[:type] = type if type data[:traffic_policy] = traffic_policy if traffic_policy data[:description] = description if description data[:metadata] = if data[:bindings] = bindings if bindings data[:pooling_enabled] = pooling_enabled if pooling_enabled result = @client.post(path % replacements, data: data) NgrokAPI::Models::Endpoint.new(client: self, attrs: result) end |
#create!(url:, type:, traffic_policy:, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) ⇒ NgrokAPI::Models::Endpoint
Create an endpoint, currently available only for cloud endpoints Throws an exception if API error.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 68 def create!(url:, type:, traffic_policy:, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) path = '/endpoints' replacements = { } data = {} data[:url] = url if url data[:type] = type if type data[:traffic_policy] = traffic_policy if traffic_policy data[:description] = description if description data[:metadata] = if data[:bindings] = bindings if bindings data[:pooling_enabled] = pooling_enabled if pooling_enabled result = @client.post(path % replacements, data: data, danger: true) NgrokAPI::Models::Endpoint.new(client: self, attrs: result) end |
#delete(id: "") ⇒ NgrokAPI::Models::Empty
Delete an Endpoint by ID, currently available only for cloud endpoints
254 255 256 257 258 259 260 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 254 def delete(id: "") path = '/endpoints/%{id}' replacements = { id: id, } @client.delete(path % replacements) end |
#delete!(id: "") ⇒ NgrokAPI::Models::Empty
Delete an Endpoint by ID, currently available only for cloud endpoints Throws an exception if API error.
270 271 272 273 274 275 276 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 270 def delete!(id: "") path = '/endpoints/%{id}' replacements = { id: id, } @client.delete(path % replacements, danger: true) end |
#get(id: "") ⇒ NgrokAPI::Models::Endpoint
Get the status of an endpoint by ID
160 161 162 163 164 165 166 167 168 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 160 def get(id: "") path = '/endpoints/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data) NgrokAPI::Models::Endpoint.new(client: self, attrs: result) end |
#get!(id: "") ⇒ NgrokAPI::Models::Endpoint
Get the status of an endpoint by ID Throws an exception if API error.
178 179 180 181 182 183 184 185 186 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 178 def get!(id: "") path = '/endpoints/%{id}' replacements = { id: id, } data = {} result = @client.get(path % replacements, data: data, danger: true) NgrokAPI::Models::Endpoint.new(client: self, attrs: result) end |
#list(before_id: nil, limit: nil, id: [], url: nil) ⇒ NgrokAPI::Models::Listable
List all active endpoints on the account
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 95 def list( before_id: nil, limit: nil, id: [], url: nil ) result = @client.list( before_id: before_id, limit: limit, id: id, url: url, path: PATH ) NgrokAPI::Models::Listable.new( client: self, attrs: result, list_property: LIST_PROPERTY, klass: NgrokAPI::Models::Endpoint ) end |
#list!(before_id: nil, limit: nil, id: [], url: nil) ⇒ NgrokAPI::Models::Listable
List all active endpoints on the account Throws an exception if API error.
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 129 def list!( before_id: nil, limit: nil, id: [], url: nil ) result = @client.list( before_id: before_id, limit: limit, id: id, danger: true, url: url, path: PATH ) NgrokAPI::Models::Listable.new( client: self, attrs: result, list_property: LIST_PROPERTY, klass: NgrokAPI::Models::Endpoint, danger: true ) end |
#update(id: "", url: nil, traffic_policy: nil, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) ⇒ NgrokAPI::Models::Endpoint
Update an Endpoint by ID, currently available only for cloud endpoints
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 201 def update(id: "", url: nil, traffic_policy: nil, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) path = '/endpoints/%{id}' replacements = { id: id, } data = {} data[:url] = url if url data[:traffic_policy] = traffic_policy if traffic_policy data[:description] = description if description data[:metadata] = if data[:bindings] = bindings if bindings data[:pooling_enabled] = pooling_enabled if pooling_enabled result = @client.patch(path % replacements, data: data) NgrokAPI::Models::Endpoint.new(client: self, attrs: result) end |
#update!(id: "", url: nil, traffic_policy: nil, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) ⇒ NgrokAPI::Models::Endpoint
Update an Endpoint by ID, currently available only for cloud endpoints Throws an exception if API error.
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/ngrokapi/services/endpoints_client.rb', line 231 def update!(id: "", url: nil, traffic_policy: nil, description: nil, metadata: nil, bindings: nil, pooling_enabled: False) path = '/endpoints/%{id}' replacements = { id: id, } data = {} data[:url] = url if url data[:traffic_policy] = traffic_policy if traffic_policy data[:description] = description if description data[:metadata] = if data[:bindings] = bindings if bindings data[:pooling_enabled] = pooling_enabled if pooling_enabled result = @client.patch(path % replacements, data: data, danger: true) NgrokAPI::Models::Endpoint.new(client: self, attrs: result) end |