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

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The sid


301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 301

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

Returns:

  • (String)

    The account_sid


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

def 
  @properties['account_sid']
end

#acl_enabledBoolean

Returns The acl_enabled.

Returns:

  • (Boolean)

    The acl_enabled


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

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:


327
328
329
330
331
332
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 327

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


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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date_updated.

Returns:

  • (Time)

    The date_updated


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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


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

def delete
  context.delete
end

#documentsdocuments

Access the documents

Returns:


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

def documents
  context.documents
end

#fetchServiceInstance

Fetch the ServiceInstance

Returns:


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

def fetch
  context.fetch
end

#friendly_nameString

Returns The friendly_name.

Returns:

  • (String)

    The friendly_name


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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation


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

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

Returns The links.

Returns:

  • (String)

    The links


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

def links
  @properties['links']
end

#reachability_webhooks_enabledBoolean

Returns The reachability_webhooks_enabled.

Returns:

  • (Boolean)

    The reachability_webhooks_enabled


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

def reachability_webhooks_enabled
  @properties['reachability_webhooks_enabled']
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid


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

def sid
  @properties['sid']
end

#sync_listssync_lists

Access the sync_lists

Returns:


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

def sync_lists
  context.sync_lists
end

#sync_mapssync_maps

Access the sync_maps

Returns:


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

def sync_maps
  context.sync_maps
end

#to_sObject

Provide a user friendly representation


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

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)

    The webhook_url

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

    The friendly_name

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

    The reachability_webhooks_enabled

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

    The acl_enabled

Returns:


415
416
417
418
419
420
421
422
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 415

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


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

def url
  @properties['url']
end

#webhook_urlString

Returns The webhook_url.

Returns:

  • (String)

    The webhook_url


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

def webhook_url
  @properties['webhook_url']
end