class Twilio::REST::Chat::V1::CredentialInstance
Public Class Methods
Initialize the CredentialInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] sid The Twilio-provided string that uniquely identifies the
Credential resource to fetch.
@return [CredentialInstance] CredentialInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/chat/v1/credential.rb 271 def initialize(version, payload, sid: nil) 272 super(version) 273 274 # Marshaled Properties 275 @properties = { 276 'sid' => payload['sid'], 277 'account_sid' => payload['account_sid'], 278 'friendly_name' => payload['friendly_name'], 279 'type' => payload['type'], 280 'sandbox' => payload['sandbox'], 281 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 282 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 283 'url' => payload['url'], 284 } 285 286 # Context 287 @instance_context = nil 288 @params = {'sid' => sid || @properties['sid'], } 289 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/chat/v1/credential.rb 310 def account_sid 311 @properties['account_sid'] 312 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [CredentialContext] CredentialContext
for this CredentialInstance
# File lib/twilio-ruby/rest/chat/v1/credential.rb 295 def context 296 unless @instance_context 297 @instance_context = CredentialContext.new(@version, @params['sid'], ) 298 end 299 @instance_context 300 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/chat/v1/credential.rb 334 def date_created 335 @properties['date_created'] 336 end
@return [Time] The RFC 2822 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/chat/v1/credential.rb 340 def date_updated 341 @properties['date_updated'] 342 end
Delete the CredentialInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/chat/v1/credential.rb 392 def delete 393 context.delete 394 end
Fetch the CredentialInstance
@return [CredentialInstance] Fetched CredentialInstance
# File lib/twilio-ruby/rest/chat/v1/credential.rb 353 def fetch 354 context.fetch 355 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/chat/v1/credential.rb 316 def friendly_name 317 @properties['friendly_name'] 318 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/chat/v1/credential.rb 405 def inspect 406 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 407 "<Twilio.Chat.V1.CredentialInstance #{values}>" 408 end
@return [String] [APN only] Whether to send the credential to sandbox APNs
# File lib/twilio-ruby/rest/chat/v1/credential.rb 328 def sandbox 329 @properties['sandbox'] 330 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/chat/v1/credential.rb 304 def sid 305 @properties['sid'] 306 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v1/credential.rb 398 def to_s 399 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 400 "<Twilio.Chat.V1.CredentialInstance #{values}>" 401 end
@return [credential.PushService] The type of push-notification service the credential is for
# File lib/twilio-ruby/rest/chat/v1/credential.rb 322 def type 323 @properties['type'] 324 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 378 def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) 379 context.update( 380 friendly_name: friendly_name, 381 certificate: certificate, 382 private_key: private_key, 383 sandbox: sandbox, 384 api_key: api_key, 385 secret: secret, 386 ) 387 end
@return [String] The absolute URL of the Credential resource
# File lib/twilio-ruby/rest/chat/v1/credential.rb 346 def url 347 @properties['url'] 348 end