Class: DdbRuby::FifthEdition::DefinitionStat
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::DefinitionStat
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2688 2689 2690 2691 2692 2693 2694 2695 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2688 def self.from_dynamic!(d) d = Types::Hash[d] new( stat_id: d.fetch("statId"), stat_name: d.fetch("name"), value: d.fetch("value"), ) end |
.from_json!(json) ⇒ Object
2697 2698 2699 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2697 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2701 2702 2703 2704 2705 2706 2707 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2701 def to_dynamic { "statId" => stat_id, "name" => stat_name, "value" => value, } end |
#to_json(options = nil) ⇒ Object
2709 2710 2711 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2709 def to_json( = nil) JSON.generate(to_dynamic, ) end |