Class: Twilio::REST::Preview::Sync::ServiceContext::SyncMapContext::SyncMapItemContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, map_sid, key) ⇒ SyncMapItemContext

Initialize the SyncMapItemContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The service_sid

  • map_sid (String)

    The map_sid

  • key (String)

    The key



202
203
204
205
206
207
208
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb', line 202

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

#deleteBoolean

Deletes the SyncMapItemInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



234
235
236
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb', line 234

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

#fetchSyncMapItemInstance

Fetch a SyncMapItemInstance

Returns:



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb', line 213

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

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

  SyncMapItemInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      map_sid: @solution[:map_sid],
      key: @solution[:key],
  )
end

#inspectObject

Provide a detailed, user friendly representation



269
270
271
272
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb', line 269

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

#to_sObject

Provide a user friendly representation



262
263
264
265
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb', line 262

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

#update(data: nil) ⇒ SyncMapItemInstance

Update the SyncMapItemInstance

Parameters:

  • data (Hash) (defaults to: nil)

    The data

Returns:



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb', line 242

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

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

  SyncMapItemInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      map_sid: @solution[:map_sid],
      key: @solution[:key],
  )
end