Class: Twilio::REST::Chat::V2::CredentialContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Chat::V2::CredentialContext
- Defined in:
- lib/twilio-ruby/rest/chat/v2/credential.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the CredentialInstance.
-
#fetch ⇒ CredentialInstance
Fetch a CredentialInstance.
-
#initialize(version, sid) ⇒ CredentialContext
constructor
Initialize the CredentialContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#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
195 196 197 198 199 200 201 |
# File 'lib/twilio-ruby/rest/chat/v2/credential.rb', line 195 def initialize(version, sid) super(version) # Path Solution @solution = {sid: sid, } @uri = "/Credentials/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Deletes the CredentialInstance
261 262 263 |
# File 'lib/twilio-ruby/rest/chat/v2/credential.rb', line 261 def delete @version.delete('delete', @uri) end |
#fetch ⇒ CredentialInstance
Fetch a CredentialInstance
206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/twilio-ruby/rest/chat/v2/credential.rb', line 206 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) CredentialInstance.new(@version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
274 275 276 277 |
# File 'lib/twilio-ruby/rest/chat/v2/credential.rb', line 274 def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Chat.V2.CredentialContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
267 268 269 270 |
# File 'lib/twilio-ruby/rest/chat/v2/credential.rb', line 267 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Chat.V2.CredentialContext #{context}>" end |
#update(friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance
Update the CredentialInstance
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/twilio-ruby/rest/chat/v2/credential.rb', line 239 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 |