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

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

Instance Method Summary collapse

Constructor Details

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

Initialize the ServiceInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Service resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 336

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

Returns:

  • (String)


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

def 
    @properties['account_sid']
end

#acl_enabledBoolean

Returns:

  • (Boolean)


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

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

Returns:



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

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

#date_createdTime

Returns:

  • (Time)


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

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns:

  • (Time)


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

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#documentsdocuments

Access the documents

Returns:



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

def documents
    context.documents
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:



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

def fetch

    context.fetch
end

#friendly_nameString

Returns:

  • (String)


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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns:

  • (Hash)


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

def links
    @properties['links']
end

#reachability_webhooks_enabledBoolean

Returns:

  • (Boolean)


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

def reachability_webhooks_enabled
    @properties['reachability_webhooks_enabled']
end

#sidString

Returns:

  • (String)


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

def sid
    @properties['sid']
end

#sync_listssync_lists

Access the sync_lists

Returns:



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

def sync_lists
    context.sync_lists
end

#sync_mapssync_maps

Access the sync_maps

Returns:



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

def sync_maps
    context.sync_maps
end

#to_sObject

Provide a user friendly representation



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

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

Parameters:

  • webhook_url (String) (defaults to: :unset)
  • friendly_name (String) (defaults to: :unset)
  • reachability_webhooks_enabled (Boolean) (defaults to: :unset)
  • acl_enabled (Boolean) (defaults to: :unset)

Returns:



452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 452

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

Returns:

  • (String)


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

def url
    @properties['url']
end

#webhook_urlString

Returns:

  • (String)


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

def webhook_url
    @properties['webhook_url']
end