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

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:



133
134
135
136
137
138
139
# File 'lib/telnyx/resources/portouts.rb', line 133

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)



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

def comments
  @comments
end

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



7
8
9
# File 'lib/telnyx/resources/portouts.rb', line 7

def events
  @events
end

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



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

def reports
  @reports
end

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



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

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:



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/telnyx/resources/portouts.rb', line 56

def list(params = {})
  parsed, options = Telnyx::PortoutListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "portouts",
    query: parsed.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:



84
85
86
87
88
89
90
91
92
93
# File 'lib/telnyx/resources/portouts.rb', line 84

def list_rejection_codes(portout_id, params = {})
  parsed, options = Telnyx::PortoutListRejectionCodesParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["portouts/rejections/%1$s", portout_id],
    query: parsed,
    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:



29
30
31
32
33
34
35
36
# File 'lib/telnyx/resources/portouts.rb', line 29

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:



115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/telnyx/resources/portouts.rb', line 115

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