Class: DdbRuby::FifthEdition::Prerequisite
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- DdbRuby::FifthEdition::Prerequisite
- Defined in:
- lib/ddb_ruby/fifth_edition/structs.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2293 2294 2295 2296 2297 2298 2299 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2293 def self.from_dynamic!(d) d = Types::Hash[d] new( description: d.fetch("description"), prerequisite_mappings: d.fetch("prerequisiteMappings").map { |x| PrerequisiteMapping.from_dynamic!(x) }, ) end |
.from_json!(json) ⇒ Object
2301 2302 2303 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2301 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2305 2306 2307 2308 2309 2310 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2305 def to_dynamic { "description" => description, "prerequisiteMappings" => prerequisite_mappings.map { |x| x.to_dynamic }, } end |
#to_json(options = nil) ⇒ Object
2312 2313 2314 |
# File 'lib/ddb_ruby/fifth_edition/structs.rb', line 2312 def to_json( = nil) JSON.generate(to_dynamic, ) end |