class Twilio::REST::Sync::V1::ServiceInstance
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 SID of the Service resource to fetch. @return [ServiceInstance] ServiceInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/sync/v1/service.rb 358 def initialize(version, payload, sid: nil) 359 super(version) 360 361 # Marshaled Properties 362 @properties = { 363 'sid' => payload['sid'], 364 'unique_name' => payload['unique_name'], 365 'account_sid' => payload['account_sid'], 366 'friendly_name' => payload['friendly_name'], 367 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 368 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 369 'url' => payload['url'], 370 'webhook_url' => payload['webhook_url'], 371 'webhooks_from_rest_enabled' => payload['webhooks_from_rest_enabled'], 372 'reachability_webhooks_enabled' => payload['reachability_webhooks_enabled'], 373 'acl_enabled' => payload['acl_enabled'], 374 'reachability_debouncing_enabled' => payload['reachability_debouncing_enabled'], 375 'reachability_debouncing_window' => payload['reachability_debouncing_window'].to_i, 376 'links' => payload['links'], 377 } 378 379 # Context 380 @instance_context = nil 381 @params = {'sid' => sid || @properties['sid'], } 382 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/sync/v1/service.rb 409 def account_sid 410 @properties['account_sid'] 411 end
@return [Boolean] Whether token identities in the Service must be granted access to Sync
objects by using the Permissions resource
# File lib/twilio-ruby/rest/sync/v1/service.rb 457 def acl_enabled 458 @properties['acl_enabled'] 459 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/sync/v1/service.rb 388 def context 389 unless @instance_context 390 @instance_context = ServiceContext.new(@version, @params['sid'], ) 391 end 392 @instance_context 393 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/sync/v1/service.rb 421 def date_created 422 @properties['date_created'] 423 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/sync/v1/service.rb 427 def date_updated 428 @properties['date_updated'] 429 end
Delete the ServiceInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/sync/v1/service.rb 489 def delete 490 context.delete 491 end
Access the documents @return [documents] documents
# File lib/twilio-ruby/rest/sync/v1/service.rb 535 def documents 536 context.documents 537 end
Fetch the ServiceInstance
@return [ServiceInstance] Fetched ServiceInstance
# File lib/twilio-ruby/rest/sync/v1/service.rb 482 def fetch 483 context.fetch 484 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/sync/v1/service.rb 415 def friendly_name 416 @properties['friendly_name'] 417 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service.rb 569 def inspect 570 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 571 "<Twilio.Sync.V1.ServiceInstance #{values}>" 572 end
@return [String] The URLs of related resources
# File lib/twilio-ruby/rest/sync/v1/service.rb 475 def links 476 @properties['links'] 477 end
@return [Boolean] Whether every endpoint_disconnected event occurs after a configurable delay
# File lib/twilio-ruby/rest/sync/v1/service.rb 463 def reachability_debouncing_enabled 464 @properties['reachability_debouncing_enabled'] 465 end
@return [String] The reachability event delay in milliseconds
# File lib/twilio-ruby/rest/sync/v1/service.rb 469 def reachability_debouncing_window 470 @properties['reachability_debouncing_window'] 471 end
@return [Boolean] Whether the service instance calls webhook_url
when client endpoints connect to Sync
# File lib/twilio-ruby/rest/sync/v1/service.rb 451 def reachability_webhooks_enabled 452 @properties['reachability_webhooks_enabled'] 453 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/sync/v1/service.rb 397 def sid 398 @properties['sid'] 399 end
Access the sync_lists
@return [sync_lists] sync_lists
# File lib/twilio-ruby/rest/sync/v1/service.rb 542 def sync_lists 543 context.sync_lists 544 end
Access the sync_streams
@return [sync_streams] sync_streams
# File lib/twilio-ruby/rest/sync/v1/service.rb 556 def sync_streams 557 context.sync_streams 558 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service.rb 562 def to_s 563 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 564 "<Twilio.Sync.V1.ServiceInstance #{values}>" 565 end
@return [String] An application-defined string that uniquely identifies the resource
# File lib/twilio-ruby/rest/sync/v1/service.rb 403 def unique_name 404 @properties['unique_name'] 405 end
Update the ServiceInstance
@param [String] webhook_url
The URL we should call when Sync
objects are
manipulated.
@param [String] friendly_name
A string that you assign to describe the resource. @param [Boolean] reachability_webhooks_enabled
Whether the service instance
should call `webhook_url` when client endpoints connect to Sync. The default is `false`.
@param [Boolean] acl_enabled
Whether token identities in the Service must be
granted access to Sync objects by using the {Permissions}[https://www.twilio.com/docs/sync/api/sync-permissions] resource.
@param [Boolean] reachability_debouncing_enabled
Whether every
`endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event.
@param [String] reachability_debouncing_window
The reachability event delay in
milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before the webhook is called if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the webhook from being called.
@param [Boolean] webhooks_from_rest_enabled
Whether the Service instance should
call `webhook_url` when the REST API is used to update Sync objects. The default is `false`.
@return [ServiceInstance] Updated ServiceInstance
# File lib/twilio-ruby/rest/sync/v1/service.rb 520 def update(webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset, reachability_debouncing_enabled: :unset, reachability_debouncing_window: :unset, webhooks_from_rest_enabled: :unset) 521 context.update( 522 webhook_url: webhook_url, 523 friendly_name: friendly_name, 524 reachability_webhooks_enabled: reachability_webhooks_enabled, 525 acl_enabled: acl_enabled, 526 reachability_debouncing_enabled: reachability_debouncing_enabled, 527 reachability_debouncing_window: reachability_debouncing_window, 528 webhooks_from_rest_enabled: webhooks_from_rest_enabled, 529 ) 530 end
@return [String] The absolute URL of the Service resource
# File lib/twilio-ruby/rest/sync/v1/service.rb 433 def url 434 @properties['url'] 435 end
@return [String] The URL we call when Sync
objects are manipulated
# File lib/twilio-ruby/rest/sync/v1/service.rb 439 def webhook_url 440 @properties['webhook_url'] 441 end
@return [Boolean] Whether the Service instance should call webhook_url
when the REST
API is used to update Sync
objects
# File lib/twilio-ruby/rest/sync/v1/service.rb 445 def webhooks_from_rest_enabled 446 @properties['webhooks_from_rest_enabled'] 447 end