Class: GetCollectionsResponseCollectionsItem

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



9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
# File 'lib/schemas.rb', line 9015

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    created_at:                                     d["createdAt"],
    get_collections_response_collections_item_fork: d["fork"] ? GetCollectionsResponseCollectionsItemFork.from_dynamic!(d["fork"]) : nil,
    id:                                             d["id"],
    is_public:                                      d["isPublic"],
    get_collections_response_collections_item_name: d["name"],
    owner:                                          d["owner"],
    uid:                                            d["uid"],
    updated_at:                                     d["updatedAt"],
  )
end

.from_json!(json) ⇒ Object



9029
9030
9031
# File 'lib/schemas.rb', line 9029

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

Instance Method Details

#to_dynamicObject



9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
# File 'lib/schemas.rb', line 9033

def to_dynamic
  {
    "createdAt" => created_at,
    "fork"      => get_collections_response_collections_item_fork&.to_dynamic,
    "id"        => id,
    "isPublic"  => is_public,
    "name"      => get_collections_response_collections_item_name,
    "owner"     => owner,
    "uid"       => uid,
    "updatedAt" => updated_at,
  }
end

#to_json(options = nil) ⇒ Object



9046
9047
9048
# File 'lib/schemas.rb', line 9046

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