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
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
176 177 178 179 180 181 182 183 184 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 176 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
188 189 190 191 192 193 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 188 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ DeviceInstance
Fetch the DeviceInstance
198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 198 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) DeviceInstance.new( @version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
253 254 255 256 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 253 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.DeployedDevices.DeviceContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
246 247 248 249 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 246 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
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/device.rb', line 218 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, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) DeviceInstance.new( @version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], ) end |