Class: Field
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Field
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2767 2768 2769 2770 2771 2772 2773 2774 2775 |
# File 'lib/schemas.rb', line 2767 def self.from_dynamic!(d) d = Types::Hash[d] new( linked_id: d["linkedId"], field_name: d["name"], field_type: d.fetch("type"), value: d["value"], ) end |
.from_json!(json) ⇒ Object
2777 2778 2779 |
# File 'lib/schemas.rb', line 2777 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2781 2782 2783 2784 2785 2786 2787 2788 |
# File 'lib/schemas.rb', line 2781 def to_dynamic { "linkedId" => linked_id, "name" => field_name, "type" => field_type, "value" => value, } end |
#to_json(options = nil) ⇒ Object
2790 2791 2792 |
# File 'lib/schemas.rb', line 2790 def to_json( = nil) JSON.generate(to_dynamic, ) end |