Class: SimpleAcp::Models::AwaitResume Abstract

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_acp/models/await.rb

Overview

This class is abstract.

Subclass for specific resume types

Base class for await resume payloads.

Clients send resume payloads to continue an awaited run with the requested input.

Direct Known Subclasses

MessageAwaitResume

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

#==, attribute, attributes, #hash, #initialize, own_attributes, #to_h, #to_json

Constructor Details

This class inherits a constructor from SimpleAcp::Models::Base

Instance Attribute Details

#type ⇒ String (readonly)

Returns resume type.

Returns:

  • (String) —

    resume type



73
# File 'lib/simple_acp/models/await.rb', line 73

attribute :type, required: true

Class Method Details

.from_hash(hash) ⇒ AwaitResume?

Parse from hash, creating the appropriate subclass.

Parameters:

  • hash (Hash, nil) —

    resume payload data

Returns:



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/simple_acp/models/await.rb', line 79

def self.from_hash(hash)
  return nil if hash.nil?

  type = hash["type"] || hash[:type]

  case type
  when "message"
    MessageAwaitResume.from_hash(hash)
  else
    super
  end
end