Class: Twilio::REST::Knowledge::V2::OperationInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Knowledge::V2::OperationInstance
- Defined in:
- lib/twilio-ruby/rest/knowledge/v2/operation.rb
Instance Method Summary collapse
-
#completed_at ⇒ Time
When the operation completed or failed.
-
#context ⇒ OperationContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#created_at ⇒ Time
When the operation was created.
- #error ⇒ OperationStatusError
-
#fetch ⇒ OperationInstance
Fetch the OperationInstance.
-
#initialize(version, payload, operation_id: nil) ⇒ OperationInstance
constructor
Initialize the OperationInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#operation_id ⇒ String
The unique identifier for this operation.
- #result ⇒ OperationResultResourceId
-
#result_url ⇒ String
URL to fetch the resulting resource.
-
#status ⇒ String
The current status of the operation.
-
#status_url ⇒ String
URI to check operation status.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, payload, operation_id: nil) ⇒ OperationInstance
Initialize the OperationInstance
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 269 def initialize(version, payload , operation_id: nil) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Marshaled Properties @properties = { 'operation_id' => payload['operation_id'], 'status' => payload['status'], 'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']), 'status_url' => payload['status_url'], 'completed_at' => Twilio.deserialize_iso8601_datetime(payload['completed_at']), 'result' => payload['result'], 'error' => payload['error'], 'result_url' => payload['result_url'], } # Context @instance_context = nil @params = { 'operation_id' => operation_id || @properties['operation_id'] , } end |
Instance Method Details
#completed_at ⇒ Time
Returns When the operation completed or failed.
328 329 330 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 328 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
295 296 297 298 299 300 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 295 def context unless @instance_context @instance_context = OperationContext.new(@version , @params['operation_id']) end @instance_context end |
#created_at ⇒ Time
Returns When the operation was created.
316 317 318 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 316 def created_at @properties['created_at'] end |
#error ⇒ OperationStatusError
340 341 342 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 340 def error @properties['error'] end |
#fetch ⇒ OperationInstance
Fetch the OperationInstance
353 354 355 356 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 353 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
367 368 369 370 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 367 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Knowledge.V2.OperationInstance #{values}>" end |
#operation_id ⇒ String
Returns The unique identifier for this operation.
304 305 306 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 304 def operation_id @properties['operation_id'] end |
#result ⇒ OperationResultResourceId
334 335 336 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 334 def result @properties['result'] end |
#result_url ⇒ String
Returns URL to fetch the resulting resource.
346 347 348 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 346 def result_url @properties['result_url'] end |
#status ⇒ String
Returns The current status of the operation.
310 311 312 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 310 def status @properties['status'] end |
#status_url ⇒ String
Returns URI to check operation status.
322 323 324 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 322 def status_url @properties['status_url'] end |
#to_s ⇒ Object
Provide a user friendly representation
360 361 362 363 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 360 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Knowledge.V2.OperationInstance #{values}>" end |