Class: Twilio::REST::Webhooks::V1::OperationInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Webhooks::V1::OperationInstance
- Defined in:
- lib/twilio-ruby/rest/webhooks/v1/operation.rb
Instance Method Summary collapse
- #completed_at ⇒ Time
-
#context ⇒ OperationContext
Generate an instance context for the instance, the context is capable of performing various actions.
- #created_at ⇒ Time
-
#error ⇒ OperationError
Present only when status is FAILED.
-
#fetch ⇒ OperationInstance
Fetch the OperationInstance.
-
#id ⇒ String
Unique operation identifier (TypeID/TTID format).
-
#initialize(version, payload, operation_id: nil) ⇒ OperationInstance
constructor
Initialize the OperationInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#resource_id ⇒ String
ID of the affected resource.
-
#retention_period ⇒ String
ISO-8601 duration for how long this Operation record is retained after creation (fixed at 7 days).
-
#status ⇒ String
Current state of the operation: - PENDING: Accepted, not yet started - RUNNING: Propagating to all regions (typically 30-60 seconds) - COMPLETED: Rule active globally - CANCELLED: Operation was cancelled before completion - FAILED: Operation could not complete; see error field for details.
-
#status_url ⇒ String
URL to poll for operation status (same as Location header in 202 response).
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, payload, operation_id: nil) ⇒ OperationInstance
Initialize the OperationInstance
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 406 def initialize(version, payload , operation_id: nil) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Marshaled Properties @properties = { 'id' => payload['id'], 'status_url' => payload['status_url'], 'status' => payload['status'], 'error' => payload['error'], 'resource_id' => payload['resource_id'], 'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']), 'completed_at' => Twilio.deserialize_iso8601_datetime(payload['completed_at']), 'retention_period' => payload['retention_period'], } # Context @instance_context = nil @params = { 'operation_id' => operation_id || @properties['operation_id'] , } end |
Instance Method Details
#completed_at ⇒ Time
477 478 479 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 477 def completed_at @properties['completed_at'] end |
#context ⇒ OperationContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
432 433 434 435 436 437 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 432 def context unless @instance_context @instance_context = OperationContext.new(@version , @params['operation_id']) end @instance_context end |
#created_at ⇒ Time
471 472 473 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 471 def created_at @properties['created_at'] end |
#error ⇒ OperationError
Returns Present only when status is FAILED.
459 460 461 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 459 def error @properties['error'] end |
#fetch ⇒ OperationInstance
Fetch the OperationInstance
490 491 492 493 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 490 def fetch context.fetch end |
#id ⇒ String
Returns Unique operation identifier (TypeID/TTID format).
441 442 443 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 441 def id @properties['id'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
504 505 506 507 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 504 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Webhooks.V1.OperationInstance #{values}>" end |
#resource_id ⇒ String
Returns ID of the affected resource.
465 466 467 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 465 def resource_id @properties['resource_id'] end |
#retention_period ⇒ String
Returns ISO-8601 duration for how long this Operation record is retained after creation (fixed at 7 days).
483 484 485 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 483 def retention_period @properties['retention_period'] end |
#status ⇒ String
Returns Current state of the operation: - PENDING: Accepted, not yet started - RUNNING: Propagating to all regions (typically 30-60 seconds) - COMPLETED: Rule active globally - CANCELLED: Operation was cancelled before completion - FAILED: Operation could not complete; see error field for details.
453 454 455 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 453 def status @properties['status'] end |
#status_url ⇒ String
Returns URL to poll for operation status (same as Location header in 202 response).
447 448 449 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 447 def status_url @properties['status_url'] end |
#to_s ⇒ Object
Provide a user friendly representation
497 498 499 500 |
# File 'lib/twilio-ruby/rest/webhooks/v1/operation.rb', line 497 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Webhooks.V1.OperationInstance #{values}>" end |