Class: Twilio::REST::Preview::DeployedDevices::FleetContext::DeviceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Preview::DeployedDevices::FleetContext::DeviceContext
- 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
-
#delete ⇒ Boolean
Deletes the DeviceInstance.
-
#fetch ⇒ DeviceInstance
Fetch a DeviceInstance.
-
#initialize(version, fleet_sid, sid) ⇒ DeviceContext
constructor
Initialize the DeviceContext.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, identity: :unset, deployment_sid: :unset, enabled: :unset) ⇒ DeviceInstance
Update the DeviceInstance.
Constructor Details
#initialize(version, fleet_sid, sid) ⇒ DeviceContext
Initialize the DeviceContext
217 218 219 220 221 222 223 224 225 226 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 217 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
#delete ⇒ Boolean
Deletes the DeviceInstance
251 252 253 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 251 def delete @version.delete('delete', @uri) end |
#fetch ⇒ DeviceInstance
Fetch a DeviceInstance
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 231 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 |
#to_s ⇒ Object
Provide a user friendly representation
289 290 291 292 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 289 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
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 265 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 |