Class: Twilio::REST::Intelligence::V2::ServiceContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::Intelligence::V2::ServiceContext
- Defined in:
- lib/twilio-ruby/rest/intelligence/v2/service.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ServiceInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the ServiceInstanceMetadata.
-
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance.
-
#fetch_with_metadata ⇒ ServiceInstance
Fetch the ServiceInstanceMetadata.
-
#initialize(version, sid) ⇒ ServiceContext
constructor
Initialize the ServiceContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(auto_transcribe: :unset, data_logging: :unset, friendly_name: :unset, unique_name: :unset, auto_redaction: :unset, media_redaction: :unset, webhook_url: :unset, webhook_http_method: :unset, encryption_credential_sid: :unset, if_match: :unset) ⇒ ServiceInstance
Update the ServiceInstance.
-
#update_with_metadata(auto_transcribe: :unset, data_logging: :unset, friendly_name: :unset, unique_name: :unset, auto_redaction: :unset, media_redaction: :unset, webhook_url: :unset, webhook_http_method: :unset, encryption_credential_sid: :unset, if_match: :unset) ⇒ ServiceInstance
Update the ServiceInstanceMetadata.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
269 270 271 272 273 274 275 276 277 278 |
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 269 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Services/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the ServiceInstance
282 283 284 285 286 287 288 289 290 |
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 282 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 ServiceInstanceMetadata
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 295 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) service_instance = ServiceInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ServiceInstanceMetadata.new(@version, service_instance, response.headers, response.status_code) end |
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 314 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ ServiceInstance
Fetch the ServiceInstanceMetadata
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 333 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) service_instance = ServiceInstance.new( @version, response.body, sid: @solution[:sid], ) ServiceInstanceMetadata.new( @version, service_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
475 476 477 478 |
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 475 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Intelligence.V2.ServiceContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
468 469 470 471 |
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 468 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Intelligence.V2.ServiceContext #{context}>" end |
#update(auto_transcribe: :unset, data_logging: :unset, friendly_name: :unset, unique_name: :unset, auto_redaction: :unset, media_redaction: :unset, webhook_url: :unset, webhook_http_method: :unset, encryption_credential_sid: :unset, if_match: :unset) ⇒ ServiceInstance
Update the ServiceInstance
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 368 def update( auto_transcribe: :unset, data_logging: :unset, friendly_name: :unset, unique_name: :unset, auto_redaction: :unset, media_redaction: :unset, webhook_url: :unset, webhook_http_method: :unset, encryption_credential_sid: :unset, if_match: :unset ) data = Twilio::Values.of({ 'AutoTranscribe' => auto_transcribe, 'DataLogging' => data_logging, 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, 'AutoRedaction' => auto_redaction, 'MediaRedaction' => media_redaction, 'WebhookUrl' => webhook_url, 'WebhookHttpMethod' => webhook_http_method, 'EncryptionCredentialSid' => encryption_credential_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) payload = @version.update('POST', @uri, data: data, headers: headers) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#update_with_metadata(auto_transcribe: :unset, data_logging: :unset, friendly_name: :unset, unique_name: :unset, auto_redaction: :unset, media_redaction: :unset, webhook_url: :unset, webhook_http_method: :unset, encryption_credential_sid: :unset, if_match: :unset) ⇒ ServiceInstance
Update the ServiceInstanceMetadata
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/twilio-ruby/rest/intelligence/v2/service.rb', line 420 def ( auto_transcribe: :unset, data_logging: :unset, friendly_name: :unset, unique_name: :unset, auto_redaction: :unset, media_redaction: :unset, webhook_url: :unset, webhook_http_method: :unset, encryption_credential_sid: :unset, if_match: :unset ) data = Twilio::Values.of({ 'AutoTranscribe' => auto_transcribe, 'DataLogging' => data_logging, 'FriendlyName' => friendly_name, 'UniqueName' => unique_name, 'AutoRedaction' => auto_redaction, 'MediaRedaction' => media_redaction, 'WebhookUrl' => webhook_url, 'WebhookHttpMethod' => webhook_http_method, 'EncryptionCredentialSid' => encryption_credential_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) response = @version.('POST', @uri, data: data, headers: headers) service_instance = ServiceInstance.new( @version, response.body, sid: @solution[:sid], ) ServiceInstanceMetadata.new( @version, service_instance, response.headers, response.status_code ) end |