class Twilio::REST::Notify::V1::CredentialContext
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
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/notify/v1/credential.rb 193 def initialize(version, sid) 194 super(version) 195 196 # Path Solution 197 @solution = {sid: sid, } 198 @uri = "/Credentials/#{@solution[:sid]}" 199 end
Public Instance Methods
Delete the CredentialInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/notify/v1/credential.rb 248 def delete 249 @version.delete('DELETE', @uri) 250 end
Fetch the CredentialInstance
@return [CredentialInstance] Fetched CredentialInstance
# File lib/twilio-ruby/rest/notify/v1/credential.rb 204 def fetch 205 payload = @version.fetch('GET', @uri) 206 207 CredentialInstance.new(@version, payload, sid: @solution[:sid], ) 208 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/notify/v1/credential.rb 261 def inspect 262 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 263 "#<Twilio.Notify.V1.CredentialContext #{context}>" 264 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/notify/v1/credential.rb 254 def to_s 255 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 256 "#<Twilio.Notify.V1.CredentialContext #{context}>" 257 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. Strip everything outside of the headers, e.g. `-----BEGIN CERTIFICATE-----MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A==-----END CERTIFICATE-----`
@param [String] private_key [APN only] The URL-encoded representation of the
private key. Strip everything outside of the headers, e.g. `-----BEGIN RSA PRIVATE KEY-----MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fGgvCI1l9s+cmBY3WIz+cUDqmxiieR\n.-----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 `Server key` of your project from
Firebase console under Settings / Cloud messaging.
@param [String] secret [FCM only] The `Server key` of your project from Firebase
console under Settings / Cloud messaging.
@return [CredentialInstance] Updated CredentialInstance
# File lib/twilio-ruby/rest/notify/v1/credential.rb 230 def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) 231 data = Twilio::Values.of({ 232 'FriendlyName' => friendly_name, 233 'Certificate' => certificate, 234 'PrivateKey' => private_key, 235 'Sandbox' => sandbox, 236 'ApiKey' => api_key, 237 'Secret' => secret, 238 }) 239 240 payload = @version.update('POST', @uri, data: data) 241 242 CredentialInstance.new(@version, payload, sid: @solution[:sid], ) 243 end