class Twilio::REST::Chat::V1::CredentialContext
Public Class Methods
Initialize the CredentialContext
@param [Version] version Version
that contains the resource @param [String] sid The Twilio-provided string that uniquely identifies the
Credential resource to fetch.
@return [CredentialContext] CredentialContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/chat/v1/credential.rb 188 def initialize(version, sid) 189 super(version) 190 191 # Path Solution 192 @solution = {sid: sid, } 193 @uri = "/Credentials/#{@solution[:sid]}" 194 end
Public Instance Methods
Delete the CredentialInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/chat/v1/credential.rb 244 def delete 245 @version.delete('DELETE', @uri) 246 end
Fetch the CredentialInstance
@return [CredentialInstance] Fetched CredentialInstance
# File lib/twilio-ruby/rest/chat/v1/credential.rb 199 def fetch 200 payload = @version.fetch('GET', @uri) 201 202 CredentialInstance.new(@version, payload, sid: @solution[:sid], ) 203 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/chat/v1/credential.rb 257 def inspect 258 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 259 "#<Twilio.Chat.V1.CredentialContext #{context}>" 260 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v1/credential.rb 250 def to_s 251 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 252 "#<Twilio.Chat.V1.CredentialContext #{context}>" 253 end
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+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----`
@param [String] private_key [APN only] The URL encoded representation of the
private key. For example, `-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR. -----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/v1/credential.rb 226 def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) 227 data = Twilio::Values.of({ 228 'FriendlyName' => friendly_name, 229 'Certificate' => certificate, 230 'PrivateKey' => private_key, 231 'Sandbox' => sandbox, 232 'ApiKey' => api_key, 233 'Secret' => secret, 234 }) 235 236 payload = @version.update('POST', @uri, data: data) 237 238 CredentialInstance.new(@version, payload, sid: @solution[:sid], ) 239 end