Class: TaskResource

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



36765
36766
36767
36768
36769
36770
# File 'lib/schemas.rb', line 36765

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    resources: d["resources"]&.map { |x| TaskResourceResourcesItem.from_dynamic!(x) },
  )
end

.from_json!(json) ⇒ Object



36772
36773
36774
# File 'lib/schemas.rb', line 36772

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

Instance Method Details

#to_dynamicObject



36776
36777
36778
36779
36780
# File 'lib/schemas.rb', line 36776

def to_dynamic
  {
    "resources" => resources&.map { |x| x.to_dynamic },
  }
end

#to_json(options = nil) ⇒ Object



36782
36783
36784
# File 'lib/schemas.rb', line 36782

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