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



673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 673

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



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

def 
    @properties['account_sid']
end

#acl_enabledBoolean



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

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



704
705
706
707
708
709
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 704

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

#date_createdTime



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

def date_created
    @properties['date_created']
end

#date_updatedTime



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

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance



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

def delete

    context.delete
end

#documentsdocuments

Access the documents



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

def documents
    context.documents
end

#fetchServiceInstance

Fetch the ServiceInstance



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

def fetch

    context.fetch
end

#friendly_nameString



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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



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

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


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

def links
    @properties['links']
end

#reachability_debouncing_enabledBoolean



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

def reachability_debouncing_enabled
    @properties['reachability_debouncing_enabled']
end

#reachability_debouncing_windowString



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

def reachability_debouncing_window
    @properties['reachability_debouncing_window']
end

#reachability_webhooks_enabledBoolean



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

def reachability_webhooks_enabled
    @properties['reachability_webhooks_enabled']
end

#sidString



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

def sid
    @properties['sid']
end

#sync_listssync_lists

Access the sync_lists



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

def sync_lists
    context.sync_lists
end

#sync_mapssync_maps

Access the sync_maps



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

def sync_maps
    context.sync_maps
end

#sync_streamssync_streams

Access the sync_streams



845
846
847
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 845

def sync_streams
    context.sync_streams
end

#to_sObject

Provide a user friendly representation



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

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

#unique_nameString



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

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



821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 821

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



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

def url
    @properties['url']
end

#webhook_urlString



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

def webhook_url
    @properties['webhook_url']
end

#webhooks_from_rest_enabledBoolean



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

def webhooks_from_rest_enabled
    @properties['webhooks_from_rest_enabled']
end