Class: Telnyx::Resources::PhoneNumberBlocks::Jobs

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/phone_number_blocks/jobs.rb

Overview

Background jobs performed over a phone-numbers block’s phone numbers

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Jobs

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

Parameters:



89
90
91
# File 'lib/telnyx/resources/phone_number_blocks/jobs.rb', line 89

def initialize(client:)
  @client = client
end

Instance Method Details

#delete_phone_number_block(phone_number_block_id:, request_options: {}) ⇒ Telnyx::Models::PhoneNumberBlocks::JobDeletePhoneNumberBlockResponse

Creates a new background job to delete all the phone numbers associated with the given block. We will only consider the phone number block as deleted after all phone numbers associated with it are removed, so multiple executions of this job may be necessary in case some of the phone numbers present errors during the deletion process.

Parameters:

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
# File 'lib/telnyx/resources/phone_number_blocks/jobs.rb', line 75

def delete_phone_number_block(params)
  parsed, options = Telnyx::PhoneNumberBlocks::JobDeletePhoneNumberBlockParams.dump_request(params)
  @client.request(
    method: :post,
    path: "phone_number_blocks/jobs/delete_phone_number_block",
    body: parsed,
    model: Telnyx::Models::PhoneNumberBlocks::JobDeletePhoneNumberBlockResponse,
    options: options
  )
end

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

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

Lists the phone number blocks jobs

Parameters:

Returns:

See Also:



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/telnyx/resources/phone_number_blocks/jobs.rb', line 48

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

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

Retrieves a phone number blocks job

Parameters:

  • id (String)

    Identifies the Phone Number Blocks Job.

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

Returns:

See Also:



19
20
21
22
23
24
25
26
# File 'lib/telnyx/resources/phone_number_blocks/jobs.rb', line 19

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