Class: Twilio::REST::Messaging::V1::ServiceInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/service.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ ServiceInstance

Initialize the ServiceInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The sid



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 384

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'friendly_name' => payload['friendly_name'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'inbound_request_url' => payload['inbound_request_url'],
      'inbound_method' => payload['inbound_method'],
      'fallback_url' => payload['fallback_url'],
      'fallback_method' => payload['fallback_method'],
      'status_callback' => payload['status_callback'],
      'sticky_sender' => payload['sticky_sender'],
      'mms_converter' => payload['mms_converter'],
      'smart_encoding' => payload['smart_encoding'],
      'scan_message_content' => payload['scan_message_content'],
      'fallback_to_long_code' => payload['fallback_to_long_code'],
      'area_code_geomatch' => payload['area_code_geomatch'],
      'synchronous_validation' => payload['synchronous_validation'],
      'validity_period' => payload['validity_period'].to_i,
      'url' => payload['url'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns Unique 34 character ID of the Account that created this Service.

Returns:

  • (String)

    Unique 34 character ID of the Account that created this Service.



435
436
437
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 435

def 
  @properties['account_sid']
end

#alpha_sendersalpha_senders

Access the alpha_senders

Returns:



615
616
617
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 615

def alpha_senders
  context.alpha_senders
end

#area_code_geomatchBoolean

Returns Configuration to enable or disable Area Code Geomatch on your Service Instance.

Returns:

  • (Boolean)

    Configuration to enable or disable Area Code Geomatch on your Service Instance.



519
520
521
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 519

def area_code_geomatch
  @properties['area_code_geomatch']
end

#contextServiceContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



420
421
422
423
424
425
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 420

def context
  unless @instance_context
    @instance_context = ServiceContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The date that this resource was created.

Returns:

  • (Time)

    The date that this resource was created.



447
448
449
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 447

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated.

Returns:

  • (Time)

    The date that this resource was last updated.



453
454
455
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 453

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



594
595
596
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 594

def delete
  context.delete
end

#fallback_methodString

Returns The HTTP method Twilio will use when making requests to the Fallback URL.

Returns:

  • (String)

    The HTTP method Twilio will use when making requests to the Fallback URL.



477
478
479
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 477

def fallback_method
  @properties['fallback_method']
end

#fallback_to_long_codeBoolean

Returns Configuration to enable or disable Fallback to Long Code for messages sent through your Service instance.

Returns:

  • (Boolean)

    Configuration to enable or disable Fallback to Long Code for messages sent through your Service instance.



513
514
515
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 513

def fallback_to_long_code
  @properties['fallback_to_long_code']
end

#fallback_urlString

Returns The URL that Twilio will request if an error occurs when retrieving or executing the TwiML from your Inbound Request URL.

Returns:

  • (String)

    The URL that Twilio will request if an error occurs when retrieving or executing the TwiML from your Inbound Request URL.



471
472
473
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 471

def fallback_url
  @properties['fallback_url']
end

#fetchServiceInstance

Fetch a ServiceInstance

Returns:



587
588
589
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 587

def fetch
  context.fetch
end

#friendly_nameString

Returns A human readable descriptive text for this resource, up to 64 characters.

Returns:

  • (String)

    A human readable descriptive text for this resource, up to 64 characters.



441
442
443
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 441

def friendly_name
  @properties['friendly_name']
end

#inbound_methodString

Returns The HTTP method Twilio will use when making requests to the Inbound Request URL.

Returns:

  • (String)

    The HTTP method Twilio will use when making requests to the Inbound Request URL.



465
466
467
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 465

def inbound_method
  @properties['inbound_method']
end

#inbound_request_urlString

Returns The URL Twilio will make a webhook request to when a message is received by any phone number or short code in your Service.

Returns:

  • (String)

    The URL Twilio will make a webhook request to when a message is received by any phone number or short code in your Service.



459
460
461
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 459

def inbound_request_url
  @properties['inbound_request_url']
end

#inspectObject

Provide a detailed, user friendly representation



628
629
630
631
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 628

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Messaging.V1.ServiceInstance #{values}>"
end

Returns The links.

Returns:

  • (String)

    The links



543
544
545
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 543

def links
  @properties['links']
end

#mms_converterBoolean

Returns Configuration to enable or disable MMS Converter for messages sent through your Service instance.

Returns:

  • (Boolean)

    Configuration to enable or disable MMS Converter for messages sent through your Service instance.



495
496
497
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 495

def mms_converter
  @properties['mms_converter']
end

#phone_numbersphone_numbers

Access the phone_numbers

Returns:



601
602
603
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 601

def phone_numbers
  context.phone_numbers
end

#scan_message_contentservice.ScanMessageContent

Returns The scan_message_content.

Returns:

  • (service.ScanMessageContent)

    The scan_message_content



507
508
509
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 507

def scan_message_content
  @properties['scan_message_content']
end

#short_codesshort_codes

Access the short_codes

Returns:



608
609
610
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 608

def short_codes
  context.short_codes
end

#sidString

Returns Unique 34 character ID of the Service.

Returns:

  • (String)

    Unique 34 character ID of the Service.



429
430
431
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 429

def sid
  @properties['sid']
end

#smart_encodingBoolean

Returns Configuration to enable or disable Smart Encoding for messages sent through your Service instance.

Returns:

  • (Boolean)

    Configuration to enable or disable Smart Encoding for messages sent through your Service instance.



501
502
503
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 501

def smart_encoding
  @properties['smart_encoding']
end

#status_callbackString

Returns The URL Twilio will make a webhook request to when passing you status updates about the delivery of your messages.

Returns:

  • (String)

    The URL Twilio will make a webhook request to when passing you status updates about the delivery of your messages.



483
484
485
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 483

def status_callback
  @properties['status_callback']
end

#sticky_senderBoolean

Returns Configuration to enable or disable Sticky Sender on your Service instance.

Returns:

  • (Boolean)

    Configuration to enable or disable Sticky Sender on your Service instance.



489
490
491
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 489

def sticky_sender
  @properties['sticky_sender']
end

#synchronous_validationBoolean

Returns The synchronous_validation.

Returns:

  • (Boolean)

    The synchronous_validation



525
526
527
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 525

def synchronous_validation
  @properties['synchronous_validation']
end

#to_sObject

Provide a user friendly representation



621
622
623
624
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 621

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Messaging.V1.ServiceInstance #{values}>"
end

#update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset) ⇒ ServiceInstance

Update the ServiceInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    The friendly_name

  • inbound_request_url (String) (defaults to: :unset)

    The inbound_request_url

  • inbound_method (String) (defaults to: :unset)

    The inbound_method

  • fallback_url (String) (defaults to: :unset)

    The fallback_url

  • fallback_method (String) (defaults to: :unset)

    The fallback_method

  • status_callback (String) (defaults to: :unset)

    The status_callback

  • sticky_sender (Boolean) (defaults to: :unset)

    The sticky_sender

  • mms_converter (Boolean) (defaults to: :unset)

    The mms_converter

  • smart_encoding (Boolean) (defaults to: :unset)

    The smart_encoding

  • scan_message_content (service.ScanMessageContent) (defaults to: :unset)

    The scan_message_content

  • fallback_to_long_code (Boolean) (defaults to: :unset)

    The fallback_to_long_code

  • area_code_geomatch (Boolean) (defaults to: :unset)

    The area_code_geomatch

  • validity_period (String) (defaults to: :unset)

    The validity_period

  • synchronous_validation (Boolean) (defaults to: :unset)

    The synchronous_validation

Returns:



565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 565

def update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset)
  context.update(
      friendly_name: friendly_name,
      inbound_request_url: inbound_request_url,
      inbound_method: inbound_method,
      fallback_url: fallback_url,
      fallback_method: fallback_method,
      status_callback: status_callback,
      sticky_sender: sticky_sender,
      mms_converter: mms_converter,
      smart_encoding: smart_encoding,
      scan_message_content: scan_message_content,
      fallback_to_long_code: fallback_to_long_code,
      area_code_geomatch: area_code_geomatch,
      validity_period: validity_period,
      synchronous_validation: synchronous_validation,
  )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



537
538
539
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 537

def url
  @properties['url']
end

#validity_periodString

Returns The number of seconds all messages sent from your Service are valid for.

Returns:

  • (String)

    The number of seconds all messages sent from your Service are valid for.



531
532
533
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 531

def validity_period
  @properties['validity_period']
end