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

Parameters:

  • version (Version)

    Version that contains the resource

  • fleet_sid (String)
  • sid (String)

    Provides a 34 character string that uniquely identifies the requested Device resource.



175
176
177
178
179
180
181
182
183
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 175

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

Delete the DeviceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



187
188
189
190
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 187

def delete

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

#fetchDeviceInstance

Fetch the DeviceInstance

Returns:



195
196
197
198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 195

def fetch

    payload = @version.fetch('GET', @uri)
    DeviceInstance.new(
        @version,
        payload,
        fleet_sid: @solution[:fleet_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



246
247
248
249
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 246

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

#to_sObject

Provide a user friendly representation



239
240
241
242
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 239

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

Parameters:

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

    Provides a human readable descriptive text to be assigned to this Device, up to 256 characters long.

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

    Provides an arbitrary string identifier representing a human user to be associated with this Device, up to 256 characters long.

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

    Specifies the unique string identifier of the Deployment group that this Device is going to be associated with.

  • enabled (Boolean) (defaults to: :unset)

Returns:



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 213

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