Class: Twilio::REST::Preview::DeployedDevices::FleetContext::KeyContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Preview::DeployedDevices::FleetContext::KeyContext
- Defined in:
- lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the KeyInstance.
-
#fetch ⇒ KeyInstance
Fetch the KeyInstance.
-
#initialize(version, fleet_sid, sid) ⇒ KeyContext
constructor
Initialize the KeyContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, device_sid: :unset) ⇒ KeyInstance
Update the KeyInstance.
Constructor Details
#initialize(version, fleet_sid, sid) ⇒ KeyContext
Initialize the KeyContext
166 167 168 169 170 171 172 173 174 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 166 def initialize(version, fleet_sid, sid) super(version) # Path Solution @solution = { fleet_sid: fleet_sid, sid: sid, } @uri = "/Fleets/#{@solution[:fleet_sid]}/Keys/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the KeyInstance
178 179 180 181 182 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 178 def delete @version.delete('DELETE', @uri) end |
#fetch ⇒ KeyInstance
Fetch the KeyInstance
187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 187 def fetch payload = @version.fetch('GET', @uri) KeyInstance.new( @version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
234 235 236 237 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 234 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.DeployedDevices.KeyContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
227 228 229 230 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 227 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.DeployedDevices.KeyContext #{context}>" end |
#update(friendly_name: :unset, device_sid: :unset) ⇒ KeyInstance
Update the KeyInstance
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb', line 204 def update( friendly_name: :unset, device_sid: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'DeviceSid' => device_sid, }) payload = @version.update('POST', @uri, data: data) KeyInstance.new( @version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], ) end |