Class: PostMonitorsMonitorIDRunResponseRun

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



25412
25413
25414
25415
25416
25417
25418
25419
25420
# File 'lib/schemas.rb', line 25412

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    executions: d["executions"]&.map { |x| PostMonitorsMonitorIDRunResponseRunExecutionsItem.from_dynamic!(x) },
    failures:   d["failures"],
    info:       d["info"] ? PostMonitorsMonitorIDRunResponseRunInfo.from_dynamic!(d["info"]) : nil,
    stats:      d["stats"] ? PostMonitorsMonitorIDRunResponseRunStats.from_dynamic!(d["stats"]) : nil,
  )
end

.from_json!(json) ⇒ Object



25422
25423
25424
# File 'lib/schemas.rb', line 25422

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

Instance Method Details

#to_dynamicObject



25426
25427
25428
25429
25430
25431
25432
25433
# File 'lib/schemas.rb', line 25426

def to_dynamic
  {
    "executions" => executions&.map { |x| x.to_dynamic },
    "failures"   => failures,
    "info"       => info&.to_dynamic,
    "stats"      => stats&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



25435
25436
25437
# File 'lib/schemas.rb', line 25435

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