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.



310
311
312
313
314
315
316
317
318
319
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 310

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



323
324
325
326
327
328
329
330
331
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 323

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the UsAppToPersonInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 336

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      usAppToPerson_instance = UsAppToPersonInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, usAppToPerson_instance, response.headers, response.status_code)
end

#fetchUsAppToPersonInstance

Fetch the UsAppToPersonInstance

Returns:



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 355

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

#fetch_with_metadataUsAppToPersonInstance

Fetch the UsAppToPersonInstanceMetadata

Returns:



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 375

def 

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

#inspectObject

Provide a detailed, user friendly representation



504
505
506
507
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 504

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

#to_sObject

Provide a user friendly representation



497
498
499
500
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 497

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:



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 408

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

#update_with_metadata(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 UsAppToPersonInstanceMetadata

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:



453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 453

def (
  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', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    us_app_to_person_instance = UsAppToPersonInstance.new(
        @version,
        response.body,
        messaging_service_sid: @solution[:messaging_service_sid],
        sid: @solution[:sid],
    )
    .new(
        @version,
        us_app_to_person_instance,
        response.headers,
        response.status_code
    )
end