class Twilio::REST::Messaging::V1::ServiceInstance

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

Public Class Methods

new(version, payload, sid: nil) click to toggle source

Initialize the ServiceInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] sid The SID of the Service resource to fetch. @return [ServiceInstance] ServiceInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/messaging/v1/service.rb
442 def initialize(version, payload, sid: nil)
443   super(version)
444 
445   # Marshaled Properties
446   @properties = {
447       'sid' => payload['sid'],
448       'account_sid' => payload['account_sid'],
449       'friendly_name' => payload['friendly_name'],
450       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
451       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
452       'inbound_request_url' => payload['inbound_request_url'],
453       'inbound_method' => payload['inbound_method'],
454       'fallback_url' => payload['fallback_url'],
455       'fallback_method' => payload['fallback_method'],
456       'status_callback' => payload['status_callback'],
457       'sticky_sender' => payload['sticky_sender'],
458       'mms_converter' => payload['mms_converter'],
459       'smart_encoding' => payload['smart_encoding'],
460       'scan_message_content' => payload['scan_message_content'],
461       'fallback_to_long_code' => payload['fallback_to_long_code'],
462       'area_code_geomatch' => payload['area_code_geomatch'],
463       'synchronous_validation' => payload['synchronous_validation'],
464       'validity_period' => payload['validity_period'].to_i,
465       'url' => payload['url'],
466       'links' => payload['links'],
467       'use_inbound_webhook_on_number' => payload['use_inbound_webhook_on_number'],
468   }
469 
470   # Context
471   @instance_context = nil
472   @params = {'sid' => sid || @properties['sid'], }
473 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
494 def account_sid
495   @properties['account_sid']
496 end
alpha_senders() click to toggle source

Access the alpha_senders @return [alpha_senders] alpha_senders

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
712 def alpha_senders
713   context.alpha_senders
714 end
area_code_geomatch() click to toggle source

@return [Boolean] Whether to enable Area Code Geomatch on the Service Instance

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
578 def area_code_geomatch
579   @properties['area_code_geomatch']
580 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [ServiceContext] ServiceContext for this ServiceInstance

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
479 def context
480   unless @instance_context
481     @instance_context = ServiceContext.new(@version, @params['sid'], )
482   end
483   @instance_context
484 end
date_created() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
506 def date_created
507   @properties['date_created']
508 end
date_updated() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
512 def date_updated
513   @properties['date_updated']
514 end
delete() click to toggle source

Delete the ServiceInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
691 def delete
692   context.delete
693 end
fallback_method() click to toggle source

@return [String] The HTTP method we use to call fallback_url

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
536 def fallback_method
537   @properties['fallback_method']
538 end
fallback_to_long_code() click to toggle source

@return [Boolean] Whether to enable Fallback to Long Code for messages sent through the Service instance

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
572 def fallback_to_long_code
573   @properties['fallback_to_long_code']
574 end
fallback_url() click to toggle source

@return [String] The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled.

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
530 def fallback_url
531   @properties['fallback_url']
532 end
fetch() click to toggle source

Fetch the ServiceInstance @return [ServiceInstance] Fetched ServiceInstance

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
684 def fetch
685   context.fetch
686 end
friendly_name() click to toggle source

@return [String] The string that you assigned to describe the resource

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
500 def friendly_name
501   @properties['friendly_name']
502 end
inbound_method() click to toggle source

@return [String] The HTTP method we use to call inbound_request_url

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
524 def inbound_method
525   @properties['inbound_method']
526 end
inbound_request_url() click to toggle source

@return [String] The URL we call using inbound_method when a message is received by any phone number or short code in the Service. This field will be overridden if the `use_inbound_webhook_on_number` field is enabled.

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
518 def inbound_request_url
519   @properties['inbound_request_url']
520 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
739 def inspect
740   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
741   "<Twilio.Messaging.V1.ServiceInstance #{values}>"
742 end
mms_converter() click to toggle source

@return [Boolean] Whether to enable the MMS Converter for messages sent through the Service instance

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
554 def mms_converter
555   @properties['mms_converter']
556 end
phone_numbers() click to toggle source

Access the phone_numbers @return [phone_numbers] phone_numbers

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
698 def phone_numbers
699   context.phone_numbers
700 end
scan_message_content() click to toggle source

@return [service.ScanMessageContent] Reserved

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
566 def scan_message_content
567   @properties['scan_message_content']
568 end
short_codes() click to toggle source

Access the short_codes @return [short_codes] short_codes

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
705 def short_codes
706   context.short_codes
707 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
488 def sid
489   @properties['sid']
490 end
smart_encoding() click to toggle source

@return [Boolean] Whether to enable Encoding for messages sent through the Service instance

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
560 def smart_encoding
561   @properties['smart_encoding']
562 end
status_callback() click to toggle source

@return [String] The URL we call to pass status updates about message delivery

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
542 def status_callback
543   @properties['status_callback']
544 end
sticky_sender() click to toggle source

