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



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 342

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

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

Instance Method Details

#account_sidString



390
391
392
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 390

def 
  @properties['account_sid']
end

#acl_enabledBoolean



432
433
434
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 432

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



369
370
371
372
373
374
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 369

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

#date_createdTime



402
403
404
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 402

def date_created
  @properties['date_created']
end

#date_updatedTime



408
409
410
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 408

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ServiceInstance



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

def delete
  context.delete
end

#documentsdocuments

Access the documents



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

def documents
  context.documents
end

#fetchServiceInstance

Fetch a ServiceInstance



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

def fetch
  context.fetch
end

#friendly_nameString



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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



515
516
517
518
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 515

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


438
439
440
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 438

def links
  @properties['links']
end

#reachability_webhooks_enabledBoolean



426
427
428
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 426

def reachability_webhooks_enabled
  @properties['reachability_webhooks_enabled']
end

#sidString



378
379
380
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 378

def sid
  @properties['sid']
end

#sync_listssync_lists

Access the sync_lists



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

def sync_lists
  context.sync_lists
end

#sync_mapssync_maps

Access the sync_maps



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

def sync_maps
  context.sync_maps
end

#sync_streamssync_streams

Access the sync_streams



502
503
504
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 502

def sync_streams
  context.sync_streams
end

#to_sObject

Provide a user friendly representation



508
509
510
511
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 508

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

#unique_nameString



384
385
386
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 384

def unique_name
  @properties['unique_name']
end

#update(webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset) ⇒ ServiceInstance

Update the ServiceInstance



469
470
471
472
473
474
475
476
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 469

def update(webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset)
  context.update(
      webhook_url: webhook_url,
      friendly_name: friendly_name,
      reachability_webhooks_enabled: reachability_webhooks_enabled,
      acl_enabled: acl_enabled,
  )
end

#urlString



414
415
416
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 414

def url
  @properties['url']
end

#webhook_urlString



420
421
422
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 420

def webhook_url
  @properties['webhook_url']
end