Class: PostApisAPIIDSchemasBody

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



19522
19523
19524
19525
19526
19527
19528
# File 'lib/schemas.rb', line 19522

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    files:                              d.fetch("files").map { |x| PostApisAPIIDSchemasBodyFilesItem.from_dynamic!(x) },
    post_apis_api_id_schemas_body_type: d.fetch("type"),
  )
end

.from_json!(json) ⇒ Object



19530
19531
19532
# File 'lib/schemas.rb', line 19530

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



19534
19535
19536
19537
19538
19539
# File 'lib/schemas.rb', line 19534

def to_dynamic
  {
    "files" => files.map { |x| x.to_dynamic },
    "type"  => post_apis_api_id_schemas_body_type,
  }
end

#to_json(options = nil) ⇒ Object



19541
19542
19543
# File 'lib/schemas.rb', line 19541

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end