class Twilio::REST::Proxy::V1::ServiceInstance
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Public Class Methods
Initialize the ServiceInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] sid The Twilio-provided string that uniquely identifies the
Service resource to fetch.
@return [ServiceInstance] ServiceInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/proxy/v1/service.rb 379 def initialize(version, payload, sid: nil) 380 super(version) 381 382 # Marshaled Properties 383 @properties = { 384 'sid' => payload['sid'], 385 'unique_name' => payload['unique_name'], 386 'account_sid' => payload['account_sid'], 387 'chat_instance_sid' => payload['chat_instance_sid'], 388 'callback_url' => payload['callback_url'], 389 'default_ttl' => payload['default_ttl'].to_i, 390 'number_selection_behavior' => payload['number_selection_behavior'], 391 'geo_match_level' => payload['geo_match_level'], 392 'intercept_callback_url' => payload['intercept_callback_url'], 393 'out_of_session_callback_url' => payload['out_of_session_callback_url'], 394 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 395 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 396 'url' => payload['url'], 397 'links' => payload['links'], 398 } 399 400 # Context 401 @instance_context = nil 402 @params = {'sid' => sid || @properties['sid'], } 403 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/proxy/v1/service.rb 430 def account_sid 431 @properties['account_sid'] 432 end
@return [String] The URL we call when the interaction status changes
# File lib/twilio-ruby/rest/proxy/v1/service.rb 442 def callback_url 443 @properties['callback_url'] 444 end
@return [String] The SID of the Chat
Service Instance
# File lib/twilio-ruby/rest/proxy/v1/service.rb 436 def chat_instance_sid 437 @properties['chat_instance_sid'] 438 end
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/proxy/v1/service.rb 409 def context 410 unless @instance_context 411 @instance_context = ServiceContext.new(@version, @params['sid'], ) 412 end 413 @instance_context 414 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/proxy/v1/service.rb 478 def date_created 479 @properties['date_created'] 480 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/proxy/v1/service.rb 484 def date_updated 485 @properties['date_updated'] 486 end
@return [String] Default TTL for a Session, in seconds
# File lib/twilio-ruby/rest/proxy/v1/service.rb 448 def default_ttl 449 @properties['default_ttl'] 450 end
Delete the ServiceInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/proxy/v1/service.rb 510 def delete 511 context.delete 512 end
Fetch the ServiceInstance
@return [ServiceInstance] Fetched ServiceInstance
# File lib/twilio-ruby/rest/proxy/v1/service.rb 503 def fetch 504 context.fetch 505 end
@return [service.GeoMatchLevel] Where a proxy number must be located relative to the participant identifier
# File lib/twilio-ruby/rest/proxy/v1/service.rb 460 def geo_match_level 461 @properties['geo_match_level'] 462 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/proxy/v1/service.rb 598 def inspect 599 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 600 "<Twilio.Proxy.V1.ServiceInstance #{values}>" 601 end
@return [String] The URL we call on each interaction
# File lib/twilio-ruby/rest/proxy/v1/service.rb 466 def intercept_callback_url 467 @properties['intercept_callback_url'] 468 end
@return [String] The URLs of resources related to the Service
# File lib/twilio-ruby/rest/proxy/v1/service.rb 496 def links 497 @properties['links'] 498 end
@return [service.NumberSelectionBehavior] The preference for Proxy
Number selection for the Service instance
# File lib/twilio-ruby/rest/proxy/v1/service.rb 454 def number_selection_behavior 455 @properties['number_selection_behavior'] 456 end
@return [String] The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session
# File lib/twilio-ruby/rest/proxy/v1/service.rb 472 def out_of_session_callback_url 473 @properties['out_of_session_callback_url'] 474 end
Access the phone_numbers
@return [phone_numbers] phone_numbers
# File lib/twilio-ruby/rest/proxy/v1/service.rb 578 def phone_numbers 579 context.phone_numbers 580 end
Access the sessions @return [sessions] sessions
# File lib/twilio-ruby/rest/proxy/v1/service.rb 571 def sessions 572 context.sessions 573 end
Access the short_codes
@return [short_codes] short_codes
# File lib/twilio-ruby/rest/proxy/v1/service.rb 585 def short_codes 586 context.short_codes 587 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/proxy/v1/service.rb 418 def sid 419 @properties['sid'] 420 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/proxy/v1/service.rb 591 def to_s 592 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 593 "<Twilio.Proxy.V1.ServiceInstance #{values}>" 594 end
@return [String] An application-defined string that uniquely identifies the resource
# File lib/twilio-ruby/rest/proxy/v1/service.rb 424 def unique_name 425 @properties['unique_name'] 426 end
Update the ServiceInstance
@param [String] unique_name
An application-defined string that uniquely
identifies the resource. This value must be 191 characters or fewer in length and be unique. **This value should not have PII.**
@param [String] default_ttl
The default `ttl` value to set for Sessions created
in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value.
@param [String] callback_url
The URL we should call when the interaction status
changes.
@param [service.GeoMatchLevel] geo_match_level
Where a proxy number must be
located relative to the participant identifier. Can be: `country`, `area-code`, or `extended-area-code`. The default value is `country` and more specific areas than `country` are only available in North America.
@param [service.NumberSelectionBehavior] number_selection_behavior
The
preference for Proxy Number selection in the Service instance. Can be: `prefer-sticky` or `avoid-sticky` and the default is `prefer-sticky`. `prefer-sticky` means that we will try and select the same Proxy Number for a given participant if they have previous {Sessions}[https://www.twilio.com/docs/proxy/api/session], but we will not fail if that Proxy Number cannot be used. `avoid-sticky` means that we will try to use different Proxy Numbers as long as that is possible within a given pool rather than try and use a previously assigned number.
@param [String] intercept_callback_url
The URL we call on each interaction. If
we receive a 403 status, we block the interaction; otherwise the interaction continues.
@param [String] out_of_session_callback_url
The URL we should call when an
inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio {function}[https://www.twilio.com/functions]) responds with valid {TwiML}[https://www.twilio.com/docs/voice/twiml], we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See {Out-of-Session Callback Response Guide}[https://www.twilio.com/docs/proxy/out-session-callback-response-guide] for more information.
@param [String] chat_instance_sid
The SID of the Chat
Service Instance managed
by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship.
@return [ServiceInstance] Updated ServiceInstance
# File lib/twilio-ruby/rest/proxy/v1/service.rb 555 def update(unique_name: :unset, default_ttl: :unset, callback_url: :unset, geo_match_level: :unset, number_selection_behavior: :unset, intercept_callback_url: :unset, out_of_session_callback_url: :unset, chat_instance_sid: :unset) 556 context.update( 557 unique_name: unique_name, 558 default_ttl: default_ttl, 559 callback_url: callback_url, 560 geo_match_level: geo_match_level, 561 number_selection_behavior: number_selection_behavior, 562 intercept_callback_url: intercept_callback_url, 563 out_of_session_callback_url: out_of_session_callback_url, 564 chat_instance_sid: chat_instance_sid, 565 ) 566 end
@return [String] The absolute URL of the Service resource
# File lib/twilio-ruby/rest/proxy/v1/service.rb 490 def url 491 @properties['url'] 492 end