class Twilio::REST::Preview::Sync::ServiceContext::DocumentContext

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

new(version, service_sid, sid) click to toggle source

Initialize the DocumentContext @param [Version] version Version that contains the resource @param [String] service_sid The service_sid @param [String] sid The sid @return [DocumentContext] DocumentContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/preview/sync/service/document.rb
170 def initialize(version, service_sid, sid)
171   super(version)
172 
173   # Path Solution
174   @solution = {service_sid: service_sid, sid: sid, }
175   @uri = "/Services/#{@solution[:service_sid]}/Documents/#{@solution[:sid]}"
176 
177   # Dependents
178   @document_permissions = nil
179 end

Public Instance Methods

delete() click to toggle source

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

    # File lib/twilio-ruby/rest/preview/sync/service/document.rb
193 def delete
194    @version.delete('DELETE', @uri)
195 end
document_permissions(identity=:unset) click to toggle source

Access the document_permissions @return [DocumentPermissionList] @return [DocumentPermissionContext] if identity was passed.

    # File lib/twilio-ruby/rest/preview/sync/service/document.rb
215 def document_permissions(identity=:unset)
216   raise ArgumentError, 'identity cannot be nil' if identity.nil?
217 
218   if identity != :unset
219     return DocumentPermissionContext.new(@version, @solution[:service_sid], @solution[:sid], identity, )
220   end
221 
222   unless @document_permissions
223     @document_permissions = DocumentPermissionList.new(
224         @version,
225         service_sid: @solution[:service_sid],
226         document_sid: @solution[:sid],
227     )
228   end
229 
230   @document_permissions
231 end
fetch() click to toggle source

Fetch the DocumentInstance @return [DocumentInstance] Fetched DocumentInstance

    # File lib/twilio-ruby/rest/preview/sync/service/document.rb
184 def fetch
185   payload = @version.fetch('GET', @uri)
186 
187   DocumentInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
188 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/preview/sync/service/document.rb
242 def inspect
243   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
244   "#<Twilio.Preview.Sync.DocumentContext #{context}>"
245 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/preview/sync/service/document.rb
235 def to_s
236   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
237   "#<Twilio.Preview.Sync.DocumentContext #{context}>"
238 end
update(data: nil, if_match: :unset) click to toggle source

Update the DocumentInstance @param [Hash] data The data @param [String] if_match The If-Match HTTP request header @return [DocumentInstance] Updated DocumentInstance

    # File lib/twilio-ruby/rest/preview/sync/service/document.rb
202 def update(data: nil, if_match: :unset)
203   data = Twilio::Values.of({'Data' => Twilio.serialize_object(data), })
204   headers = Twilio::Values.of({'If-Match' => if_match, })
205 
206   payload = @version.update('POST', @uri, data: data, headers: headers)
207 
208   DocumentInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
209 end