Class: Telnyx::Resources::IPs

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ips.rb,
sig/telnyx/resources/ips.rbs

Overview

IP operations

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ IPs

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 IPs.

Parameters:



137
138
139
# File 'lib/telnyx/resources/ips.rb', line 137

def initialize(client:)
  @client = client
end

Instance Method Details

#create(ip_address:, connection_id: nil, port: nil, request_options: {}) ⇒ Telnyx::Models::IPCreateResponse

Creates a new IP record for use with IP-based connections, associating an IP address with the specified connection.

Parameters:

  • ip_address (String)

    IP adddress represented by this resource.

  • connection_id (String)

    ID of the IP Connection to which this IP should be attached.

  • port (Integer)

    Port to use when connecting to this IP.

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

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/telnyx/resources/ips.rb', line 23

def create(params)
  parsed, options = Telnyx::IPCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "ips",
    body: parsed,
    model: Telnyx::Models::IPCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Telnyx::Models::IPDeleteResponse

Permanently deletes the specified IP record from its connection.

Parameters:

  • id (String)

    Identifies the type of resource.

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

Returns:

See Also:



125
126
127
128
129
130
131
132
# File 'lib/telnyx/resources/ips.rb', line 125

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

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

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

Get all IPs belonging to the user that match the given filters.

filter[connection_

Parameters:

Returns:

See Also:



101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/telnyx/resources/ips.rb', line 101

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

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

Return the details regarding a specific IP.

Parameters:

  • id (String)

    Identifies the type of resource.

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

Returns:

See Also:



45
46
47
48
49
50
51
52
# File 'lib/telnyx/resources/ips.rb', line 45

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

#update(id, ip_address:, connection_id: nil, port: nil, request_options: {}) ⇒ Telnyx::Models::IPUpdateResponse

Updates the details of the specified IP record and returns the updated IP.

Parameters:

  • id (String)

    Identifies the type of resource.

  • ip_address (String)

    IP adddress represented by this resource.

  • connection_id (String)

    ID of the IP Connection to which this IP should be attached.

  • port (Integer)

    Port to use when connecting to this IP.

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

Returns:

See Also:



71
72
73
74
75
76
77
78
79
80
# File 'lib/telnyx/resources/ips.rb', line 71

def update(id, params)
  parsed, options = Telnyx::IPUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["ips/%1$s", id],
    body: parsed,
    model: Telnyx::Models::IPUpdateResponse,
    options: options
  )
end