Class: PostApisAPIIDSchemasBodyFilesItem

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



19473
19474
19475
19476
19477
19478
19479
19480
# File 'lib/schemas.rb', line 19473

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    content: d["content"],
    path:    d["path"],
    root:    d["root"] ? PostApisAPIIDSchemasBodyFilesItemRoot.from_dynamic!(d["root"]) : nil,
  )
end

.from_json!(json) ⇒ Object



19482
19483
19484
# File 'lib/schemas.rb', line 19482

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

Instance Method Details

#to_dynamicObject



19486
19487
19488
19489
19490
19491
19492
# File 'lib/schemas.rb', line 19486

def to_dynamic
  {
    "content" => content,
    "path"    => path,
    "root"    => root&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



19494
19495
19496
# File 'lib/schemas.rb', line 19494

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