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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, map_sid: nil, identity: nil) ⇒ SyncMapPermissionInstance

Initialize the SyncMapPermissionInstance

Parameters:

  • Version that contains the resource

  • payload that contains response from Twilio

  • The SID of the Account that created this SyncMapPermission resource.

  • The SID of the Call resource to fetch.



490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 490

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  || @properties['service_sid']  ,'map_sid' => map_sid  || @properties['map_sid']  ,'identity' => identity  || @properties['identity']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Sync Map Permission resource.

Returns:



524
525
526
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 524

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:

  • CallContext for this CallInstance



515
516
517
518
519
520
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 515

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

#deleteBoolean

Delete the SyncMapPermissionInstance

Returns:

  • True if delete succeeds, false otherwise



573
574
575
576
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 573

def delete

    context.delete
end

#fetchSyncMapPermissionInstance

Fetch the SyncMapPermissionInstance

Returns:

  • Fetched SyncMapPermissionInstance



581
582
583
584
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 581

def fetch

    context.fetch
end

#identityString

Returns The application-defined string that uniquely identifies the resource’s User within the Service to an FPA token.

Returns:

  • The application-defined string that uniquely identifies the resource’s User within the Service to an FPA token.



542
543
544
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 542

def identity
    @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



614
615
616
617
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 614

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

#manageBoolean

Returns Whether the identity can delete the Sync Map.

Returns:

  • Whether the identity can delete the Sync Map.



560
561
562
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 560

def manage
    @properties['manage']
end

#map_sidString

Returns The SID of the Sync Map to which the Permission applies.

Returns:

  • The SID of the Sync Map to which the Permission applies.



536
537
538
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 536

def map_sid
    @properties['map_sid']
end

#readBoolean

Returns Whether the identity can read the Sync Map and its Items.

Returns:

  • Whether the identity can read the Sync Map and its Items.



548
549
550
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 548

def read
    @properties['read']
end

#service_sidString

Returns The SID of the [Sync Service](www.twilio.com/docs/sync/api/service) the resource is associated with.

Returns:



530
531
532
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 530

def service_sid
    @properties['service_sid']
end

#to_sObject

Provide a user friendly representation



607
608
609
610
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 607

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:

  • (defaults to: nil)

    Whether the identity can read the Sync Map and its Items. Default value is false.

  • (defaults to: nil)

    Whether the identity can create, update, and delete Items in the Sync Map. Default value is false.

  • (defaults to: nil)

    Whether the identity can delete the Sync Map. Default value is false.

Returns:

  • Updated SyncMapPermissionInstance



592
593
594
595
596
597
598
599
600
601
602
603
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 592

def update(
    read: nil, 
    write: nil, 
    manage: nil
)

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

#urlString

Returns The absolute URL of the Sync Map Permission resource.

Returns:

  • The absolute URL of the Sync Map Permission resource.



566
567
568
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 566

def url
    @properties['url']
end

#writeBoolean

Returns Whether the identity can create, update, and delete Items in the Sync Map.

Returns:

  • Whether the identity can create, update, and delete Items in the Sync Map.



554
555
556
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb', line 554

def write
    @properties['write']
end