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

Public Class Methods

new(version, payload, service_sid: nil, document_sid: nil, identity: nil) click to toggle source

Initialize the DocumentPermissionInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] service_sid The SID of the {Sync

Service}[https://www.twilio.com/docs/sync/api/service] the resource is
associated with.

@param [String] document_sid The SID of the Sync Document to which the Document

Permission applies.

@param [String] identity The application-defined string that uniquely identifies

the User's Document Permission resource to fetch.

@return [DocumentPermissionInstance] DocumentPermissionInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
248 def initialize(version, payload, service_sid: nil, document_sid: nil, identity: nil)
249   super(version)
250 
251   # Marshaled Properties
252   @properties = {
253       'account_sid' => payload['account_sid'],
254       'service_sid' => payload['service_sid'],
255       'document_sid' => payload['document_sid'],
256       'identity' => payload['identity'],
257       'read' => payload['read'],
258       'write' => payload['write'],
259       'manage' => payload['manage'],
260       'url' => payload['url'],
261   }
262 
263   # Context
264   @instance_context = nil
265   @params = {
266       'service_sid' => service_sid,
267       'document_sid' => document_sid,
268       'identity' => identity || @properties['identity'],
269   }
270 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
290 def account_sid
291   @properties['account_sid']
292 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [DocumentPermissionContext] DocumentPermissionContext for this DocumentPermissionInstance

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
276 def context
277   unless @instance_context
278     @instance_context = DocumentPermissionContext.new(
279         @version,
280         @params['service_sid'],
281         @params['document_sid'],
282         @params['identity'],
283     )
284   end
285   @instance_context
286 end
delete() click to toggle source

Delete the DocumentPermissionInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
346 def delete
347   context.delete
348 end
document_sid() click to toggle source

@return [String] The Sync Document SID

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
302 def document_sid
303   @properties['document_sid']
304 end
fetch() click to toggle source

Fetch the DocumentPermissionInstance @return [DocumentPermissionInstance] Fetched DocumentPermissionInstance

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
339 def fetch
340   context.fetch
341 end
identity() click to toggle source

@return [String] The identity of the user to whom the Sync Document Permission applies

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
308 def identity
309   @properties['identity']
310 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
372 def inspect
373   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
374   "<Twilio.Sync.V1.DocumentPermissionInstance #{values}>"
375 end
manage() click to toggle source

@return [Boolean] Manage access

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
326 def manage
327   @properties['manage']
328 end
read() click to toggle source

@return [Boolean] Read access

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
314 def read
315   @properties['read']
316 end
service_sid() click to toggle source

@return [String] The SID of the Sync Service that the resource is associated with

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
296 def service_sid
297   @properties['service_sid']
298 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
365 def to_s
366   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
367   "<Twilio.Sync.V1.DocumentPermissionInstance #{values}>"
368 end
update(read: nil, write: nil, manage: nil) click to toggle source

Update the DocumentPermissionInstance @param [Boolean] read Whether the identity can read the Sync Document. Default

value is `false`.

@param [Boolean] write Whether the identity can update the Sync Document.

Default value is `false`.

@param [Boolean] manage Whether the identity can delete the Sync Document.

Default value is `false`.

@return [DocumentPermissionInstance] Updated DocumentPermissionInstance

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
359 def update(read: nil, write: nil, manage: nil)
360   context.update(read: read, write: write, manage: manage, )
361 end
url() click to toggle source

@return [String] The absolute URL of the Sync Document Permission resource

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
332 def url
333   @properties['url']
334 end
write() click to toggle source

@return [Boolean] Write access

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
320 def write
321   @properties['write']
322 end