class Twilio::REST::Preview::Sync::ServiceContext::DocumentContext::DocumentPermissionContext
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
Public Class Methods
Initialize the DocumentPermissionContext
@param [Version] version Version
that contains the resource @param [String] service_sid The service_sid @param [String] document_sid Identifier of the Sync
Document. Either a SID or a
unique name.
@param [String] identity Arbitrary string identifier representing a user
associated with an FPA token, assigned by the developer.
@return [DocumentPermissionContext] DocumentPermissionContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb 169 def initialize(version, service_sid, document_sid, identity) 170 super(version) 171 172 # Path Solution 173 @solution = {service_sid: service_sid, document_sid: document_sid, identity: identity, } 174 @uri = "/Services/#{@solution[:service_sid]}/Documents/#{@solution[:document_sid]}/Permissions/#{@solution[:identity]}" 175 end
Public Instance Methods
Delete the DocumentPermissionInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb 195 def delete 196 @version.delete('DELETE', @uri) 197 end
Fetch the DocumentPermissionInstance
@return [DocumentPermissionInstance] Fetched DocumentPermissionInstance
# File lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb 180 def fetch 181 payload = @version.fetch('GET', @uri) 182 183 DocumentPermissionInstance.new( 184 @version, 185 payload, 186 service_sid: @solution[:service_sid], 187 document_sid: @solution[:document_sid], 188 identity: @solution[:identity], 189 ) 190 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb 231 def inspect 232 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 233 "#<Twilio.Preview.Sync.DocumentPermissionContext #{context}>" 234 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb 224 def to_s 225 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 226 "#<Twilio.Preview.Sync.DocumentPermissionContext #{context}>" 227 end
Update the DocumentPermissionInstance
@param [Boolean] read Boolean flag specifying whether the identity can read the
Sync Document.
@param [Boolean] write Boolean flag specifying whether the identity can update
the Sync Document.
@param [Boolean] manage Boolean flag specifying whether the identity can delete
the Sync Document.
@return [DocumentPermissionInstance] Updated DocumentPermissionInstance
# File lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb 208 def update(read: nil, write: nil, manage: nil) 209 data = Twilio::Values.of({'Read' => read, 'Write' => write, 'Manage' => manage, }) 210 211 payload = @version.update('POST', @uri, data: data) 212 213 DocumentPermissionInstance.new( 214 @version, 215 payload, 216 service_sid: @solution[:service_sid], 217 document_sid: @solution[:document_sid], 218 identity: @solution[:identity], 219 ) 220 end