Class: Twilio::REST::Preview::DeployedDevices::FleetContext::CertificateContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.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

Constructor Details

#initialize(version, fleet_sid, sid) ⇒ CertificateContext

Initialize the CertificateContext

Parameters:

  • version (Version)

    Version that contains the resource

  • fleet_sid (String)

    The fleet_sid

  • sid (String)

    Provides a 34 character string that uniquely identifies the requested Certificate credential resource.


187
188
189
190
191
192
193
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb', line 187

def initialize(version, fleet_sid, sid)
  super(version)

  # Path Solution
  @solution = {fleet_sid: fleet_sid, sid: sid, }
  @uri = "/Fleets/#{@solution[:fleet_sid]}/Certificates/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Delete the CertificateInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


207
208
209
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb', line 207

def delete
   @version.delete('DELETE', @uri)
end

#fetchCertificateInstance

Fetch the CertificateInstance

Returns:


198
199
200
201
202
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb', line 198

def fetch
  payload = @version.fetch('GET', @uri)

  CertificateInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


235
236
237
238
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb', line 235

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Preview.DeployedDevices.CertificateContext #{context}>"
end

#to_sObject

Provide a user friendly representation


228
229
230
231
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb', line 228

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Preview.DeployedDevices.CertificateContext #{context}>"
end

#update(friendly_name: :unset, device_sid: :unset) ⇒ CertificateInstance

Update the CertificateInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    Provides a human readable descriptive text for this Certificate credential, up to 256 characters long.

  • device_sid (String) (defaults to: :unset)

    Provides the unique string identifier of an existing Device to become authenticated with this Certificate credential.

Returns:


218
219
220
221
222
223
224
# File 'lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb', line 218

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)

  CertificateInstance.new(@version, payload, fleet_sid: @solution[:fleet_sid], sid: @solution[:sid], )
end