Class: PostCollectionsBodyCollection
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- PostCollectionsBodyCollection
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
20507 20508 20509 20510 20511 20512 20513 |
# File 'lib/schemas.rb', line 20507 def self.from_dynamic!(d) d = Types::Hash[d] new( info: PostCollectionsBodyCollectionInfo.from_dynamic!(d.fetch("info")), item: d["item"]&.map { |x| PostCollectionsBodyCollectionItemItem.from_dynamic!(x) }, ) end |
.from_json!(json) ⇒ Object
20515 20516 20517 |
# File 'lib/schemas.rb', line 20515 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
20519 20520 20521 20522 20523 20524 |
# File 'lib/schemas.rb', line 20519 def to_dynamic { "info" => info.to_dynamic, "item" => item&.map { |x| x.to_dynamic }, } end |
#to_json(options = nil) ⇒ Object
20526 20527 20528 |
# File 'lib/schemas.rb', line 20526 def to_json( = nil) JSON.generate(to_dynamic, ) end |