Class: Twilio::REST::Notify::V1::CredentialContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/notify/v1/credential.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ CredentialContext

Initialize the CredentialContext



193
194
195
196
197
198
199
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 193

def initialize(version, sid)
  super(version)

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

Instance Method Details

#deleteBoolean

Delete the CredentialInstance



248
249
250
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 248

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

#fetchCredentialInstance

Fetch the CredentialInstance



204
205
206
207
208
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 204

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

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

#inspectObject

Provide a detailed, user friendly representation



261
262
263
264
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 261

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

#to_sObject

Provide a user friendly representation



254
255
256
257
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 254

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

#update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance

Update the CredentialInstance



230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 230

def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'Certificate' => certificate,
      'PrivateKey' => private_key,
      'Sandbox' => sandbox,
      'ApiKey' => api_key,
      'Secret' => secret,
  })

  payload = @version.update('POST', @uri, data: data)

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