Class: Cadenya::Types::Agent

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(metadata: nil, spec: nil, info: nil, state: nil) ⇒ Agent

Returns a new instance of Agent.



388
389
390
391
392
393
# File 'lib/cadenya/types.rb', line 388

def initialize(metadata: nil, spec: nil, info: nil, state: nil)
  @metadata = 
  @spec = spec
  @info = info
  @state = state
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



386
387
388
# File 'lib/cadenya/types.rb', line 386

def info
  @info
end

#metadataObject (readonly)

Returns the value of attribute metadata.



386
387
388
# File 'lib/cadenya/types.rb', line 386

def 
  @metadata
end

#specObject (readonly)

Returns the value of attribute spec.



386
387
388
# File 'lib/cadenya/types.rb', line 386

def spec
  @spec
end

#stateObject (readonly)

Returns the value of attribute state.



386
387
388
# File 'lib/cadenya/types.rb', line 386

def state
  @state
end

Class Method Details

.from_json(data) ⇒ Object



395
396
397
398
399
400
401
402
# File 'lib/cadenya/types.rb', line 395

def self.from_json(data)
  new(
    metadata: data["metadata"].nil? ? nil : Types::ResourceMetadata.from_json(data["metadata"]),
    spec: data["spec"].nil? ? nil : Types::AgentSpec.from_json(data["spec"]),
    info: data["info"].nil? ? nil : Types::AgentInfo.from_json(data["info"]),
    state: data["state"],
  )
end

Instance Method Details

#to_hObject



404
405
406
407
408
409
410
411
# File 'lib/cadenya/types.rb', line 404

def to_h
  {
    metadata: Util.plain(@metadata),
    spec: Util.plain(@spec),
    info: Util.plain(@info),
    state: Util.plain(@state),
  }.reject { |_k, v| v.nil? }
end