class Twilio::REST::Sync::V1::ServiceContext::DocumentContext::DocumentPermissionContext
Public Class Methods
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
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 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 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
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
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 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