Class: CreateAPISchema
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- CreateAPISchema
- Defined in:
- lib/schemas.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
36061 36062 36063 36064 36065 36066 36067 |
# File 'lib/schemas.rb', line 36061 def self.from_dynamic!(d) d = Types::Hash[d] new( files: d.fetch("files").map { |x| CreateAPISchemaFilesItem.from_dynamic!(x) }, create_api_schema_type: d.fetch("type"), ) end |
.from_json!(json) ⇒ Object
36069 36070 36071 |
# File 'lib/schemas.rb', line 36069 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
36073 36074 36075 36076 36077 36078 |
# File 'lib/schemas.rb', line 36073 def to_dynamic { "files" => files.map { |x| x.to_dynamic }, "type" => create_api_schema_type, } end |
#to_json(options = nil) ⇒ Object
36080 36081 36082 |
# File 'lib/schemas.rb', line 36080 def to_json( = nil) JSON.generate(to_dynamic, ) end |