Class: VersionExtended

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



37177
37178
37179
37180
37181
37182
37183
37184
37185
37186
37187
37188
# File 'lib/schemas.rb', line 37177

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    collections:           d["collections"]&.map { |x| VersionExtendedCollectionsItem.from_dynamic!(x) },
    created_at:            d["createdAt"],
    id:                    d["id"],
    version_extended_name: d["name"],
    release_notes:         d["releaseNotes"],
    schemas:               d["schemas"]&.map { |x| VersionExtendedSchemasItem.from_dynamic!(x) },
    updated_at:            d["updatedAt"],
  )
end

.from_json!(json) ⇒ Object



37190
37191
37192
# File 'lib/schemas.rb', line 37190

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

Instance Method Details

#to_dynamicObject



37194
37195
37196
37197
37198
37199
37200
37201
37202
37203
37204
# File 'lib/schemas.rb', line 37194

def to_dynamic
  {
    "collections"  => collections&.map { |x| x.to_dynamic },
    "createdAt"    => created_at,
    "id"           => id,
    "name"         => version_extended_name,
    "releaseNotes" => release_notes,
    "schemas"      => schemas&.map { |x| x.to_dynamic },
    "updatedAt"    => updated_at,
  }
end

#to_json(options = nil) ⇒ Object



37206
37207
37208
# File 'lib/schemas.rb', line 37206

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