class Twilio::REST::Conversations::V1::CredentialContext
Public Class Methods
Initialize the CredentialContext
@param [Version] version Version
that contains the resource @param [String] sid A 34 character string that uniquely identifies this
resource.
@return [CredentialContext] CredentialContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/conversations/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/conversations/v1/credential.rb 238 def delete 239 @version.delete('DELETE', @uri) 240 end
Fetch the CredentialInstance
@return [CredentialInstance] Fetched CredentialInstance
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 245 def fetch 246 payload = @version.fetch('GET', @uri) 247 248 CredentialInstance.new(@version, payload, sid: @solution[:sid], ) 249 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 260 def inspect 261 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 262 "#<Twilio.Conversations.V1.CredentialContext #{context}>" 263 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 253 def to_s 254 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 255 "#<Twilio.Conversations.V1.CredentialContext #{context}>" 256 end
Update the CredentialInstance
@param [credential.PushType] type The type of push-notification service the
credential is for. Can be: `fcm`, `gcm`, or `apn`.
@param [String] friendly_name A descriptive string that you create to describe
the new 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/conversations/v1/credential.rb 219 def update(type: :unset, friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) 220 data = Twilio::Values.of({ 221 'Type' => type, 222 'FriendlyName' => friendly_name, 223 'Certificate' => certificate, 224 'PrivateKey' => private_key, 225 'Sandbox' => sandbox, 226 'ApiKey' => api_key, 227 'Secret' => secret, 228 }) 229 230 payload = @version.update('POST', @uri, data: data) 231 232 CredentialInstance.new(@version, payload, sid: @solution[:sid], ) 233 end