class Twilio::REST::Sync::V1::ServiceContext::SyncListContext::SyncListItemInstance
Public Class Methods
Initialize the SyncListItemInstance
@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] list_sid
The SID of the Sync
List that contains the List Item. @param [String] index The index of the Sync
List Item resource to fetch. @return [SyncListItemInstance] SyncListItemInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 326 def initialize(version, payload, service_sid: nil, list_sid: nil, index: nil) 327 super(version) 328 329 # Marshaled Properties 330 @properties = { 331 'index' => payload['index'].to_i, 332 'account_sid' => payload['account_sid'], 333 'service_sid' => payload['service_sid'], 334 'list_sid' => payload['list_sid'], 335 'url' => payload['url'], 336 'revision' => payload['revision'], 337 'data' => payload['data'], 338 'date_expires' => Twilio.deserialize_iso8601_datetime(payload['date_expires']), 339 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 340 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 341 'created_by' => payload['created_by'], 342 } 343 344 # Context 345 @instance_context = nil 346 @params = { 347 'service_sid' => service_sid, 348 'list_sid' => list_sid, 349 'index' => index || @properties['index'], 350 } 351 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 377 def account_sid 378 @properties['account_sid'] 379 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 [SyncListItemContext] SyncListItemContext
for this SyncListItemInstance
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 357 def context 358 unless @instance_context 359 @instance_context = SyncListItemContext.new( 360 @version, 361 @params['service_sid'], 362 @params['list_sid'], 363 @params['index'], 364 ) 365 end 366 @instance_context 367 end
@return [String] The identity of the List Item's creator
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 431 def created_by 432 @properties['created_by'] 433 end
@return [Hash] An arbitrary, schema-less object that the List Item stores
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 407 def data 408 @properties['data'] 409 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 419 def date_created 420 @properties['date_created'] 421 end
@return [Time] The ISO 8601 date and time in GMT when the List Item expires
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 413 def date_expires 414 @properties['date_expires'] 415 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/sync_list/sync_list_item.rb 425 def date_updated 426 @properties['date_updated'] 427 end
Delete the SyncListItemInstance
@param [String] if_match If provided, applies this mutation if (and only if) the
“revision” field of this {map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match].
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 449 def delete(if_match: :unset) 450 context.delete(if_match: if_match, ) 451 end
Fetch the SyncListItemInstance
@return [SyncListItemInstance] Fetched SyncListItemInstance
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 438 def fetch 439 context.fetch 440 end
@return [String] The automatically generated index of the List Item
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 371 def index 372 @properties['index'] 373 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 491 def inspect 492 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 493 "<Twilio.Sync.V1.SyncListItemInstance #{values}>" 494 end
@return [String] The SID of the Sync
List that contains the List Item
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 389 def list_sid 390 @properties['list_sid'] 391 end
@return [String] The current revision of the item, represented as a string
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 401 def revision 402 @properties['revision'] 403 end
@return [String] The SID of the Sync
Service that the resource is associated with
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 383 def service_sid 384 @properties['service_sid'] 385 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 484 def to_s 485 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 486 "<Twilio.Sync.V1.SyncListItemInstance #{values}>" 487 end
Update the SyncListItemInstance
@param [Hash] data A JSON string that represents an arbitrary, schema-less
object that the List Item stores. Can be up to 16 KiB in length.
@param [String] ttl An alias for `item_ttl`. If both parameters are provided,
this value is ignored.
@param [String] item_ttl How long, {in
seconds}[https://www.twilio.com/docs/sync/limits#sync-payload-limits], before the List Item expires (time-to-live) and is deleted.
@param [String] collection_ttl How long, {in
seconds}[https://www.twilio.com/docs/sync/limits#sync-payload-limits], before the List Item's parent Sync List expires (time-to-live) and is deleted. This parameter can only be used when the List Item's `data` or `ttl` is updated in the same request.
@param [String] if_match If provided, applies this mutation if (and only if) the
“revision” field of this {map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP [If-Match header}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match].
@return [SyncListItemInstance] Updated SyncListItemInstance
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 472 def update(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) 473 context.update( 474 data: data, 475 ttl: ttl, 476 item_ttl: item_ttl, 477 collection_ttl: collection_ttl, 478 if_match: if_match, 479 ) 480 end
@return [String] The absolute URL of the List Item resource
# File lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb 395 def url 396 @properties['url'] 397 end