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.
-
#fetch ⇒ SyncListItemInstance
Fetch the SyncListItemInstance.
-
#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.
Constructor Details
#initialize(version, service_sid, list_sid, index) ⇒ SyncListItemContext
Initialize the SyncListItemContext
195 196 197 198 199 200 201 202 203 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 195 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
208 209 210 211 212 213 214 215 216 217 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 208 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 |
#fetch ⇒ SyncListItemInstance
Fetch the SyncListItemInstance
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 222 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 |
#inspect ⇒ Object
Provide a detailed, user friendly representation
289 290 291 292 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 289 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncListItemContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
282 283 284 285 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 282 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
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 248 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 |