Class: PostMonitorsBody

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



25062
25063
25064
25065
25066
25067
# File 'lib/schemas.rb', line 25062

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    monitor: d["monitor"] ? PostMonitorsBodyMonitor.from_dynamic!(d["monitor"]) : nil,
  )
end

.from_json!(json) ⇒ Object



25069
25070
25071
# File 'lib/schemas.rb', line 25069

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

Instance Method Details

#to_dynamicObject



25073
25074
25075
25076
25077
# File 'lib/schemas.rb', line 25073

def to_dynamic
  {
    "monitor" => monitor&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



25079
25080
25081
# File 'lib/schemas.rb', line 25079

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