class Twilio::REST::Chat::V2::CredentialContext

Public Class Methods

new(version, sid) click to toggle source

Initialize the CredentialContext @param [Version] version Version that contains the resource @param [String] sid The SID of the Credential resource to fetch. @return [CredentialContext] CredentialContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/chat/v2/credential.rb
187 def initialize(version, sid)
188   super(version)
189 
190   # Path Solution
191   @solution = {sid: sid, }
192   @uri = "/Credentials/#{@solution[:sid]}"
193 end

Public Instance Methods

delete() click to toggle source

Delete the CredentialInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
243 def delete
244    @version.delete('DELETE', @uri)
245 end
fetch() click to toggle source

Fetch the CredentialInstance @return [CredentialInstance] Fetched CredentialInstance

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
198 def fetch
199   payload = @version.fetch('GET', @uri)
200 
201   CredentialInstance.new(@version, payload, sid: @solution[:sid], )
202 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
256 def inspect
257   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
258   "#<Twilio.Chat.V2.CredentialContext #{context}>"
259 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
249 def to_s
250   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
251   "#<Twilio.Chat.V2.CredentialContext #{context}>"
252 end
update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) click to toggle source

Update the CredentialInstance @param [String] friendly_name A descriptive string that you create to describe

the resource. It can be up to 64 characters long.

@param [String] certificate [APN only] The URL encoded representation of the

certificate. For example,
`-----BEGIN CERTIFICATE-----
MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A==
-----END CERTIFICATE-----`

@param [String] private_key [APN only] The URL encoded representation of the

private key. For example,
`-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG...
-----END RSA PRIVATE KEY-----`

@param [Boolean] sandbox [APN only] Whether to send the credential to sandbox

APNs. Can be `true` to send to sandbox APNs or `false` to send to production.

@param [String] api_key [GCM only] The API key for the project that was obtained

from the Google Developer console for your GCM Service application credential.

@param [String] secret [FCM only] The **Server key** of your project from the

Firebase console, found under Settings / Cloud messaging.

@return [CredentialInstance] Updated CredentialInstance

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
225 def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset)
226   data = Twilio::Values.of({
227       'FriendlyName' => friendly_name,
228       'Certificate' => certificate,
229       'PrivateKey' => private_key,
230       'Sandbox' => sandbox,
231       'ApiKey' => api_key,
232       'Secret' => secret,
233   })
234 
235   payload = @version.update('POST', @uri, data: data)
236 
237   CredentialInstance.new(@version, payload, sid: @solution[:sid], )
238 end