Class: Twilio::REST::Preview::Sync::ServiceInstance

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

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

Initialize the ServiceInstance



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 309

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      '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



350
351
352
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 350

def 
  @properties['account_sid']
end

#acl_enabledBoolean



392
393
394
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 392

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



335
336
337
338
339
340
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 335

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

#date_createdTime



362
363
364
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 362

def date_created
  @properties['date_created']
end

#date_updatedTime



368
369
370
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 368

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ServiceInstance



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

def delete
  context.delete
end

#documentsdocuments

Access the documents



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

def documents
  context.documents
end

#fetchServiceInstance

Fetch a ServiceInstance



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

def fetch
  context.fetch
end

#friendly_nameString



356
357
358
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 356

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



462
463
464
465
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 462

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


398
399
400
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 398

def links
  @properties['links']
end

#reachability_webhooks_enabledBoolean



386
387
388
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 386

def reachability_webhooks_enabled
  @properties['reachability_webhooks_enabled']
end

#sidString



344
345
346
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 344

def sid
  @properties['sid']
end

#sync_listssync_lists

Access the sync_lists



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

def sync_lists
  context.sync_lists
end

#sync_mapssync_maps

Access the sync_maps



449
450
451
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 449

def sync_maps
  context.sync_maps
end

#to_sObject

Provide a user friendly representation



455
456
457
458
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 455

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

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

Update the ServiceInstance



423
424
425
426
427
428
429
430
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 423

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



374
375
376
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 374

def url
  @properties['url']
end

#webhook_urlString



380
381
382
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 380

def webhook_url
  @properties['webhook_url']
end