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

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/sync/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.



253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 253

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 unique SID identifier of the Twilio Account.

Returns:

  • (String)

    The unique SID identifier of the Twilio Account.



286
287
288
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 286

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:



277
278
279
280
281
282
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 277

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



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

def delete

    context.delete
end

#document_sidString

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

Returns:

  • (String)

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



298
299
300
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 298

def document_sid
    @properties['document_sid']
end

#fetchDocumentPermissionInstance

Fetch the DocumentPermissionInstance

Returns:



343
344
345
346
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 343

def fetch

    context.fetch
end

#identityString

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

Returns:

  • (String)

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



304
305
306
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 304

def identity
    @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



376
377
378
379
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 376

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

#manageBoolean

Returns Boolean flag specifying whether the identity can delete the Sync Document.

Returns:

  • (Boolean)

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



322
323
324
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 322

def manage
    @properties['manage']
end

#readBoolean

Returns Boolean flag specifying whether the identity can read the Sync Document.

Returns:

  • (Boolean)

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



310
311
312
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 310

def read
    @properties['read']
end

#service_sidString

Returns The unique SID identifier of the Sync Service Instance.

Returns:

  • (String)

    The unique SID identifier of the Sync Service Instance.



292
293
294
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 292

def service_sid
    @properties['service_sid']
end

#to_sObject

Provide a user friendly representation



369
370
371
372
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 369

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

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

Update the DocumentPermissionInstance

Parameters:

  • read (Boolean) (defaults to: nil)

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

  • write (Boolean) (defaults to: nil)

    Boolean flag specifying whether the identity can update the Sync Document.

  • manage (Boolean) (defaults to: nil)

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

Returns:



354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 354

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

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

#urlString

Returns Contains an absolute URL for this Sync Document Permission.

Returns:

  • (String)

    Contains an absolute URL for this Sync Document Permission.



328
329
330
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 328

def url
    @properties['url']
end

#writeBoolean

Returns Boolean flag specifying whether the identity can update the Sync Document.

Returns:

  • (Boolean)

    Boolean flag specifying whether the identity can update the Sync Document.



316
317
318
# File 'lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb', line 316

def write
    @properties['write']
end