class NgrokAPI::Services::EndpointsClient

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.

ngrok.com/docs/api#api-endpoints

Constants

LIST_PROPERTY

The List Property from the resulting API for list calls

PATH

The API path for the requests

Attributes

client[R]

Public Class Methods

new(client:) click to toggle source
# File lib/ngrokapi/services/endpoints_client.rb, line 19
def initialize(client:)
  @client = client
end

Public Instance Methods

get(id: "") click to toggle source

Get the status of an endpoint by ID

@param [string] id a resource identifier @return [NgrokAPI::Models::Endpoint] result from the API request

ngrok.com/docs/api#api-endpoints-get

# File lib/ngrokapi/services/endpoints_client.rb, line 83
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: "") click to toggle source

Get the status of an endpoint by ID Throws an exception if API error.

@param [string] id a resource identifier @return [NgrokAPI::Models::Endpoint] result from the API request

ngrok.com/docs/api#api-endpoints-get

# File lib/ngrokapi/services/endpoints_client.rb, line 101
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, url: nil) click to toggle source

List all active endpoints on the account

@param [string] before_id @param [string] limit @param [string] url optional and mutually exclusive from before_id and limit @return [NgrokAPI::Models::Listable] result from the API request

ngrok.com/docs/api#api-endpoints-list

# File lib/ngrokapi/services/endpoints_client.rb, line 32
def list(before_id: nil, limit: nil, url: nil)
  result = @client.list(
    before_id: before_id,
    limit: limit,
    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, url: nil) click to toggle source

List all active endpoints on the account Throws an exception if API error.

@param [string] before_id @param [string] limit @param [string] url optional and mutually exclusive from before_id and limit @return [NgrokAPI::Models::Listable] result from the API request

ngrok.com/docs/api#api-endpoints-list

# File lib/ngrokapi/services/endpoints_client.rb, line 58
def list!(before_id: nil, limit: nil, url: nil)
  result = @client.list(
    before_id: before_id,
    limit: limit,
    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