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
Delete the DeviceInstance.
-
#fetch ⇒ DeviceInstance
Fetch the DeviceInstance.
-
#initialize(version, fleet_sid, sid) ⇒ DeviceContext
constructor
Initialize the DeviceContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#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
193 194 195 196 197 198 199 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 193 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
Delete the DeviceInstance
213 214 215 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 213 def delete @version.delete('DELETE', @uri) end |
#fetch ⇒ DeviceInstance
Fetch the DeviceInstance
204 205 206 207 208 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 204 def fetch payload = @version.fetch('GET', @uri) DeviceInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
249 250 251 252 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 249 def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.DeployedDevices.DeviceContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
242 243 244 245 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 242 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
227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 227 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 |