Class: Cadenya::Types::VariationAssignment_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(type: nil, agent: nil, id: nil) ⇒ VariationAssignment_Agent

Returns a new instance of VariationAssignment_Agent.



7783
7784
7785
7786
7787
# File 'lib/cadenya/types.rb', line 7783

def initialize(type: nil, agent: nil, id: nil)
  @type = type
  @agent = agent
  @id = id
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



7781
7782
7783
# File 'lib/cadenya/types.rb', line 7781

def agent
  @agent
end

#idObject (readonly)

Returns the value of attribute id.



7781
7782
7783
# File 'lib/cadenya/types.rb', line 7781

def id
  @id
end

#typeObject (readonly)

Returns the value of attribute type.



7781
7782
7783
# File 'lib/cadenya/types.rb', line 7781

def type
  @type
end

Class Method Details

.from_json(data) ⇒ Object



7789
7790
7791
7792
7793
7794
7795
# File 'lib/cadenya/types.rb', line 7789

def self.from_json(data)
  new(
    type: data["type"],
    agent: data["agent"].nil? ? nil : Types::BareMetadata.from_json(data["agent"]),
    id: data["id"],
  )
end

Instance Method Details

#to_hObject



7797
7798
7799
7800
7801
7802
7803
# File 'lib/cadenya/types.rb', line 7797

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