Class: SimpleAcp::Models::RunCreateRequest

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

Overview

Request body for creating a run

Class Method Summary collapse

Instance 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

Class Method Details

.from_hash(hash) ⇒ Object



247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/simple_acp/models/run.rb', line 247

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

  instance = super

  input_data = hash["input"] || hash[:input] || []
  instance.input = input_data.map { |m| Message.from_hash(m) }

  if hash["session"] || hash[:session]
    instance.session = Session.from_hash(hash["session"] || hash[:session])
  end

  instance
end

Instance Method Details

#valid? ⇒ Boolean

Returns:

  • (Boolean)


262
263
264
265
266
267
268
# File 'lib/simple_acp/models/run.rb', line 262

def valid?
  return false unless Types.valid_agent_name?(@agent_name)
  return false if @input.nil? || @input.empty?
  return false if @mode && !Types::RunMode.valid?(@mode)

  true
end