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



3058
3059
3060
3061
3062
3063
3064
3065
# File 'lib/schemas.rb', line 3058

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



3067
3068
3069
# File 'lib/schemas.rb', line 3067

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

Instance Method Details

#to_dynamicObject



3071
3072
3073
3074
3075
3076
3077
# File 'lib/schemas.rb', line 3071

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

#to_json(options = nil) ⇒ Object



3079
3080
3081
# File 'lib/schemas.rb', line 3079

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