Class: Twilio::REST::Sync::V1::ServiceContext::SyncMapContext::SyncMapPermissionInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.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, service_sid: nil, map_sid: nil, identity: nil) ⇒ SyncMapPermissionInstance

Initialize the SyncMapPermissionInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • service_sid (String) (defaults to: nil)

    The unique SID identifier of the Sync Service Instance.

  • map_sid (String) (defaults to: nil)

    The unique SID identifier of the Sync Map to which the Permission applies.

  • identity (String) (defaults to: nil)

    Arbitrary string identifier representing a user associated with an FPA token, assigned by the developer.



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 264

def initialize(version, payload, service_sid: nil, map_sid: nil, identity: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'service_sid' => payload['service_sid'],
      'map_sid' => payload['map_sid'],
      'identity' => payload['identity'],
      'read' => payload['read'],
      'write' => payload['write'],
      'manage' => payload['manage'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {
      'service_sid' => service_sid,
      'map_sid' => map_sid,
      'identity' => identity || @properties['identity'],
  }
end

Instance Method Details

#account_sidString

Returns Twilio Account SID.

Returns:

  • (String)

    Twilio Account SID.



306
307
308
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 306

def 
  @properties['account_sid']
end

#contextSyncMapPermissionContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



292
293
294
295
296
297
298
299
300
301
302
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 292

def context
  unless @instance_context
    @instance_context = SyncMapPermissionContext.new(
        @version,
        @params['service_sid'],
        @params['map_sid'],
        @params['identity'],
    )
  end
  @instance_context
end

#deleteBoolean

Deletes the SyncMapPermissionInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#fetchSyncMapPermissionInstance

Fetch a SyncMapPermissionInstance

Returns:



355
356
357
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 355

def fetch
  context.fetch
end

#identityString

Returns Identity of the user to whom the Sync Map Permission applies.

Returns:

  • (String)

    Identity of the user to whom the Sync Map Permission applies.



324
325
326
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 324

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#manageBoolean

Returns Manage access.

Returns:

  • (Boolean)

    Manage access.



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

def manage
  @properties['manage']
end

#map_sidString

Returns Sync Map SID.

Returns:

  • (String)

    Sync Map SID.



318
319
320
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 318

def map_sid
  @properties['map_sid']
end

#readBoolean

Returns Read access.

Returns:

  • (Boolean)

    Read access.



330
331
332
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 330

def read
  @properties['read']
end

#service_sidString

Returns Sync Service Instance SID.

Returns:

  • (String)

    Sync Service Instance SID.



312
313
314
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 312

def service_sid
  @properties['service_sid']
end

#to_sObject

Provide a user friendly representation



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

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

#update(read: nil, write: nil, manage: nil) ⇒ SyncMapPermissionInstance

Update the SyncMapPermissionInstance

Parameters:

  • read (Boolean) (defaults to: nil)

    Boolean flag specifying whether the identity can read the Sync Map.

  • write (Boolean) (defaults to: nil)

    Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map.

  • manage (Boolean) (defaults to: nil)

    Boolean flag specifying whether the identity can delete the Sync Map.

Returns:



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

def update(read: nil, write: nil, manage: nil)
  context.update(read: read, write: write, manage: manage, )
end

#urlString

Returns URL of this Sync Map Permission.

Returns:

  • (String)

    URL of this Sync Map Permission.



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

def url
  @properties['url']
end

#writeBoolean

Returns Write access.

Returns:

  • (Boolean)

    Write access.



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

def write
  @properties['write']
end