Class: ABMeter::Core::AssignmentConfig::Parameter
- Inherits:
-
Object
- Object
- ABMeter::Core::AssignmentConfig::Parameter
- Defined in:
- lib/abmeter/core/assignment_config/parameter.rb
Instance Attribute Summary collapse
-
#default_value ⇒ Object
readonly
Returns the value of attribute default_value.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parameter_type ⇒ Object
readonly
Returns the value of attribute parameter_type.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#space_id ⇒ Object
readonly
Returns the value of attribute space_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, slug:, parameter_type:, default_value:, space_id:) ⇒ Parameter
constructor
A new instance of Parameter.
- #serialize(*_) ⇒ Object
Constructor Details
#initialize(id:, slug:, parameter_type:, default_value:, space_id:) ⇒ Parameter
Returns a new instance of Parameter.
9 10 11 12 13 14 15 |
# File 'lib/abmeter/core/assignment_config/parameter.rb', line 9 def initialize(id:, slug:, parameter_type:, default_value:, space_id:) @id = id @slug = slug @parameter_type = parameter_type @default_value = default_value @space_id = space_id end |
Instance Attribute Details
#default_value ⇒ Object (readonly)
Returns the value of attribute default_value.
7 8 9 |
# File 'lib/abmeter/core/assignment_config/parameter.rb', line 7 def default_value @default_value end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/abmeter/core/assignment_config/parameter.rb', line 7 def id @id end |
#parameter_type ⇒ Object (readonly)
Returns the value of attribute parameter_type.
7 8 9 |
# File 'lib/abmeter/core/assignment_config/parameter.rb', line 7 def parameter_type @parameter_type end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
7 8 9 |
# File 'lib/abmeter/core/assignment_config/parameter.rb', line 7 def slug @slug end |
#space_id ⇒ Object (readonly)
Returns the value of attribute space_id.
7 8 9 |
# File 'lib/abmeter/core/assignment_config/parameter.rb', line 7 def space_id @space_id end |
Class Method Details
.from_json(json) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/abmeter/core/assignment_config/parameter.rb', line 17 def self.from_json(json) json.map do |param| new( id: param[:id], slug: param[:slug], default_value: ABMeter::Core::Protocol.cast!(param[:default_value], param[:parameter_type]), parameter_type: param[:parameter_type], space_id: param[:space_id] ) end end |
Instance Method Details
#serialize(*_) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/abmeter/core/assignment_config/parameter.rb', line 29 def serialize(*_) { id: id, slug: slug, parameter_type: parameter_type, default_value: default_value.to_s, space_id: space_id } end |