Class: Folder

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



3307
3308
3309
3310
3311
3312
3313
3314
# File 'lib/schemas.rb', line 3307

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    id:            d["id"],
    folder_name:   d.fetch("name"),
    revision_date: d.fetch("revisionDate"),
  )
end

.from_json!(json) ⇒ Object



3316
3317
3318
# File 'lib/schemas.rb', line 3316

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

Instance Method Details

#to_dynamicObject



3320
3321
3322
3323
3324
3325
3326
# File 'lib/schemas.rb', line 3320

def to_dynamic
  {
    "id"           => id,
    "name"         => folder_name,
    "revisionDate" => revision_date,
  }
end

#to_json(options = nil) ⇒ Object



3328
3329
3330
# File 'lib/schemas.rb', line 3328

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