Class: Twilio::REST::Microvisor::V1::DeviceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Microvisor::V1::DeviceContext
- Defined in:
- lib/twilio-ruby/rest/microvisor/v1/device.rb,
lib/twilio-ruby/rest/microvisor/v1/device/device_config.rb,
lib/twilio-ruby/rest/microvisor/v1/device/device_secret.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].
Defined Under Namespace
Classes: DeviceConfigContext, DeviceConfigInstance, DeviceConfigList, DeviceConfigPage, DeviceSecretContext, DeviceSecretInstance, DeviceSecretList, DeviceSecretPage
Instance Method Summary collapse
-
#device_configs(key = :unset) ⇒ DeviceConfigList, DeviceConfigContext
Access the device_configs.
-
#device_secrets(key = :unset) ⇒ DeviceSecretList, DeviceSecretContext
Access the device_secrets.
-
#fetch ⇒ DeviceInstance
Fetch the DeviceInstance.
-
#initialize(version, sid) ⇒ DeviceContext
constructor
Initialize the DeviceContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(unique_name: :unset, target_app: :unset, logging_enabled: :unset, restart_app: :unset) ⇒ DeviceInstance
Update the DeviceInstance.
Constructor Details
#initialize(version, sid) ⇒ DeviceContext
Initialize the DeviceContext
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/twilio-ruby/rest/microvisor/v1/device.rb', line 134 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Devices/#{@solution[:sid]}" # Dependents @device_secrets = nil @device_configs = nil end |
Instance Method Details
#device_configs(key = :unset) ⇒ DeviceConfigList, DeviceConfigContext
Access the device_configs
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/twilio-ruby/rest/microvisor/v1/device.rb', line 210 def device_configs(key=:unset) raise ArgumentError, 'key cannot be nil' if key.nil? if key != :unset return DeviceConfigContext.new(@version, @solution[:sid],key ) end unless @device_configs @device_configs = DeviceConfigList.new( @version, device_sid: @solution[:sid], ) end @device_configs end |
#device_secrets(key = :unset) ⇒ DeviceSecretList, DeviceSecretContext
Access the device_secrets
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/twilio-ruby/rest/microvisor/v1/device.rb', line 191 def device_secrets(key=:unset) raise ArgumentError, 'key cannot be nil' if key.nil? if key != :unset return DeviceSecretContext.new(@version, @solution[:sid],key ) end unless @device_secrets @device_secrets = DeviceSecretList.new( @version, device_sid: @solution[:sid], ) end @device_secrets end |
#fetch ⇒ DeviceInstance
Fetch the DeviceInstance
148 149 150 151 152 153 154 155 156 |
# File 'lib/twilio-ruby/rest/microvisor/v1/device.rb', line 148 def fetch payload = @version.fetch('GET', @uri) DeviceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
235 236 237 238 |
# File 'lib/twilio-ruby/rest/microvisor/v1/device.rb', line 235 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Microvisor.V1.DeviceContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
228 229 230 231 |
# File 'lib/twilio-ruby/rest/microvisor/v1/device.rb', line 228 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Microvisor.V1.DeviceContext #{context}>" end |
#update(unique_name: :unset, target_app: :unset, logging_enabled: :unset, restart_app: :unset) ⇒ DeviceInstance
Update the DeviceInstance
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/twilio-ruby/rest/microvisor/v1/device.rb', line 165 def update( unique_name: :unset, target_app: :unset, logging_enabled: :unset, restart_app: :unset ) data = Twilio::Values.of({ 'UniqueName' => unique_name, 'TargetApp' => target_app, 'LoggingEnabled' => logging_enabled, 'RestartApp' => restart_app, }) payload = @version.update('POST', @uri, data: data) DeviceInstance.new( @version, payload, sid: @solution[:sid], ) end |