Class: Twilio::REST::Messaging::V1::ServiceContext::UsAppToPersonContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, messaging_service_sid, sid) ⇒ UsAppToPersonContext

Initialize the UsAppToPersonContext

Parameters:

  • version (Version)

    Version that contains the resource

  • messaging_service_sid (String)

    The SID of the [Messaging Service](www.twilio.com/docs/messaging/services/api) to update the resource from.

  • sid (String)

    The SID of the US A2P Compliance resource to update ‘QE2c6890da8086d771620e9b13fadeba0b`.



210
211
212
213
214
215
216
217
218
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 210

def initialize(version, messaging_service_sid, sid)
    super(version)

    # Path Solution
    @solution = { messaging_service_sid: messaging_service_sid, sid: sid,  }
    @uri = "/Services/#{@solution[:messaging_service_sid]}/Compliance/Usa2p/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the UsAppToPersonInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 222

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchUsAppToPersonInstance

Fetch the UsAppToPersonInstance

Returns:



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 234

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    UsAppToPersonInstance.new(
        @version,
        payload,
        messaging_service_sid: @solution[:messaging_service_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



306
307
308
309
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 306

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Messaging.V1.UsAppToPersonContext #{context}>"
end

#to_sObject

Provide a user friendly representation



299
300
301
302
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 299

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Messaging.V1.UsAppToPersonContext #{context}>"
end

#update(has_embedded_links: nil, has_embedded_phone: nil, message_samples: nil, message_flow: nil, description: nil, age_gated: nil, direct_lending: nil) ⇒ UsAppToPersonInstance

Update the UsAppToPersonInstance

Parameters:

  • has_embedded_links (Boolean) (defaults to: nil)

    Indicates that this SMS campaign will send messages that contain links.

  • has_embedded_phone (Boolean) (defaults to: nil)

    Indicates that this SMS campaign will send messages that contain phone numbers.

  • message_samples (Array[String]) (defaults to: nil)

    An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.

  • message_flow (String) (defaults to: nil)

    Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.

  • description (String) (defaults to: nil)

    A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.

  • age_gated (Boolean) (defaults to: nil)

    A boolean that specifies whether campaign requires age gate for federally legal content.

  • direct_lending (Boolean) (defaults to: nil)

    A boolean that specifies whether campaign allows direct lending or not.

Returns:



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 261

def update(
    has_embedded_links: nil, 
    has_embedded_phone: nil, 
    message_samples: nil, 
    message_flow: nil, 
    description: nil, 
    age_gated: nil, 
    direct_lending: nil
)

    data = Twilio::Values.of({
        'HasEmbeddedLinks' => has_embedded_links,
        'HasEmbeddedPhone' => has_embedded_phone,
        'MessageSamples' => Twilio.serialize_list(message_samples) { |e| e },
        'MessageFlow' => message_flow,
        'Description' => description,
        'AgeGated' => age_gated,
        'DirectLending' => direct_lending,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    UsAppToPersonInstance.new(
        @version,
        payload,
        messaging_service_sid: @solution[:messaging_service_sid],
        sid: @solution[:sid],
    )
end