Class: Twilio::REST::Messaging::V1::ExternalCampaignList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/external_campaign.rb

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ ExternalCampaignList

Initialize the ExternalCampaignList

Parameters:

  • Version that contains the resource



26
27
28
29
30
31
32
33
# File 'lib/twilio-ruby/rest/messaging/v1/external_campaign.rb', line 26

def initialize(version)
    super(version)
    
    # Path Solution
    @solution = {  }
    @uri = "/Services/PreregisteredUsa2p"
    
end

Instance Method Details

#create(campaign_id: nil, messaging_service_sid: nil, cnp_migration: :unset) ⇒ ExternalCampaignInstance

Create the ExternalCampaignInstance

Parameters:

  • (defaults to: nil)

    ID of the preregistered campaign.

  • (defaults to: nil)

    The SID of the Messaging Service that the resource is associated with.

  • (defaults to: :unset)

    Customers should use this flag during the ERC registration process to indicate to Twilio that the campaign being registered is undergoing CNP migration. It is important for the user to first trigger the CNP migration process for said campaign in their CSP portal and have Twilio accept the sharing request, before making this api call.

Returns:

  • Created ExternalCampaignInstance



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/twilio-ruby/rest/messaging/v1/external_campaign.rb', line 40

def create(
  campaign_id: nil, 
  messaging_service_sid: nil, 
  cnp_migration: :unset
)

    data = Twilio::Values.of({
        'CampaignId' => campaign_id,
        'MessagingServiceSid' => messaging_service_sid,
        'CnpMigration' => cnp_migration,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    ExternalCampaignInstance.new(
        @version,
        payload,
    )
end

#create_with_metadata(campaign_id: nil, messaging_service_sid: nil, cnp_migration: :unset) ⇒ ExternalCampaignInstance

Create the ExternalCampaignInstanceMetadata

Parameters:

  • (defaults to: nil)

    ID of the preregistered campaign.

  • (defaults to: nil)

    The SID of the Messaging Service that the resource is associated with.

  • (defaults to: :unset)

    Customers should use this flag during the ERC registration process to indicate to Twilio that the campaign being registered is undergoing CNP migration. It is important for the user to first trigger the CNP migration process for said campaign in their CSP portal and have Twilio accept the sharing request, before making this api call.

Returns:

  • Created ExternalCampaignInstance



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/twilio-ruby/rest/messaging/v1/external_campaign.rb', line 71

def (
  campaign_id: nil, 
  messaging_service_sid: nil, 
  cnp_migration: :unset
)

    data = Twilio::Values.of({
        'CampaignId' => campaign_id,
        'MessagingServiceSid' => messaging_service_sid,
        'CnpMigration' => cnp_migration,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    external_campaign_instance = ExternalCampaignInstance.new(
        @version,
        response.body,
    )
    .new(
        @version,
        external_campaign_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



106
107
108
# File 'lib/twilio-ruby/rest/messaging/v1/external_campaign.rb', line 106

def to_s
    '#<Twilio.Messaging.V1.ExternalCampaignList>'
end