Class: Ea::Spa::Shard
- Inherits:
-
Struct
- Object
- Struct
- Ea::Spa::Shard
- Defined in:
- lib/ea/spa/shard.rb
Overview
Per-entity detail payload. Plain Ruby value object (not a lutaml-model type) because the payload is an arbitrary JSON blob whose shape depends on the model element's kind — we don't want the framework's hash-type cast getting in the way.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#payload ⇒ Object
Returns the value of attribute payload.
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
9 10 11 |
# File 'lib/ea/spa/shard.rb', line 9 def id @id end |
#kind ⇒ Object
Returns the value of attribute kind
9 10 11 |
# File 'lib/ea/spa/shard.rb', line 9 def kind @kind end |
#payload ⇒ Object
Returns the value of attribute payload
9 10 11 |
# File 'lib/ea/spa/shard.rb', line 9 def payload @payload end |
Instance Method Details
#to_h ⇒ Object
10 11 12 |
# File 'lib/ea/spa/shard.rb', line 10 def to_h { "id" => id, "kind" => kind, "payload" => payload } end |
#to_json(*args) ⇒ Object
14 15 16 |
# File 'lib/ea/spa/shard.rb', line 14 def to_json(*args) JSON.generate(to_h, *args) end |