Class: Telnyx::Resources::GlobalIPs

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

Overview

Global IPs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ GlobalIPs

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

Parameters:



104
105
106
# File 'lib/telnyx/resources/global_ips.rb', line 104

def initialize(client:)
  @client = client
end

Instance Method Details

#create(description: nil, name: nil, ports: nil, request_options: {}) ⇒ Telnyx::Models::GlobalIPCreateResponse

Requests creation of a new Global IP, a static IP address announced from the Telnyx network. Provisioning is asynchronous, so the request is accepted and the Global IP becomes available once provisioning completes.

Parameters:

  • description (String)

    A user specified description for the address.

  • name (String)

    A user specified name for the address.

  • ports (Hash{Symbol=>Object})

    A Global IP ports grouped by protocol code.

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

Returns:

See Also:



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

def create(params = {})
  parsed, options = Telnyx::GlobalIPCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "global_ips",
    body: parsed,
    model: Telnyx::Models::GlobalIPCreateResponse,
    options: options
  )
end

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

Deletes the specified Global IP and releases its address back to Telnyx.

Parameters:

  • id (String)

    Identifies the resource.

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

Returns:

See Also:



92
93
94
95
96
97
98
99
# File 'lib/telnyx/resources/global_ips.rb', line 92

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

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

Returns a paginated list of the Global IPs on your account, including each IP's address and configuration.

Parameters:

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

Returns:

See Also:



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/telnyx/resources/global_ips.rb', line 68

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

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

Returns the details of a single Global IP, including its address and current configuration.

Parameters:

  • id (String)

    Identifies the resource.

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

Returns:

See Also:



47
48
49
50
51
52
53
54
# File 'lib/telnyx/resources/global_ips.rb', line 47

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