Class: PostMonitorsMonitorIDRunResponseRunStats

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



25374
25375
25376
25377
25378
25379
25380
# File 'lib/schemas.rb', line 25374

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    assertions: d["assertions"] ? PostMonitorsMonitorIDRunResponseRunStatsAssertions.from_dynamic!(d["assertions"]) : nil,
    requests:   d["requests"] ? PostMonitorsMonitorIDRunResponseRunStatsRequests.from_dynamic!(d["requests"]) : nil,
  )
end

.from_json!(json) ⇒ Object



25382
25383
25384
# File 'lib/schemas.rb', line 25382

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

Instance Method Details

#to_dynamicObject



25386
25387
25388
25389
25390
25391
# File 'lib/schemas.rb', line 25386

def to_dynamic
  {
    "assertions" => assertions&.to_dynamic,
    "requests"   => requests&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



25393
25394
25395
# File 'lib/schemas.rb', line 25393

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