Class: Telnyx::Resources::Messaging10dlc::PhoneNumberCampaigns

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/messaging_10dlc/phone_number_campaigns.rb

Overview

Phone number campaign assignment

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PhoneNumberCampaigns

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

Parameters:



134
135
136
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_campaigns.rb', line 134

def initialize(client:)
  @client = client
end

Instance Method Details

#create(campaign_id:, phone_number:, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::PhoneNumberCampaign

Create New Phone Number Campaign

Parameters:

  • campaign_id (String)

    The ID of the campaign you want to link to the specified phone number.

  • phone_number (String)

    The phone number you want to link to a specified campaign.

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

Returns:

See Also:



21
22
23
24
25
26
27
28
29
30
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_campaigns.rb', line 21

def create(params)
  parsed, options = Telnyx::Messaging10dlc::PhoneNumberCampaignCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "10dlc/phone_number_campaigns",
    body: parsed,
    model: Telnyx::Messaging10dlc::PhoneNumberCampaign,
    options: options
  )
end

#delete(phone_number, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::PhoneNumberCampaign

This endpoint allows you to remove a campaign assignment from the supplied ‘phoneNumber`.

Parameters:

Returns:

See Also:



122
123
124
125
126
127
128
129
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_campaigns.rb', line 122

def delete(phone_number, params = {})
  @client.request(
    method: :delete,
    path: ["10dlc/phone_number_campaigns/%1$s", phone_number],
    model: Telnyx::Messaging10dlc::PhoneNumberCampaign,
    options: params[:request_options]
  )
end

#list(filter: nil, page: nil, records_per_page: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::PerPagePaginationV2<Telnyx::Models::Messaging10dlc::PhoneNumberCampaign>

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

List phone number campaigns

Parameters:

Returns:

See Also:



98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_campaigns.rb', line 98

def list(params = {})
  parsed, options = Telnyx::Messaging10dlc::PhoneNumberCampaignListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "10dlc/phone_number_campaigns",
    query: query.transform_keys(records_per_page: "recordsPerPage"),
    page: Telnyx::Internal::PerPagePaginationV2,
    model: Telnyx::Messaging10dlc::PhoneNumberCampaign,
    options: options
  )
end

#retrieve(phone_number, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::PhoneNumberCampaign

Retrieve an individual phone number/campaign assignment by ‘phoneNumber`.

Parameters:

Returns:

See Also:



42
43
44
45
46
47
48
49
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_campaigns.rb', line 42

def retrieve(phone_number, params = {})
  @client.request(
    method: :get,
    path: ["10dlc/phone_number_campaigns/%1$s", phone_number],
    model: Telnyx::Messaging10dlc::PhoneNumberCampaign,
    options: params[:request_options]
  )
end

#update(campaign_phone_number, campaign_id:, phone_number:, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::PhoneNumberCampaign

Create New Phone Number Campaign

Parameters:

  • campaign_phone_number (String)
  • campaign_id (String)

    The ID of the campaign you want to link to the specified phone number.

  • phone_number (String)

    The phone number you want to link to a specified campaign.

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

Returns:

See Also:



66
67
68
69
70
71
72
73
74
75
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_campaigns.rb', line 66

def update(campaign_phone_number, params)
  parsed, options = Telnyx::Messaging10dlc::PhoneNumberCampaignUpdateParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["10dlc/phone_number_campaigns/%1$s", campaign_phone_number],
    body: parsed,
    model: Telnyx::Messaging10dlc::PhoneNumberCampaign,
    options: options
  )
end