Class: Twilio::REST::Sync::V1::ServiceContext::SyncListContext::SyncListItemContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Sync::V1::ServiceContext::SyncListContext::SyncListItemContext
- Defined in:
- lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb
Instance Method Summary collapse
-
#delete(if_match: :unset) ⇒ Boolean
Delete the SyncListItemInstance.
-
#delete_with_metadata(if_match: :unset) ⇒ Boolean
Delete the SyncListItemInstanceMetadata.
-
#fetch ⇒ SyncListItemInstance
Fetch the SyncListItemInstance.
-
#fetch_with_metadata ⇒ SyncListItemInstance
Fetch the SyncListItemInstanceMetadata.
-
#initialize(version, service_sid, list_sid, index) ⇒ SyncListItemContext
constructor
Initialize the SyncListItemContext.
-
#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) ⇒ SyncListItemInstance
Update the SyncListItemInstance.
-
#update_with_metadata(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) ⇒ SyncListItemInstance
Update the SyncListItemInstanceMetadata.
Constructor Details
#initialize(version, service_sid, list_sid, index) ⇒ SyncListItemContext
Initialize the SyncListItemContext
266 267 268 269 270 271 272 273 274 275 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 266 def initialize(version, service_sid, list_sid, index) super(version) # Path Solution @solution = { service_sid: service_sid, list_sid: list_sid, index: index, } @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:list_sid]}/Items/#{@solution[:index]}" end |
Instance Method Details
#delete(if_match: :unset) ⇒ Boolean
Delete the SyncListItemInstance
280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 280 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 SyncListItemInstanceMetadata
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 296 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) syncListItem_instance = SyncListItemInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) SyncListItemInstanceMetadata.new(@version, syncListItem_instance, response.headers, response.status_code) end |
#fetch ⇒ SyncListItemInstance
Fetch the SyncListItemInstance
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 317 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) SyncListItemInstance.new( @version, payload, service_sid: @solution[:service_sid], list_sid: @solution[:list_sid], index: @solution[:index], ) end |
#fetch_with_metadata ⇒ SyncListItemInstance
Fetch the SyncListItemInstanceMetadata
338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 338 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) sync_list_item_instance = SyncListItemInstance.new( @version, response.body, service_sid: @solution[:service_sid], list_sid: @solution[:list_sid], index: @solution[:index], ) SyncListItemInstanceMetadata.new( @version, sync_list_item_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
456 457 458 459 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 456 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncListItemContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
449 450 451 452 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 449 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncListItemContext #{context}>" end |
#update(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) ⇒ SyncListItemInstance
Update the SyncListItemInstance
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 370 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) SyncListItemInstance.new( @version, payload, service_sid: @solution[:service_sid], list_sid: @solution[:list_sid], index: @solution[:index], ) end |
#update_with_metadata(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) ⇒ SyncListItemInstance
Update the SyncListItemInstanceMetadata
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 409 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_list_item_instance = SyncListItemInstance.new( @version, response.body, service_sid: @solution[:service_sid], list_sid: @solution[:list_sid], index: @solution[:index], ) SyncListItemInstanceMetadata.new( @version, sync_list_item_instance, response.headers, response.status_code ) end |