Class: Twilio::REST::Conversations::V2::ActionInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Conversations::V2::ActionInstance
- Defined in:
- lib/twilio-ruby/rest/conversations/v2/action.rb
Instance Method Summary collapse
-
#completed_at ⇒ Time
Timestamp when the action reached a terminal status.
-
#context ⇒ ActionContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#conversation_id ⇒ String
The conversation this action belongs to.
-
#created_at ⇒ Time
Timestamp when the action was created.
-
#fetch ⇒ ActionInstance
Fetch the ActionInstance.
-
#id ⇒ String
Unique identifier for this Action.
-
#initialize(version, payload, conversation_id: nil, action_id: nil) ⇒ ActionInstance
constructor
Initialize the ActionInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#related ⇒ Hash<String, String>
Named identifiers from downstream.
-
#status ⇒ String
Current status of the Action.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#type ⇒ String
The type of action.
-
#updated_at ⇒ Time
Timestamp when the action was last updated.
Constructor Details
#initialize(version, payload, conversation_id: nil, action_id: nil) ⇒ ActionInstance
Initialize the ActionInstance
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 400 def initialize(version, payload , conversation_id: nil, action_id: nil) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Marshaled Properties @properties = { 'id' => payload['id'], 'type' => payload['type'], 'status' => payload['status'], 'conversation_id' => payload['conversation_id'], 'related' => payload['related'], 'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']), 'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']), 'completed_at' => Twilio.deserialize_iso8601_datetime(payload['completed_at']), } # Context @instance_context = nil @params = { 'conversation_id' => conversation_id || @properties['conversation_id'] ,'action_id' => action_id || @properties['action_id'] , } end |
Instance Method Details
#completed_at ⇒ Time
Returns Timestamp when the action reached a terminal status.
477 478 479 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 477 def completed_at @properties['completed_at'] end |
#context ⇒ ActionContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
426 427 428 429 430 431 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 426 def context unless @instance_context @instance_context = ActionContext.new(@version , @params['conversation_id'], @params['action_id']) end @instance_context end |
#conversation_id ⇒ String
Returns The conversation this action belongs to.
453 454 455 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 453 def conversation_id @properties['conversation_id'] end |
#created_at ⇒ Time
Returns Timestamp when the action was created.
465 466 467 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 465 def created_at @properties['created_at'] end |
#fetch ⇒ ActionInstance
Fetch the ActionInstance
484 485 486 487 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 484 def fetch context.fetch end |
#id ⇒ String
Returns Unique identifier for this Action.
435 436 437 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 435 def id @properties['id'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
498 499 500 501 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 498 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V2.ActionInstance #{values}>" end |
#related ⇒ Hash<String, String>
Returns Named identifiers from downstream. For SEND_MESSAGE: - messageSid: The downstream message SID (present when PENDING or COMPLETED) - communicationId: The Communication ID (present when COMPLETED).
459 460 461 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 459 def @properties['related'] end |
#status ⇒ String
Returns Current status of the Action. - PENDING: Action accepted, awaiting downstream confirmation - COMPLETED: Downstream backend confirmed the action - FAILED: Downstream backend reported a failure.
447 448 449 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 447 def status @properties['status'] end |
#to_s ⇒ Object
Provide a user friendly representation
491 492 493 494 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 491 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V2.ActionInstance #{values}>" end |
#type ⇒ String
Returns The type of action. Accepted values: SEND_MESSAGE.
441 442 443 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 441 def type @properties['type'] end |
#updated_at ⇒ Time
Returns Timestamp when the action was last updated.
471 472 473 |
# File 'lib/twilio-ruby/rest/conversations/v2/action.rb', line 471 def updated_at @properties['updated_at'] end |