class Twilio::REST::Conversations::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 A 34 character string that uniquely identifies this
resource.
@return [CredentialInstance] CredentialInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 274 def initialize(version, payload, sid: nil) 275 super(version) 276 277 # Marshaled Properties 278 @properties = { 279 'sid' => payload['sid'], 280 'account_sid' => payload['account_sid'], 281 'friendly_name' => payload['friendly_name'], 282 'type' => payload['type'], 283 'sandbox' => payload['sandbox'], 284 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 285 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 286 'url' => payload['url'], 287 } 288 289 # Context 290 @instance_context = nil 291 @params = {'sid' => sid || @properties['sid'], } 292 end
Public Instance Methods
@return [String] The unique ID of the Account responsible for this credential.
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 313 def account_sid 314 @properties['account_sid'] 315 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/conversations/v1/credential.rb 298 def context 299 unless @instance_context 300 @instance_context = CredentialContext.new(@version, @params['sid'], ) 301 end 302 @instance_context 303 end
@return [Time] The date that this resource was created.
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 337 def date_created 338 @properties['date_created'] 339 end
@return [Time] The date that this resource was last updated.
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 343 def date_updated 344 @properties['date_updated'] 345 end
Delete the CredentialInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 391 def delete 392 context.delete 393 end
Fetch the CredentialInstance
@return [CredentialInstance] Fetched CredentialInstance
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 398 def fetch 399 context.fetch 400 end
@return [String] The human-readable name of this credential.
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 319 def friendly_name 320 @properties['friendly_name'] 321 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 411 def inspect 412 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 413 "<Twilio.Conversations.V1.CredentialInstance #{values}>" 414 end
@return [String] [APN only] Whether to send the credential to sandbox APNs.
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 331 def sandbox 332 @properties['sandbox'] 333 end
@return [String] A 34 character string that uniquely identifies this resource.
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 307 def sid 308 @properties['sid'] 309 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 404 def to_s 405 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 406 "<Twilio.Conversations.V1.CredentialInstance #{values}>" 407 end
@return [credential.PushType] The type of push-notification service the credential is for.
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 325 def type 326 @properties['type'] 327 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 376 def update(type: :unset, friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) 377 context.update( 378 type: type, 379 friendly_name: friendly_name, 380 certificate: certificate, 381 private_key: private_key, 382 sandbox: sandbox, 383 api_key: api_key, 384 secret: secret, 385 ) 386 end
@return [String] An absolute URL for this credential.
# File lib/twilio-ruby/rest/conversations/v1/credential.rb 349 def url 350 @properties['url'] 351 end