Class: DdbRuby::FifthEdition::Movement
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::Movement
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2570 2571 2572 2573 2574 2575 2576 2577 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2570 def self.from_dynamic!(d) d = Types::Hash[d] new( movement_id: d.fetch("movementId"), speed: d.fetch("speed"), notes: d.fetch("notes"), ) end |
.from_json!(json) ⇒ Object
2579 2580 2581 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2579 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2583 2584 2585 2586 2587 2588 2589 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2583 def to_dynamic { "movementId" => movement_id, "speed" => speed, "notes" => notes, } end |
#to_json(options = nil) ⇒ Object
2591 2592 2593 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2591 def to_json( = nil) JSON.generate(to_dynamic, ) end |