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



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 328

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



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

def 
  @properties['account_sid']
end

#acl_enabledBoolean



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

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



355
356
357
358
359
360
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 355

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

#date_createdTime



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

def date_created
  @properties['date_created']
end

#date_updatedTime



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ServiceInstance



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

def delete
  context.delete
end

#documentsdocuments

Access the documents



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

def documents
  context.documents
end

#fetchServiceInstance

Fetch a ServiceInstance



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

def fetch
  context.fetch
end

#friendly_nameString



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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



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

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


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

def links
  @properties['links']
end

#reachability_webhooks_enabledBoolean



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

def reachability_webhooks_enabled
  @properties['reachability_webhooks_enabled']
end

#sidString



364
365
366
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 364

def sid
  @properties['sid']
end

#sync_listssync_lists

Access the sync_lists



468
469
470
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 468

def sync_lists
  context.sync_lists
end

#sync_mapssync_maps

Access the sync_maps



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

def sync_maps
  context.sync_maps
end

#sync_streamssync_streams

Access the sync_streams



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

def sync_streams
  context.sync_streams
end

#to_sObject

Provide a user friendly representation



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

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

#unique_nameString



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

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



449
450
451
452
453
454
455
456
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 449

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



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

def url
  @properties['url']
end

#webhook_urlString



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

def webhook_url
  @properties['webhook_url']
end