Class: Twilio::REST::Sync::V1::ServiceInstance

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

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

  • account_sid (String)

    The SID of the Account that created this Service resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 681

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'unique_name' => payload['unique_name'],
        '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']),
        'url' => payload['url'],
        'webhook_url' => payload['webhook_url'],
        'webhooks_from_rest_enabled' => payload['webhooks_from_rest_enabled'],
        'reachability_webhooks_enabled' => payload['reachability_webhooks_enabled'],
        'acl_enabled' => payload['acl_enabled'],
        'reachability_debouncing_enabled' => payload['reachability_debouncing_enabled'],
        'reachability_debouncing_window' => payload['reachability_debouncing_window'] == nil ? payload['reachability_debouncing_window'] : payload['reachability_debouncing_window'].to_i,
        'links' => payload['links'],
    }

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

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Service resource.

Returns:



733
734
735
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 733

def 
    @properties['account_sid']
end

#acl_enabledBoolean

Returns Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](www.twilio.com/docs/sync/api/sync-permissions) resource. It is disabled (false) by default.

Returns:



781
782
783
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 781

def acl_enabled
    @properties['acl_enabled']
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:



712
713
714
715
716
717
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 712

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

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



745
746
747
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 745

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



751
752
753
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 751

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



806
807
808
809
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 806

def delete

    context.delete
end

#documentsdocuments

Access the documents

Returns:



874
875
876
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 874

def documents
    context.documents
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



814
815
816
817
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 814

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the resource.

Returns:

  • (String)

    The string that you assigned to describe the resource.



739
740
741
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 739

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



887
888
889
890
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 887

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

Returns The URLs of related resources.

Returns:

  • (Hash)

    The URLs of related resources.



799
800
801
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 799

def links
    @properties['links']
end

#reachability_debouncing_enabledBoolean

Returns 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.

Returns:

  • (Boolean)

    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.



787
788
789
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 787

def reachability_debouncing_enabled
    @properties['reachability_debouncing_enabled']
end

#reachability_debouncing_windowString

Returns 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 `webhook_url` is called, if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the reachability event from occurring.

Returns:

  • (String)

    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 `webhook_url` is called, if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the reachability event from occurring.



793
794
795
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 793

def reachability_debouncing_window
    @properties['reachability_debouncing_window']
end

#reachability_webhooks_enabledBoolean

Returns Whether the service instance calls ‘webhook_url` when client endpoints connect to Sync. The default is `false`.

Returns:

  • (Boolean)

    Whether the service instance calls ‘webhook_url` when client endpoints connect to Sync. The default is `false`.



775
776
777
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 775

def reachability_webhooks_enabled
    @properties['reachability_webhooks_enabled']
end

#sidString

Returns The unique string that we created to identify the Service resource.

Returns:

  • (String)

    The unique string that we created to identify the Service resource.



721
722
723
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 721

def sid
    @properties['sid']
end

#sync_listssync_lists

Access the sync_lists

Returns:



860
861
862
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 860

def sync_lists
    context.sync_lists
end

#sync_mapssync_maps

Access the sync_maps

Returns:



867
868
869
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 867

def sync_maps
    context.sync_maps
end

#sync_streamssync_streams

Access the sync_streams

Returns:



853
854
855
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 853

def sync_streams
    context.sync_streams
end

#to_sObject

Provide a user friendly representation



880
881
882
883
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 880

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

#unique_nameString

Returns An application-defined string that uniquely identifies the resource. It can be used in place of the resource’s ‘sid` in the URL to address the resource. It is a read-only property, it cannot be assigned using REST API.

Returns:

  • (String)

    An application-defined string that uniquely identifies the resource. It can be used in place of the resource’s ‘sid` in the URL to address the resource. It is a read-only property, it cannot be assigned using REST API.



727
728
729
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 727

def unique_name
    @properties['unique_name']
end

#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) ⇒ ServiceInstance

Update the ServiceInstance

Parameters:

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

    The URL we should call when Sync objects are manipulated.

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

    A string that you assign to describe the resource.

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

    Whether the service instance should call ‘webhook_url` when client endpoints connect to Sync. The default is `false`.

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

    Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](www.twilio.com/docs/sync/api/sync-permissions) resource.

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

    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.

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

    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.

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

    Whether the Service instance should call ‘webhook_url` when the REST API is used to update Sync objects. The default is `false`.

Returns:



829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 829

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
)

    context.update(
        webhook_url: webhook_url, 
        friendly_name: friendly_name, 
        reachability_webhooks_enabled: reachability_webhooks_enabled, 
        acl_enabled: acl_enabled, 
        reachability_debouncing_enabled: reachability_debouncing_enabled, 
        reachability_debouncing_window: reachability_debouncing_window, 
        webhooks_from_rest_enabled: webhooks_from_rest_enabled, 
    )
end

#urlString

Returns The absolute URL of the Service resource.

Returns:

  • (String)

    The absolute URL of the Service resource.



757
758
759
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 757

def url
    @properties['url']
end

#webhook_urlString

Returns The URL we call when Sync objects are manipulated.

Returns:

  • (String)

    The URL we call when Sync objects are manipulated.



763
764
765
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 763

def webhook_url
    @properties['webhook_url']
end

#webhooks_from_rest_enabledBoolean

Returns Whether the Service instance should call ‘webhook_url` when the REST API is used to update Sync objects. The default is `false`.

Returns:

  • (Boolean)

    Whether the Service instance should call ‘webhook_url` when the REST API is used to update Sync objects. The default is `false`.



769
770
771
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 769

def webhooks_from_rest_enabled
    @properties['webhooks_from_rest_enabled']
end