Class: Cadenya::Types::ObjectiveConfigSnapshot

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent: nil, agent_variation: nil, agent_schedule: nil) ⇒ ObjectiveConfigSnapshot

Returns a new instance of ObjectiveConfigSnapshot.



3566
3567
3568
3569
3570
# File 'lib/cadenya/types.rb', line 3566

def initialize(agent: nil, agent_variation: nil, agent_schedule: nil)
  @agent = agent
  @agent_variation = agent_variation
  @agent_schedule = agent_schedule
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



3564
3565
3566
# File 'lib/cadenya/types.rb', line 3564

def agent
  @agent
end

#agent_scheduleObject (readonly)

Returns the value of attribute agent_schedule.



3564
3565
3566
# File 'lib/cadenya/types.rb', line 3564

def agent_schedule
  @agent_schedule
end

#agent_variationObject (readonly)

Returns the value of attribute agent_variation.



3564
3565
3566
# File 'lib/cadenya/types.rb', line 3564

def agent_variation
  @agent_variation
end

Class Method Details

.from_json(data) ⇒ Object



3572
3573
3574
3575
3576
3577
3578
# File 'lib/cadenya/types.rb', line 3572

def self.from_json(data)
  new(
    agent: data["agent"].nil? ? nil : Types::Agent.from_json(data["agent"]),
    agent_variation: data["agentVariation"].nil? ? nil : Types::AgentVariation.from_json(data["agentVariation"]),
    agent_schedule: data["agentSchedule"].nil? ? nil : Types::AgentSchedule.from_json(data["agentSchedule"]),
  )
end

Instance Method Details

#to_hObject



3580
3581
3582
3583
3584
3585
3586
# File 'lib/cadenya/types.rb', line 3580

def to_h
  {
    agent: Util.plain(@agent),
    agent_variation: Util.plain(@agent_variation),
    agent_schedule: Util.plain(@agent_schedule),
  }.reject { |_k, v| v.nil? }
end