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

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

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ ServiceInstance

Initialize the ServiceInstance



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 366

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'].to_i,
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString



417
418
419
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 417

def 
  @properties['account_sid']
end

#acl_enabledBoolean



465
466
467
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 465

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



396
397
398
399
400
401
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 396

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

#date_createdTime



429
430
431
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 429

def date_created
  @properties['date_created']
end

#date_updatedTime



435
436
437
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 435

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance



497
498
499
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 497

def delete
  context.delete
end

#documentsdocuments

Access the documents



543
544
545
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 543

def documents
  context.documents
end

#fetchServiceInstance

Fetch the ServiceInstance



490
491
492
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 490

def fetch
  context.fetch
end

#friendly_nameString



423
424
425
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 423

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



577
578
579
580
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 577

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


483
484
485
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 483

def links
  @properties['links']
end

#reachability_debouncing_enabledBoolean



471
472
473
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 471

def reachability_debouncing_enabled
  @properties['reachability_debouncing_enabled']
end

#reachability_debouncing_windowString



477
478
479
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 477

def reachability_debouncing_window
  @properties['reachability_debouncing_window']
end

#reachability_webhooks_enabledBoolean



459
460
461
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 459

def reachability_webhooks_enabled
  @properties['reachability_webhooks_enabled']
end

#sidString



405
406
407
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 405

def sid
  @properties['sid']
end

#sync_listssync_lists

Access the sync_lists



550
551
552
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 550

def sync_lists
  context.sync_lists
end

#sync_mapssync_maps

Access the sync_maps



557
558
559
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 557

def sync_maps
  context.sync_maps
end

#sync_streamssync_streams

Access the sync_streams



564
565
566
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 564

def sync_streams
  context.sync_streams
end

#to_sObject

Provide a user friendly representation



570
571
572
573
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 570

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

#unique_nameString



411
412
413
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 411

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



528
529
530
531
532
533
534
535
536
537
538
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 528

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



441
442
443
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 441

def url
  @properties['url']
end

#webhook_urlString



447
448
449
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 447

def webhook_url
  @properties['webhook_url']
end

#webhooks_from_rest_enabledBoolean



453
454
455
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 453

def webhooks_from_rest_enabled
  @properties['webhooks_from_rest_enabled']
end