Class: PostMonitorsBodyMonitor

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



25031
25032
25033
25034
25035
25036
25037
25038
25039
# File 'lib/schemas.rb', line 25031

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    collection:                      d["collection"],
    environment:                     d["environment"],
    post_monitors_body_monitor_name: d["name"],
    schedule:                        d["schedule"] ? PostMonitorsBodyMonitorSchedule.from_dynamic!(d["schedule"]) : nil,
  )
end

.from_json!(json) ⇒ Object



25041
25042
25043
# File 'lib/schemas.rb', line 25041

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

Instance Method Details

#to_dynamicObject



25045
25046
25047
25048
25049
25050
25051
25052
# File 'lib/schemas.rb', line 25045

def to_dynamic
  {
    "collection"  => collection,
    "environment" => environment,
    "name"        => post_monitors_body_monitor_name,
    "schedule"    => schedule&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



25054
25055
25056
# File 'lib/schemas.rb', line 25054

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