Class: Twilio::REST::Intelligence::V3::OperatorContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::Intelligence::V3::OperatorContext
- Defined in:
- lib/twilio-ruby/rest/intelligence/v3/operator.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the OperatorInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the OperatorInstanceMetadata.
-
#fetch ⇒ OperatorInstance
Fetch the OperatorInstance.
-
#fetch_with_metadata ⇒ OperatorInstance
Fetch the OperatorInstanceMetadata.
-
#initialize(version, id) ⇒ OperatorContext
constructor
Initialize the OperatorContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(if_match: :unset, language_operator: nil) ⇒ OperatorInstance
Update the OperatorInstance.
-
#update_with_metadata(if_match: :unset, language_operator: nil) ⇒ OperatorInstance
Update the OperatorInstanceMetadata.
Constructor Details
#initialize(version, id) ⇒ OperatorContext
Initialize the OperatorContext
288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/twilio-ruby/rest/intelligence/v3/operator.rb', line 288 def initialize(version, id) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Path Solution @solution = { id: id, } @uri = "/ControlPlane/Operators/#{@solution[:id]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the OperatorInstance
302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/twilio-ruby/rest/intelligence/v3/operator.rb', line 302 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) OperatorInstance.new( @version, response.body, id: @solution[:id], ) end |
#delete_with_metadata ⇒ Boolean
Delete the OperatorInstanceMetadata
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/twilio-ruby/rest/intelligence/v3/operator.rb', line 320 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) operator_instance = OperatorInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) OperatorInstanceMetadata.new(@version, operator_instance, response.headers, response.status_code) end |
#fetch ⇒ OperatorInstance
Fetch the OperatorInstance
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/twilio-ruby/rest/intelligence/v3/operator.rb', line 339 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) OperatorInstance.new( @version, payload, id: @solution[:id], ) end |
#fetch_with_metadata ⇒ OperatorInstance
Fetch the OperatorInstanceMetadata
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/twilio-ruby/rest/intelligence/v3/operator.rb', line 358 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) operator_instance = OperatorInstance.new( @version, response.body, id: @solution[:id], ) OperatorInstanceMetadata.new( @version, operator_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
444 445 446 447 |
# File 'lib/twilio-ruby/rest/intelligence/v3/operator.rb', line 444 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Intelligence.V3.OperatorContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
437 438 439 440 |
# File 'lib/twilio-ruby/rest/intelligence/v3/operator.rb', line 437 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Intelligence.V3.OperatorContext #{context}>" end |
#update(if_match: :unset, language_operator: nil) ⇒ OperatorInstance
Update the OperatorInstance
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/twilio-ruby/rest/intelligence/v3/operator.rb', line 385 def update( if_match: :unset, language_operator: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) headers['Content-Type'] = 'application/json' payload = @version.update('PUT', @uri, headers: headers, data: language_operator.to_json) OperatorInstance.new( @version, payload, id: @solution[:id], ) end |
#update_with_metadata(if_match: :unset, language_operator: nil) ⇒ OperatorInstance
Update the OperatorInstanceMetadata
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/twilio-ruby/rest/intelligence/v3/operator.rb', line 409 def ( if_match: :unset, language_operator: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) headers['Content-Type'] = 'application/json' response = @version.('PUT', @uri, headers: headers, data: language_operator.to_json) operator_instance = OperatorInstance.new( @version, response.body, id: @solution[:id], ) OperatorInstanceMetadata.new( @version, operator_instance, response.headers, response.status_code ) end |