Class: Twilio::REST::Conversations::V1::CredentialContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::CredentialContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/credential.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the CredentialInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the CredentialInstanceMetadata.
-
#fetch ⇒ CredentialInstance
Fetch the CredentialInstance.
-
#fetch_with_metadata ⇒ CredentialInstance
Fetch the CredentialInstanceMetadata.
-
#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(type: :unset, friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance
Update the CredentialInstance.
-
#update_with_metadata(type: :unset, friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance
Update the CredentialInstanceMetadata.
Constructor Details
#initialize(version, sid) ⇒ CredentialContext
Initialize the CredentialContext
259 260 261 262 263 264 265 266 267 268 |
# File 'lib/twilio-ruby/rest/conversations/v1/credential.rb', line 259 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Credentials/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the CredentialInstance
272 273 274 275 276 277 278 279 280 |
# File 'lib/twilio-ruby/rest/conversations/v1/credential.rb', line 272 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the CredentialInstanceMetadata
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
# File 'lib/twilio-ruby/rest/conversations/v1/credential.rb', line 285 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) credential_instance = CredentialInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) CredentialInstanceMetadata.new(@version, credential_instance, response.headers, response.status_code) end |
#fetch ⇒ CredentialInstance
Fetch the CredentialInstance
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/twilio-ruby/rest/conversations/v1/credential.rb', line 304 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) CredentialInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ CredentialInstance
Fetch the CredentialInstanceMetadata
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/twilio-ruby/rest/conversations/v1/credential.rb', line 323 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) credential_instance = CredentialInstance.new( @version, response.body, sid: @solution[:sid], ) CredentialInstanceMetadata.new( @version, credential_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
449 450 451 452 |
# File 'lib/twilio-ruby/rest/conversations/v1/credential.rb', line 449 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.CredentialContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
442 443 444 445 |
# File 'lib/twilio-ruby/rest/conversations/v1/credential.rb', line 442 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.CredentialContext #{context}>" end |
#update(type: :unset, friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance
Update the CredentialInstance
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/twilio-ruby/rest/conversations/v1/credential.rb', line 355 def update( type: :unset, friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset ) data = Twilio::Values.of({ 'Type' => type, 'FriendlyName' => friendly_name, 'Certificate' => certificate, 'PrivateKey' => private_key, 'Sandbox' => sandbox, 'ApiKey' => api_key, 'Secret' => secret, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) CredentialInstance.new( @version, payload, sid: @solution[:sid], ) end |
#update_with_metadata(type: :unset, friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset) ⇒ CredentialInstance
Update the CredentialInstanceMetadata
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/twilio-ruby/rest/conversations/v1/credential.rb', line 399 def ( type: :unset, friendly_name: :unset, certificate: :unset, private_key: :unset, sandbox: :unset, api_key: :unset, secret: :unset ) data = Twilio::Values.of({ 'Type' => type, 'FriendlyName' => friendly_name, 'Certificate' => certificate, 'PrivateKey' => private_key, 'Sandbox' => sandbox, 'ApiKey' => api_key, 'Secret' => secret, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) credential_instance = CredentialInstance.new( @version, response.body, sid: @solution[:sid], ) CredentialInstanceMetadata.new( @version, credential_instance, response.headers, response.status_code ) end |