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

  • service_sid (String) (defaults to: nil)

    The SID of the Sync Service the resource is associated with.

  • document_sid (String) (defaults to: nil)

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

  • identity (String) (defaults to: nil)

    The application-defined string that uniquely identifies the User's Document Permission resource to fetch.


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

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

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


290
291
292
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 290

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:


276
277
278
279
280
281
282
283
284
285
286
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 276

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


346
347
348
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 346

def delete
  context.delete
end

#document_sidString

Returns The Sync Document SID.

Returns:

  • (String)

    The Sync Document SID


302
303
304
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 302

def document_sid
  @properties['document_sid']
end

#fetchDocumentPermissionInstance

Fetch the DocumentPermissionInstance

Returns:


339
340
341
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 339

def fetch
  context.fetch
end

#identityString

Returns The identity of the user to whom the Sync Document Permission applies.

Returns:

  • (String)

    The identity of the user to whom the Sync Document Permission applies


308
309
310
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 308

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation


372
373
374
375
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 372

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

#manageBoolean

Returns Manage access.

Returns:

  • (Boolean)

    Manage access


326
327
328
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 326

def manage
  @properties['manage']
end

#readBoolean

Returns Read access.

Returns:

  • (Boolean)

    Read access


314
315
316
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 314

def read
  @properties['read']
end

#service_sidString

Returns The SID of the Sync Service that the resource is associated with.

Returns:

  • (String)

    The SID of the Sync Service that the resource is associated with


296
297
298
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 296

def service_sid
  @properties['service_sid']
end

#to_sObject

Provide a user friendly representation


365
366
367
368
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 365

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:


359
360
361
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 359

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


332
333
334
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 332

def url
  @properties['url']
end

#writeBoolean

Returns Write access.

Returns:

  • (Boolean)

    Write access


320
321
322
# File 'lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb', line 320

def write
  @properties['write']
end