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
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 210 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.
269 270 271 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 269 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
236 237 238 239 240 241 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 236 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.
257 258 259 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 257 def created_at @properties['created_at'] end |
#error ⇒ OperationStatusError
281 282 283 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 281 def error @properties['error'] end |
#fetch ⇒ OperationInstance
Fetch the OperationInstance
294 295 296 297 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 294 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
308 309 310 311 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 308 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.
245 246 247 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 245 def operation_id @properties['operation_id'] end |
#result ⇒ OperationResultResourceId
275 276 277 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 275 def result @properties['result'] end |
#result_url ⇒ String
Returns URL to fetch the resulting resource.
287 288 289 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 287 def result_url @properties['result_url'] end |
#status ⇒ String
Returns The current status of the operation.
251 252 253 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 251 def status @properties['status'] end |
#status_url ⇒ String
Returns URI to check operation status.
263 264 265 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 263 def status_url @properties['status_url'] end |
#to_s ⇒ Object
Provide a user friendly representation
301 302 303 304 |
# File 'lib/twilio-ruby/rest/knowledge/v2/operation.rb', line 301 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Knowledge.V2.OperationInstance #{values}>" end |