class Twilio::REST::Chat::V2::CredentialInstance

Public Class Methods

new(version, payload, sid: nil) click to toggle source

Initialize the CredentialInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] sid The SID of the Credential resource to fetch. @return [CredentialInstance] CredentialInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/chat/v2/credential.rb
269 def initialize(version, payload, sid: nil)
270   super(version)
271 
272   # Marshaled Properties
273   @properties = {
274       'sid' => payload['sid'],
275       'account_sid' => payload['account_sid'],
276       'friendly_name' => payload['friendly_name'],
277       'type' => payload['type'],
278       'sandbox' => payload['sandbox'],
279       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
280       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
281       'url' => payload['url'],
282   }
283 
284   # Context
285   @instance_context = nil
286   @params = {'sid' => sid || @properties['sid'], }
287 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
308 def account_sid
309   @properties['account_sid']
310 end
context() click to toggle source

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/v2/credential.rb
293 def context
294   unless @instance_context
295     @instance_context = CredentialContext.new(@version, @params['sid'], )
296   end
297   @instance_context
298 end
date_created() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
332 def date_created
333   @properties['date_created']
334 end
date_updated() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
338 def date_updated
339   @properties['date_updated']
340 end
delete() click to toggle source

Delete the CredentialInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
390 def delete
391   context.delete
392 end
fetch() click to toggle source

Fetch the CredentialInstance @return [CredentialInstance] Fetched CredentialInstance

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
351 def fetch
352   context.fetch
353 end
friendly_name() click to toggle source

@return [String] The string that you assigned to describe the resource

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
314 def friendly_name
315   @properties['friendly_name']
316 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
403 def inspect
404   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
405   "<Twilio.Chat.V2.CredentialInstance #{values}>"
406 end
sandbox() click to toggle source

@return [String] [APN only] Whether to send the credential to sandbox APNs

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
326 def sandbox
327   @properties['sandbox']
328 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
302 def sid
303   @properties['sid']
304 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
396 def to_s
397   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
398   "<Twilio.Chat.V2.CredentialInstance #{values}>"
399 end
type() click to toggle source

@return [credential.PushService] The type of push-notification service the credential is for

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
320 def type
321   @properties['type']
322 end
update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) click to toggle source

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+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/chat/v2/credential.rb
376 def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset)
377   context.update(
378       friendly_name: friendly_name,
379       certificate: certificate,
380       private_key: private_key,
381       sandbox: sandbox,
382       api_key: api_key,
383       secret: secret,
384   )
385 end
url() click to toggle source

@return [String] The absolute URL of the Credential resource

    # File lib/twilio-ruby/rest/chat/v2/credential.rb
344 def url
345   @properties['url']
346 end