Class: Telnyx::Resources::Portouts

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/portouts.rb,
lib/telnyx/resources/portouts/events.rb,
lib/telnyx/resources/portouts/reports.rb,
lib/telnyx/resources/portouts/comments.rb,
lib/telnyx/resources/portouts/supporting_documents.rb

Overview

Number portout operations

Defined Under Namespace

Classes: Comments, Events, Reports, SupportingDocuments

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Portouts

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

Parameters:



140
141
142
143
144
145
146
# File 'lib/telnyx/resources/portouts.rb', line 140

def initialize(client:)
  @client = client
  @events = Telnyx::Resources::Portouts::Events.new(client: client)
  @reports = Telnyx::Resources::Portouts::Reports.new(client: client)
  @comments = Telnyx::Resources::Portouts::Comments.new(client: client)
  @supporting_documents = Telnyx::Resources::Portouts::SupportingDocuments.new(client: client)
end

Instance Attribute Details

#commentsTelnyx::Resources::Portouts::Comments (readonly)

Number portout operations



17
18
19
# File 'lib/telnyx/resources/portouts.rb', line 17

def comments
  @comments
end

#eventsTelnyx::Resources::Portouts::Events (readonly)

Number portout operations



9
10
11
# File 'lib/telnyx/resources/portouts.rb', line 9

def events
  @events
end

#reportsTelnyx::Resources::Portouts::Reports (readonly)

Number portout operations



13
14
15
# File 'lib/telnyx/resources/portouts.rb', line 13

def reports
  @reports
end

#supporting_documentsTelnyx::Resources::Portouts::SupportingDocuments (readonly)

Number portout operations



21
22
23
# File 'lib/telnyx/resources/portouts.rb', line 21

def supporting_documents
  @supporting_documents
end

Instance Method Details

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

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

Returns the portout requests according to filters

Parameters:

Returns:

See Also:



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/telnyx/resources/portouts.rb', line 61

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

#list_rejection_codes(portout_id, filter: nil, request_options: {}) ⇒ Telnyx::Models::PortoutListRejectionCodesResponse

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

Given a port-out ID, list rejection codes that are eligible for that port-out

Parameters:

Returns:

See Also:



90
91
92
93
94
95
96
97
98
99
100
# File 'lib/telnyx/resources/portouts.rb', line 90

def list_rejection_codes(portout_id, params = {})
  parsed, options = Telnyx::PortoutListRejectionCodesParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["portouts/rejections/%1$s", portout_id],
    query: query,
    model: Telnyx::Models::PortoutListRejectionCodesResponse,
    options: options
  )
end

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

Returns the portout request based on the ID provided

Parameters:

Returns:

See Also:



34
35
36
37
38
39
40
41
# File 'lib/telnyx/resources/portouts.rb', line 34

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

#update_status(status, id:, reason:, host_messaging: nil, request_options: {}) ⇒ Telnyx::Models::PortoutUpdateStatusResponse

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

Authorize or reject portout request

Parameters:

  • status (Symbol, Telnyx::Models::PortoutUpdateStatusParams::Status)

    Path param: Updated portout status

  • id (String)

    Path param: Portout id

  • reason (String)

    Body param: Provide a reason if rejecting the port out request

  • host_messaging (Boolean)

    Body param: Indicates whether messaging services should be maintained with Telny

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

Returns:

See Also:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/telnyx/resources/portouts.rb', line 122

def update_status(status, params)
  parsed, options = Telnyx::PortoutUpdateStatusParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["portouts/%1$s/%2$s", id, status],
    body: parsed,
    model: Telnyx::Models::PortoutUpdateStatusResponse,
    options: options
  )
end