Class: Telnyx::Resources::Connections

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/connections.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Connections

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Connections.

Parameters:



94
95
96
# File 'lib/telnyx/resources/connections.rb', line 94

def initialize(client:)
  @client = client
end

Instance Method Details

#list(filter: nil, page_number: nil, page_size: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::ConnectionListResponse>

Some parameter documentations has been truncated, see Models::ConnectionListParams for more details.

Returns a list of your connections irrespective of type.

filter[connection_

Parameters:

Returns:

See Also:



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/telnyx/resources/connections.rb', line 48

def list(params = {})
  parsed, options = Telnyx::ConnectionListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "connections",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::ConnectionListResponse,
    options: options
  )
end

#list_active_calls(connection_id, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::ConnectionListActiveCallsResponse>

Lists all active calls for given connection. Acceptable connections are either SIP connections with webhook_url or xml_request_url, call control or texml. Returned results are cursor paginated.

Parameters:

  • connection_id (String)

    Telnyx connection id

  • page_number (Integer)
  • page_size (Integer)
  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/telnyx/resources/connections.rb', line 78

def list_active_calls(connection_id, params = {})
  parsed, options = Telnyx::ConnectionListActiveCallsParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["connections/%1$s/active_calls", connection_id],
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::ConnectionListActiveCallsResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::ConnectionRetrieveResponse

Retrieves the high-level details of an existing connection. To retrieve specific authentication information, use the endpoint for the specific connection type.

Parameters:

Returns:

See Also:



18
19
20
21
22
23
24
25
# File 'lib/telnyx/resources/connections.rb', line 18

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["connections/%1$s", id],
    model: Telnyx::Models::ConnectionRetrieveResponse,
    options: params[:request_options]
  )
end