Class: Twilio::REST::Sync::V1::ServiceContext::SyncListContext::SyncListItemContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, list_sid, index) ⇒ SyncListItemContext

Initialize the SyncListItemContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The service_sid

  • list_sid (String)

    The list_sid

  • index (String)

    The index



200
201
202
203
204
205
206
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 200

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

#deleteBoolean

Deletes the SyncListItemInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



232
233
234
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 232

def delete
  @version.delete('delete', @uri)
end

#fetchSyncListItemInstance

Fetch a SyncListItemInstance

Returns:



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 211

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  SyncListItemInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      list_sid: @solution[:list_sid],
      index: @solution[:index],
  )
end

#to_sObject

Provide a user friendly representation



261
262
263
264
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 261

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Sync.V1.SyncListItemContext #{context}>"
end

#update(data: :unset, ttl: :unset) ⇒ SyncListItemInstance

Update the SyncListItemInstance

Parameters:

  • data (Hash) (defaults to: :unset)

    The data

  • ttl (String) (defaults to: :unset)

    The ttl

Returns:



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_item.rb', line 241

def update(data: :unset, ttl: :unset)
  data = Twilio::Values.of({'Data' => Twilio.serialize_object(data), 'Ttl' => ttl, })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  SyncListItemInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      list_sid: @solution[:list_sid],
      index: @solution[:index],
  )
end