Class: Twilio::REST::Sync::V1::ServiceContext::SyncMapContext::SyncMapItemContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Sync::V1::ServiceContext::SyncMapContext::SyncMapItemContext
- Defined in:
- lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb
Instance Method Summary collapse
-
#delete(if_match: :unset) ⇒ Boolean
Delete the SyncMapItemInstance.
-
#delete_with_metadata(if_match: :unset) ⇒ Boolean
Delete the SyncMapItemInstanceMetadata.
-
#fetch ⇒ SyncMapItemInstance
Fetch the SyncMapItemInstance.
-
#fetch_with_metadata ⇒ SyncMapItemInstance
Fetch the SyncMapItemInstanceMetadata.
-
#initialize(version, service_sid, map_sid, key) ⇒ SyncMapItemContext
constructor
Initialize the SyncMapItemContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) ⇒ SyncMapItemInstance
Update the SyncMapItemInstance.
-
#update_with_metadata(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) ⇒ SyncMapItemInstance
Update the SyncMapItemInstanceMetadata.
Constructor Details
#initialize(version, service_sid, map_sid, key) ⇒ SyncMapItemContext
Initialize the SyncMapItemContext
280 281 282 283 284 285 286 287 288 289 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 280 def initialize(version, service_sid, map_sid, key) super(version) # Path Solution @solution = { service_sid: service_sid, map_sid: map_sid, key: key, } @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:map_sid]}/Items/#{@solution[:key]}" end |
Instance Method Details
#delete(if_match: :unset) ⇒ Boolean
Delete the SyncMapItemInstance
294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 294 def delete( if_match: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata(if_match: :unset) ⇒ Boolean
Delete the SyncMapItemInstanceMetadata
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 310 def ( if_match: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) response = @version.('DELETE', @uri, headers: headers) syncMapItem_instance = SyncMapItemInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) SyncMapItemInstanceMetadata.new(@version, syncMapItem_instance, response.headers, response.status_code) end |
#fetch ⇒ SyncMapItemInstance
Fetch the SyncMapItemInstance
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 331 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) SyncMapItemInstance.new( @version, payload, service_sid: @solution[:service_sid], map_sid: @solution[:map_sid], key: @solution[:key], ) end |
#fetch_with_metadata ⇒ SyncMapItemInstance
Fetch the SyncMapItemInstanceMetadata
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 352 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) sync_map_item_instance = SyncMapItemInstance.new( @version, response.body, service_sid: @solution[:service_sid], map_sid: @solution[:map_sid], key: @solution[:key], ) SyncMapItemInstanceMetadata.new( @version, sync_map_item_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
470 471 472 473 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 470 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncMapItemContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
463 464 465 466 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 463 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncMapItemContext #{context}>" end |
#update(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) ⇒ SyncMapItemInstance
Update the SyncMapItemInstance
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 384 def update( data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset ) data = Twilio::Values.of({ 'Data' => Twilio.serialize_object(data), 'Ttl' => ttl, 'ItemTtl' => item_ttl, 'CollectionTtl' => collection_ttl, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) payload = @version.update('POST', @uri, data: data, headers: headers) SyncMapItemInstance.new( @version, payload, service_sid: @solution[:service_sid], map_sid: @solution[:map_sid], key: @solution[:key], ) end |
#update_with_metadata(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) ⇒ SyncMapItemInstance
Update the SyncMapItemInstanceMetadata
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 423 def ( data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset ) data = Twilio::Values.of({ 'Data' => Twilio.serialize_object(data), 'Ttl' => ttl, 'ItemTtl' => item_ttl, 'CollectionTtl' => collection_ttl, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) response = @version.('POST', @uri, data: data, headers: headers) sync_map_item_instance = SyncMapItemInstance.new( @version, response.body, service_sid: @solution[:service_sid], map_sid: @solution[:map_sid], key: @solution[:key], ) SyncMapItemInstanceMetadata.new( @version, sync_map_item_instance, response.headers, response.status_code ) end |