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

Public Class Methods

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

Initialize the DocumentPermissionContext @param [Version] version Version that contains the resource @param [String] service_sid The SID of the {Sync

Service}[https://www.twilio.com/docs/sync/api/service] with the Document
Permission resource to fetch.

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

Permission resource to fetch. Can be the Document resource's `sid` or its
`unique_name`.

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

the User's Document Permission resource to fetch.

@return [DocumentPermissionContext] DocumentPermissionContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
167 def initialize(version, service_sid, document_sid, identity)
168   super(version)
169 
170   # Path Solution
171   @solution = {service_sid: service_sid, document_sid: document_sid, identity: identity, }
172   @uri = "/Services/#{@solution[:service_sid]}/Documents/#{@solution[:document_sid]}/Permissions/#{@solution[:identity]}"
173 end

Public Instance Methods

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
193 def delete
194    @version.delete('DELETE', @uri)
195 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
178 def fetch
179   payload = @version.fetch('GET', @uri)
180 
181   DocumentPermissionInstance.new(
182       @version,
183       payload,
184       service_sid: @solution[:service_sid],
185       document_sid: @solution[:document_sid],
186       identity: @solution[:identity],
187   )
188 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
229 def inspect
230   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
231   "#<Twilio.Sync.V1.DocumentPermissionContext #{context}>"
232 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb
222 def to_s
223   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
224   "#<Twilio.Sync.V1.DocumentPermissionContext #{context}>"
225 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
206 def update(read: nil, write: nil, manage: nil)
207   data = Twilio::Values.of({'Read' => read, 'Write' => write, 'Manage' => manage, })
208 
209   payload = @version.update('POST', @uri, data: data)
210 
211   DocumentPermissionInstance.new(
212       @version,
213       payload,
214       service_sid: @solution[:service_sid],
215       document_sid: @solution[:document_sid],
216       identity: @solution[:identity],
217   )
218 end