class Twilio::REST::Sync::V1::ServiceContext::DocumentInstance
Public Class Methods
Initialize the DocumentInstance
@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] sid The SID of the Document resource to fetch. Can be the
Document resource's `sid` or its `unique_name`.
@return [DocumentInstance] DocumentInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 271 def initialize(version, payload, service_sid: nil, sid: nil) 272 super(version) 273 274 # Marshaled Properties 275 @properties = { 276 'sid' => payload['sid'], 277 'unique_name' => payload['unique_name'], 278 'account_sid' => payload['account_sid'], 279 'service_sid' => payload['service_sid'], 280 'url' => payload['url'], 281 'links' => payload['links'], 282 'revision' => payload['revision'], 283 'data' => payload['data'], 284 'date_expires' => Twilio.deserialize_iso8601_datetime(payload['date_expires']), 285 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 286 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 287 'created_by' => payload['created_by'], 288 } 289 290 # Context 291 @instance_context = nil 292 @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], } 293 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 320 def account_sid 321 @properties['account_sid'] 322 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [DocumentContext] DocumentContext
for this DocumentInstance
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 299 def context 300 unless @instance_context 301 @instance_context = DocumentContext.new(@version, @params['service_sid'], @params['sid'], ) 302 end 303 @instance_context 304 end
@return [String] The identity of the Sync
Document's creator
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 374 def created_by 375 @properties['created_by'] 376 end
@return [Hash] An arbitrary, schema-less object that the Sync
Document stores
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 350 def data 351 @properties['data'] 352 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 362 def date_created 363 @properties['date_created'] 364 end
@return [Time] The ISO 8601 date and time in GMT when the Sync
Document expires
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 356 def date_expires 357 @properties['date_expires'] 358 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 368 def date_updated 369 @properties['date_updated'] 370 end
Delete the DocumentInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 388 def delete 389 context.delete 390 end
Access the document_permissions
@return [document_permissions] document_permissions
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 408 def document_permissions 409 context.document_permissions 410 end
Fetch the DocumentInstance
@return [DocumentInstance] Fetched DocumentInstance
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 381 def fetch 382 context.fetch 383 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 421 def inspect 422 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 423 "<Twilio.Sync.V1.DocumentInstance #{values}>" 424 end
@return [String] The URLs of resources related to the Sync
Document
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 338 def links 339 @properties['links'] 340 end
@return [String] The current revision of the Sync
Document, represented by a string identifier
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 344 def revision 345 @properties['revision'] 346 end
@return [String] The SID of the Sync
Service that the resource is associated with
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 326 def service_sid 327 @properties['service_sid'] 328 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 308 def sid 309 @properties['sid'] 310 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 414 def to_s 415 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 416 "<Twilio.Sync.V1.DocumentInstance #{values}>" 417 end
@return [String] An application-defined string that uniquely identifies the resource
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 314 def unique_name 315 @properties['unique_name'] 316 end
Update the DocumentInstance
@param [Hash] data A JSON string that represents an arbitrary, schema-less
object that the Sync Document stores. Can be up to 16 KiB in length.
@param [String] ttl How long, {in
seconds}[https://www.twilio.com/docs/sync/limits#sync-payload-limits], before the Sync Document expires and is deleted (time-to-live).
@param [String] if_match The If-Match HTTP
request header @return [DocumentInstance] Updated DocumentInstance
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 401 def update(data: :unset, ttl: :unset, if_match: :unset) 402 context.update(data: data, ttl: ttl, if_match: if_match, ) 403 end
@return [String] The absolute URL of the Document resource
# File lib/twilio-ruby/rest/sync/v1/service/document.rb 332 def url 333 @properties['url'] 334 end