Class: Telnyx::Resources::Queues::Calls

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

Overview

Queue commands operations

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Calls

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

Parameters:



124
125
126
# File 'lib/telnyx/resources/queues/calls.rb', line 124

def initialize(client:)
  @client = client
end

Instance Method Details

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

Retrieve the list of calls in an existing queue

Parameters:

  • queue_name (String)

    Uniquely identifies the queue by name

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

Returns:

See Also:



80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/telnyx/resources/queues/calls.rb', line 80

def list(queue_name, params = {})
  parsed, options = Telnyx::Queues::CallListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["queues/%1$s/calls", queue_name],
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::Queues::CallListResponse,
    options: options
  )
end

#remove(call_control_id, queue_name:, request_options: {}) ⇒ nil

Removes an inactive call from a queue. If the call is no longer active, use this command to remove it from the queue.

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • queue_name (String)

    Uniquely identifies the queue by name

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

Returns:

  • (nil)

See Also:



107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/telnyx/resources/queues/calls.rb', line 107

def remove(call_control_id, params)
  parsed, options = Telnyx::Queues::CallRemoveParams.dump_request(params)
  queue_name =
    parsed.delete(:queue_name) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["queues/%1$s/calls/%2$s", queue_name, call_control_id],
    model: NilClass,
    options: options
  )
end

#retrieve(call_control_id, queue_name:, request_options: {}) ⇒ Telnyx::Models::Queues::CallRetrieveResponse

Retrieve an existing call from an existing queue

Parameters:

  • call_control_id (String)

    Unique identifier and token for controlling the call

  • queue_name (String)

    Uniquely identifies the queue by name

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

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/telnyx/resources/queues/calls.rb', line 21

def retrieve(call_control_id, params)
  parsed, options = Telnyx::Queues::CallRetrieveParams.dump_request(params)
  queue_name =
    parsed.delete(:queue_name) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["queues/%1$s/calls/%2$s", queue_name, call_control_id],
    model: Telnyx::Models::Queues::CallRetrieveResponse,
    options: options
  )
end

#update(call_control_id, queue_name:, keep_after_hangup: nil, request_options: {}) ⇒ nil

Update queued call’s keep_after_hangup flag

Parameters:

  • call_control_id (String)

    Path param: Unique identifier and token for controlling the call

  • queue_name (String)

    Path param: Uniquely identifies the queue by name

  • keep_after_hangup (Boolean)

    Body param: Whether the call should remain in queue after hangup.

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

Returns:

  • (nil)

See Also:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/telnyx/resources/queues/calls.rb', line 50

def update(call_control_id, params)
  parsed, options = Telnyx::Queues::CallUpdateParams.dump_request(params)
  queue_name =
    parsed.delete(:queue_name) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["queues/%1$s/calls/%2$s", queue_name, call_control_id],
    body: parsed,
    model: NilClass,
    options: options
  )
end