Class: PostApisAPIIDSchemasResponse

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



19626
19627
19628
19629
19630
19631
19632
19633
19634
19635
19636
19637
# File 'lib/schemas.rb', line 19626

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    created_at:                             d["createdAt"],
    created_by:                             d["createdBy"],
    files:                                  d["files"]&.map { |x| PostApisAPIIDSchemasResponseFilesItem.from_dynamic!(x) },
    id:                                     d["id"],
    post_apis_api_id_schemas_response_type: d["type"],
    updated_at:                             d["updatedAt"],
    updated_by:                             d["updatedBy"],
  )
end

.from_json!(json) ⇒ Object



19639
19640
19641
# File 'lib/schemas.rb', line 19639

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

Instance Method Details

#to_dynamicObject



19643
19644
19645
19646
19647
19648
19649
19650
19651
19652
19653
# File 'lib/schemas.rb', line 19643

def to_dynamic
  {
    "createdAt" => created_at,
    "createdBy" => created_by,
    "files"     => files&.map { |x| x.to_dynamic },
    "id"        => id,
    "type"      => post_apis_api_id_schemas_response_type,
    "updatedAt" => updated_at,
    "updatedBy" => updated_by,
  }
end

#to_json(options = nil) ⇒ Object



19655
19656
19657
# File 'lib/schemas.rb', line 19655

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