@return [Boolean] Whether to enable Sticky Sender on the Service instance

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
548 def sticky_sender
549   @properties['sticky_sender']
550 end
synchronous_validation() click to toggle source

@return [Boolean] Reserved

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
584 def synchronous_validation
585   @properties['synchronous_validation']
586 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
732 def to_s
733   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
734   "<Twilio.Messaging.V1.ServiceInstance #{values}>"
735 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, use_inbound_webhook_on_number: :unset) click to toggle source

Update the ServiceInstance @param [String] friendly_name A descriptive string that you create to describe

the resource. It can be up to 64 characters long.

@param [String] inbound_request_url The URL we call using `inbound_method` when

a message is received by any phone number or short code in the Service. When
this property is `null`, receiving inbound messages is disabled. All messages
sent to the Twilio phone number or short code will not be logged and received on
the Account. If the `use_inbound_webhook_on_number` field is enabled then the
webhook url defined on the phone number will override the `inbound_request_url`
defined for the Messaging Service.

@param [String] inbound_method The HTTP method we should use to call

`inbound_request_url`. Can be `GET` or `POST` and the default is `POST`.

@param [String] fallback_url The URL that we call using `fallback_method` if an

error occurs while retrieving or executing the TwiML from the Inbound Request
URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook
url defined on the phone number will override the `fallback_url` defined for the
Messaging Service.

@param [String] fallback_method The HTTP method we should use to call

`fallback_url`. Can be: `GET` or `POST`.

@param [String] status_callback The URL we should call to {pass status

updates}[https://www.twilio.com/docs/sms/api/message-resource#message-status-values]
about message delivery.

@param [Boolean] sticky_sender Whether to enable {Sticky

Sender}[https://www.twilio.com/docs/sms/services#sticky-sender] on the Service
instance.

@param [Boolean] mms_converter Whether to enable the {MMS

Converter}[https://www.twilio.com/docs/sms/services#mms-converter] for messages
sent through the Service instance.

@param [Boolean] smart_encoding Whether to enable {Smart

Encoding}[https://www.twilio.com/docs/sms/services#smart-encoding] for messages
sent through the Service instance.

@param [service.ScanMessageContent] scan_message_content Reserved. @param [Boolean] fallback_to_long_code Whether to enable {Fallback to Long

Code}[https://www.twilio.com/docs/sms/services#fallback-to-long-code] for
messages sent through the Service instance.

@param [Boolean] area_code_geomatch Whether to enable {Area Code

Geomatch}[https://www.twilio.com/docs/sms/services#area-code-geomatch] on the
Service Instance.

@param [String] validity_period How long, in seconds, messages sent from the

Service are valid. Can be an integer from `1` to `14,400`.

@param [Boolean] synchronous_validation Reserved. @param [Boolean] use_inbound_webhook_on_number A boolean value that indicates

either the webhook url configured on the phone number will be used or
`inbound_request_url`/`fallback_url` url will be called when a message is
received from the phone number. If this field is enabled then the webhook url
defined on the phone number will override the
`inbound_request_url`/`fallback_url` defined for the Messaging Service.

@return [ServiceInstance] Updated ServiceInstance

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
661 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, use_inbound_webhook_on_number: :unset)
662   context.update(
663       friendly_name: friendly_name,
664       inbound_request_url: inbound_request_url,
665       inbound_method: inbound_method,
666       fallback_url: fallback_url,
667       fallback_method: fallback_method,
668       status_callback: status_callback,
669       sticky_sender: sticky_sender,
670       mms_converter: mms_converter,
671       smart_encoding: smart_encoding,
672       scan_message_content: scan_message_content,
673       fallback_to_long_code: fallback_to_long_code,
674       area_code_geomatch: area_code_geomatch,
675       validity_period: validity_period,
676       synchronous_validation: synchronous_validation,
677       use_inbound_webhook_on_number: use_inbound_webhook_on_number,
678   )
679 end
url() click to toggle source

@return [String] The absolute URL of the Service resource

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
596 def url
597   @properties['url']
598 end
us_app_to_person() click to toggle source

Access the us_app_to_person @return [us_app_to_person] us_app_to_person

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
719 def us_app_to_person
720   context.us_app_to_person
721 end
us_app_to_person_usecases() click to toggle source

Access the us_app_to_person_usecases @return [us_app_to_person_usecases] us_app_to_person_usecases

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
726 def us_app_to_person_usecases
727   context.us_app_to_person_usecases
728 end
use_inbound_webhook_on_number() click to toggle source

@return [Boolean] If enabled, the webhook url configured on the phone number will be used and will override the `inbound_request_url`/`fallback_url` url called when an inbound message is received.

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
608 def use_inbound_webhook_on_number
609   @properties['use_inbound_webhook_on_number']
610 end
validity_period() click to toggle source

@return [String] How long, in seconds, messages sent from the Service are valid

    # File lib/twilio-ruby/rest/messaging/v1/service.rb
590 def validity_period
591   @properties['validity_period']
592 end