Class: Twilio::REST::Sync::V1::ServiceContext::DocumentContext::DocumentPermissionInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, document_sid: nil, identity: nil) ⇒ DocumentPermissionInstance

Initialize the DocumentPermissionInstance

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 DocumentPermission resource.

  • sid (String)

    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/document/document_permission.rb', line 490

def initialize(version, payload , service_sid: nil, document_sid: nil, identity: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'service_sid' => payload['service_sid'],
        'document_sid' => payload['document_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']  ,'document_sid' => document_sid  || @properties['document_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 Document Permission resource.

Returns:



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

def 
    @properties['account_sid']
end

#contextDocumentPermissionContext

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

Returns:



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

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

#deleteBoolean

Delete the DocumentPermissionInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#document_sidString

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

Returns:

  • (String)

    The SID of the Sync Document to which the Document Permission applies.



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

def document_sid
    @properties['document_sid']
end

#fetchDocumentPermissionInstance

Fetch the DocumentPermissionInstance

Returns:



581
582
583
584
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_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:

  • (String)

    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/document/document_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/document/document_permission.rb', line 614

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

#manageBoolean

Returns Whether the identity can delete the Sync Document.

Returns:

  • (Boolean)

    Whether the identity can delete the Sync Document.



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

def manage
    @properties['manage']
end

#readBoolean

Returns Whether the identity can read the Sync Document.

Returns:

  • (Boolean)

    Whether the identity can read the Sync Document.



548
549
550
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_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/document/document_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/document/document_permission.rb', line 607

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

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

Update the DocumentPermissionInstance

Parameters:

  • read (Boolean) (defaults to: nil)

    Whether the identity can read the Sync Document. Default value is false.

  • write (Boolean) (defaults to: nil)

    Whether the identity can update the Sync Document. Default value is false.

  • manage (Boolean) (defaults to: nil)

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

Returns:



592
593
594
595
596
597
598
599
600
601
602
603
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_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 Document Permission resource.

Returns:

  • (String)

    The absolute URL of the Sync Document Permission resource.



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

def url
    @properties['url']
end

#writeBoolean

Returns Whether the identity can update the Sync Document.

Returns:

  • (Boolean)

    Whether the identity can update the Sync Document.



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

def write
    @properties['write']
end