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

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The sid



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

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

Returns The account_sid.

Returns:

  • (String)

    The account_sid



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

def 
  @properties['account_sid']
end

#acl_enabledBoolean

Returns true or false - determines whether token identities must be granted access to Sync objects via the Permissions API in this Service.

Returns:

  • (Boolean)

    true or false - determines whether token identities must be granted access to Sync objects via the Permissions API in this Service.



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

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:



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

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

#date_createdTime

Returns The date_created.

Returns:

  • (Time)

    The date_created



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date_updated.

Returns:

  • (Time)

    The date_updated



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#documentsdocuments

Access the documents

Returns:



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

def documents
  context.documents
end

#fetchServiceInstance

Fetch a ServiceInstance

Returns:



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

def fetch
  context.fetch
end

#friendly_nameString

Returns Human-readable name for this service instance.

Returns:

  • (String)

    Human-readable name for this service instance



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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



518
519
520
521
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 518

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

Returns The links.

Returns:

  • (String)

    The links



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

def links
  @properties['links']
end

#reachability_webhooks_enabledBoolean

Returns true or false - controls whether this instance fires webhooks when client endpoints connect to Sync.

Returns:

  • (Boolean)

    true or false - controls whether this instance fires webhooks when client endpoints connect to Sync



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

def reachability_webhooks_enabled
  @properties['reachability_webhooks_enabled']
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid



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

def sid
  @properties['sid']
end

#sync_listssync_lists

Access the sync_lists

Returns:



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

def sync_lists
  context.sync_lists
end

#sync_mapssync_maps

Access the sync_maps

Returns:



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

def sync_maps
  context.sync_maps
end

#sync_streamssync_streams

Access the sync_streams

Returns:



505
506
507
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 505

def sync_streams
  context.sync_streams
end

#to_sObject

Provide a user friendly representation



511
512
513
514
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 511

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

#unique_nameString

Returns The unique_name.

Returns:

  • (String)

    The unique_name



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

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

Parameters:

  • webhook_url (String) (defaults to: :unset)

    (optional) A URL that will receive event updates when objects are manipulated.

  • friendly_name (String) (defaults to: :unset)

    (optional) Human-readable name for this service instance

  • reachability_webhooks_enabled (Boolean) (defaults to: :unset)

    (optional) True or false - controls whether this instance fires webhooks when client endpoints connect to Sync Defaults to false.

  • acl_enabled (Boolean) (defaults to: :unset)

    (optional) ‘true` or `false` - determines whether token identities must be granted access to Sync objects via the [Permissions API](www.twilio.com/docs/api/sync/rest/sync-rest-api-permissions) in this Service.

Returns:



472
473
474
475
476
477
478
479
# File 'lib/twilio-ruby/rest/sync/v1/service.rb', line 472

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 The url.

Returns:

  • (String)

    The url



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

def url
  @properties['url']
end

#webhook_urlString

Returns A URL that will receive event updates when objects are manipulated.

Returns:

  • (String)

    A URL that will receive event updates when objects are manipulated.



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

def webhook_url
  @properties['webhook_url']
end