Class: APIDetails
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- APIDetails
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
35763 35764 35765 35766 35767 35768 35769 35770 35771 |
# File 'lib/schemas.rb', line 35763 def self.from_dynamic!(d) d = Types::Hash[d] new( collections: d["collections"]&.map { |x| APIDetailsCollectionsItem.from_dynamic!(x) }, git_info: d["gitInfo"] ? APIDetailsGitInfo.from_dynamic!(d["gitInfo"]) : nil, schemas: d["schemas"]&.map { |x| APIDetailsSchemasItem.from_dynamic!(x) }, versions: d["versions"]&.map { |x| APIDetailsVersionsItem.from_dynamic!(x) }, ) end |
.from_json!(json) ⇒ Object
35773 35774 35775 |
# File 'lib/schemas.rb', line 35773 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
35777 35778 35779 35780 35781 35782 35783 35784 |
# File 'lib/schemas.rb', line 35777 def to_dynamic { "collections" => collections&.map { |x| x.to_dynamic }, "gitInfo" => git_info&.to_dynamic, "schemas" => schemas&.map { |x| x.to_dynamic }, "versions" => versions&.map { |x| x.to_dynamic }, } end |
#to_json(options = nil) ⇒ Object
35786 35787 35788 |
# File 'lib/schemas.rb', line 35786 def to_json( = nil) JSON.generate(to_dynamic, ) end |