Class: Pobo::DTO::ParameterValue

Inherits:
Object
  • Object
show all
Defined in:
lib/pobo/dto/parameter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, value:) ⇒ ParameterValue

Returns a new instance of ParameterValue.



8
9
10
11
# File 'lib/pobo/dto/parameter.rb', line 8

def initialize(id:, value:)
  @id = id
  @value = value
end

Instance Attribute Details

#id ⇒ Object (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/pobo/dto/parameter.rb', line 6

def id
  @id
end

#value ⇒ Object (readonly)

Returns the value of attribute value.



6
7
8
# File 'lib/pobo/dto/parameter.rb', line 6

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object



13
14
15
16
17
18
# File 'lib/pobo/dto/parameter.rb', line 13

def self.from_hash(hash)
  new(
    id: hash["id"] || hash[:id],
    value: hash["value"] || hash[:value]
  )
end

Instance Method Details

#to_hash ⇒ Object Also known as: to_h



20
21
22
23
24
25
# File 'lib/pobo/dto/parameter.rb', line 20

def to_hash
  {
    "id" => @id,
    "value" => @value
  }
end