Class: TaskResourceResourcesItem

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



36738
36739
36740
36741
36742
36743
36744
# File 'lib/schemas.rb', line 36738

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    id:  d["id"],
    url: d["url"],
  )
end

.from_json!(json) ⇒ Object



36746
36747
36748
# File 'lib/schemas.rb', line 36746

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

Instance Method Details

#to_dynamicObject



36750
36751
36752
36753
36754
36755
# File 'lib/schemas.rb', line 36750

def to_dynamic
  {
    "id"  => id,
    "url" => url,
  }
end

#to_json(options = nil) ⇒ Object



36757
36758
36759
# File 'lib/schemas.rb', line 36757

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