Class: DdbRuby::FifthEdition::TopLevelCondition
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::TopLevelCondition
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2371 2372 2373 2374 2375 2376 2377 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2371 def self.from_dynamic!(d) d = Types::Hash[d] new( id: d.fetch("id"), level: d.fetch("level"), ) end |
.from_json!(json) ⇒ Object
2379 2380 2381 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2379 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2383 2384 2385 2386 2387 2388 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2383 def to_dynamic { "id" => id, "level" => level, } end |
#to_json(options = nil) ⇒ Object
2390 2391 2392 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2390 def to_json( = nil) JSON.generate(to_dynamic, ) end |