class Twilio::REST::Notify::V1::CredentialInstance

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

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 Twilio-provided string that uniquely identifies the

Credential resource to fetch.

@return [CredentialInstance] CredentialInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/notify/v1/credential.rb
277 def initialize(version, payload, sid: nil)
278   super(version)
279 
280   # Marshaled Properties
281   @properties = {
282       'sid' => payload['sid'],
283       'account_sid' => payload['account_sid'],
284       'friendly_name' => payload['friendly_name'],
285       'type' => payload['type'],
286       'sandbox' => payload['sandbox'],
287       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
288       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
289       'url' => payload['url'],
290   }
291 
292   # Context
293   @instance_context = nil
294   @params = {'sid' => sid || @properties['sid'], }
295 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/notify/v1/credential.rb
316 def account_sid
317   @properties['account_sid']
318 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/notify/v1/credential.rb
301 def context
302   unless @instance_context
303     @instance_context = CredentialContext.new(@version, @params['sid'], )
304   end
305   @instance_context
306 end
date_created() click to toggle source

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

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
340 def date_created
341   @properties['date_created']
342 end
date_updated() click to toggle source

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

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
346 def date_updated
347   @properties['date_updated']
348 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
397 def delete
398   context.delete
399 end
fetch() click to toggle source

Fetch the CredentialInstance @return [CredentialInstance] Fetched CredentialInstance

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
359 def fetch
360   context.fetch
361 end
friendly_name() click to toggle source

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

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
322 def friendly_name
323   @properties['friendly_name']
324 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
410 def inspect
411   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
412   "<Twilio.Notify.V1.CredentialInstance #{values}>"
413 end
sandbox() click to toggle source

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

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
334 def sandbox
335   @properties['sandbox']
336 end
sid() click to toggle source

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

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
310 def sid
311   @properties['sid']
312 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
403 def to_s
404   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
405   "<Twilio.Notify.V1.CredentialInstance #{values}>"
406 end
type() click to toggle source

@return [credential.PushService] The Credential type, one of `gcm`, `fcm`, or `apn`

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
328 def type
329   @properties['type']
330 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. 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
383 def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset)
384   context.update(
385       friendly_name: friendly_name,
386       certificate: certificate,
387       private_key: private_key,
388       sandbox: sandbox,
389       api_key: api_key,
390       secret: secret,
391   )
392 end
url() click to toggle source

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

    # File lib/twilio-ruby/rest/notify/v1/credential.rb
352 def url
353   @properties['url']
354 end