Class: Twilio::REST::Preview::DeployedDevices::FleetContext::DeviceContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.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, fleet_sid, sid) ⇒ DeviceContext

Initialize the DeviceContext



200
201
202
203
204
205
206
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 200

def initialize(version, fleet_sid, sid)
  super(version)

  # Path Solution
  @solution = {fleet_sid: fleet_sid, sid: sid, }
  @uri = "/Fleets/#{@solution[:fleet_sid]}/Devices/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Deletes the DeviceInstance



226
227
228
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 226

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

#fetchDeviceInstance

Fetch a DeviceInstance



211
212
213
214
215
216
217
218
219
220
221
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 211

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

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

  DeviceInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation



266
267
268
269
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 266

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

#to_sObject

Provide a user friendly representation



259
260
261
262
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 259

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

#update(friendly_name: :unset, identity: :unset, deployment_sid: :unset, enabled: :unset) ⇒ DeviceInstance

Update the DeviceInstance



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 240

def update(friendly_name: :unset, identity: :unset, deployment_sid: :unset, enabled: :unset)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'Identity' => identity,
      'DeploymentSid' => deployment_sid,
      'Enabled' => enabled,
  })

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

  DeviceInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], )
end