class Twilio::REST::Sync::V1::ServiceContext::SyncMapContext::SyncMapItemInstance
Public Class Methods
Initialize the SyncMapItemInstance
@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] map_sid
The SID of the Sync
Map that contains the Map Item. @param [String] key The `key` value of the Sync
Map Item resource to fetch. @return [SyncMapItemInstance] SyncMapItemInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 335 def initialize(version, payload, service_sid: nil, map_sid: nil, key: nil) 336 super(version) 337 338 # Marshaled Properties 339 @properties = { 340 'key' => payload['key'], 341 'account_sid' => payload['account_sid'], 342 'service_sid' => payload['service_sid'], 343 'map_sid' => payload['map_sid'], 344 'url' => payload['url'], 345 'revision' => payload['revision'], 346 'data' => payload['data'], 347 'date_expires' => Twilio.deserialize_iso8601_datetime(payload['date_expires']), 348 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 349 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 350 'created_by' => payload['created_by'], 351 } 352 353 # Context 354 @instance_context = nil 355 @params = {'service_sid' => service_sid, 'map_sid' => map_sid, 'key' => key || @properties['key'], } 356 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 382 def account_sid 383 @properties['account_sid'] 384 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 [SyncMapItemContext] SyncMapItemContext
for this SyncMapItemInstance
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 362 def context 363 unless @instance_context 364 @instance_context = SyncMapItemContext.new( 365 @version, 366 @params['service_sid'], 367 @params['map_sid'], 368 @params['key'], 369 ) 370 end 371 @instance_context 372 end
@return [String] The identity of the Map Item's creator
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 436 def created_by 437 @properties['created_by'] 438 end
@return [Hash] An arbitrary, schema-less object that the Map Item stores
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 412 def data 413 @properties['data'] 414 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_map/sync_map_item.rb 424 def date_created 425 @properties['date_created'] 426 end
@return [Time] The ISO 8601 date and time in GMT when the Map Item expires
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 418 def date_expires 419 @properties['date_expires'] 420 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_map/sync_map_item.rb 430 def date_updated 431 @properties['date_updated'] 432 end
Delete the SyncMapItemInstance
@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_map/sync_map_item.rb 454 def delete(if_match: :unset) 455 context.delete(if_match: if_match, ) 456 end
Fetch the SyncMapItemInstance
@return [SyncMapItemInstance] Fetched SyncMapItemInstance
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 443 def fetch 444 context.fetch 445 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 496 def inspect 497 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 498 "<Twilio.Sync.V1.SyncMapItemInstance #{values}>" 499 end
@return [String] The unique, user-defined key for the Map Item
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 376 def key 377 @properties['key'] 378 end
@return [String] The SID of the Sync
Map that contains the Map Item
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 394 def map_sid 395 @properties['map_sid'] 396 end
@return [String] The current revision of the Map Item, represented as a string
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 406 def revision 407 @properties['revision'] 408 end
@return [String] The SID of the Sync
Service that the resource is associated with
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 388 def service_sid 389 @properties['service_sid'] 390 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 489 def to_s 490 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 491 "<Twilio.Sync.V1.SyncMapItemInstance #{values}>" 492 end
Update the SyncMapItemInstance
@param [Hash] data A JSON string that represents an arbitrary, schema-less
object that the Map 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 Map 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 Map Item's parent Sync Map expires (time-to-live) and is deleted. This parameter can only be used when the Map 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 [SyncMapItemInstance] Updated SyncMapItemInstance
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 477 def update(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) 478 context.update( 479 data: data, 480 ttl: ttl, 481 item_ttl: item_ttl, 482 collection_ttl: collection_ttl, 483 if_match: if_match, 484 ) 485 end
@return [String] The absolute URL of the Map Item resource
# File lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb 400 def url 401 @properties['url'] 402 end