class Twilio::REST::Preview::DeployedDevices::FleetContext::KeyContext
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 help@twilio.com.
Public Class Methods
Initialize the KeyContext
@param [Version] version Version
that contains the resource @param [String] fleet_sid The fleet_sid @param [String] sid Provides a 34 character string that uniquely identifies the
requested Key credential resource.
@return [KeyContext] KeyContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb 181 def initialize(version, fleet_sid, sid) 182 super(version) 183 184 # Path Solution 185 @solution = {fleet_sid: fleet_sid, sid: sid, } 186 @uri = "/Fleets/#{@solution[:fleet_sid]}/Keys/#{@solution[:sid]}" 187 end
Public Instance Methods
Delete the KeyInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb 201 def delete 202 @version.delete('DELETE', @uri) 203 end
Fetch the KeyInstance
@return [KeyInstance] Fetched KeyInstance
# File lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb 192 def fetch 193 payload = @version.fetch('GET', @uri) 194 195 KeyInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], ) 196 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb 229 def inspect 230 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 231 "#<Twilio.Preview.DeployedDevices.KeyContext #{context}>" 232 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb 222 def to_s 223 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 224 "#<Twilio.Preview.DeployedDevices.KeyContext #{context}>" 225 end
Update the KeyInstance
@param [String] friendly_name Provides a human readable descriptive text for
this Key credential, up to 256 characters long.
@param [String] device_sid Provides the unique string identifier of an existing
Device to become authenticated with this Key credential.
@return [KeyInstance] Updated KeyInstance
# File lib/twilio-ruby/rest/preview/deployed_devices/fleet/key.rb 212 def update(friendly_name: :unset, device_sid: :unset) 213 data = Twilio::Values.of({'FriendlyName' => friendly_name, 'DeviceSid' => device_sid, }) 214 215 payload = @version.update('POST', @uri, data: data) 216 217 KeyInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], ) 218 end