Class: Twilio::REST::Notify::V1::CredentialContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Notify::V1::CredentialContext
- Defined in:
- lib/twilio-ruby/rest/notify/v1/credential.rb
Overview
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the CredentialInstance.
-
#fetch ⇒ CredentialInstance
Fetch a CredentialInstance.
-
#initialize(version, sid) ⇒ CredentialContext
constructor
Initialize the CredentialContext.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance
Update the CredentialInstance.
Constructor Details
#initialize(version, sid) ⇒ CredentialContext
Initialize the CredentialContext
185 186 187 188 189 190 191 |
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 185 def initialize(version, sid) super(version) # Path Solution @solution = {sid: sid, } @uri = "/Credentials/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Deletes the CredentialInstance
239 240 241 |
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 239 def delete @version.delete('delete', @uri) end |
#fetch ⇒ CredentialInstance
Fetch a CredentialInstance
196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 196 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) CredentialInstance.new(@version, payload, sid: @solution[:sid], ) end |
#to_s ⇒ Object
Provide a user friendly representation
245 246 247 248 |
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 245 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Notify.V1.CredentialContext #{context}>" end |
#update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance
Update the CredentialInstance
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/twilio-ruby/rest/notify/v1/credential.rb', line 217 def update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'Certificate' => certificate, 'PrivateKey' => private_key, 'Sandbox' => sandbox, 'ApiKey' => api_key, 'Secret' => secret, }) payload = @version.update( 'POST', @uri, data: data, ) CredentialInstance.new(@version, payload, sid: @solution[:sid], ) end |