Class: GetMonitorsMonitorIDResponseMonitorLastRun

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



12569
12570
12571
12572
12573
12574
12575
12576
12577
# File 'lib/schemas.rb', line 12569

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    finished_at: d["finishedAt"],
    started_at:  d["startedAt"],
    stats:       d["stats"] ? GetMonitorsMonitorIDResponseMonitorLastRunStats.from_dynamic!(d["stats"]) : nil,
    status:      d["status"],
  )
end

.from_json!(json) ⇒ Object



12579
12580
12581
# File 'lib/schemas.rb', line 12579

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

Instance Method Details

#to_dynamicObject



12583
12584
12585
12586
12587
12588
12589
12590
# File 'lib/schemas.rb', line 12583

def to_dynamic
  {
    "finishedAt" => finished_at,
    "startedAt"  => started_at,
    "stats"      => stats&.to_dynamic,
    "status"     => status,
  }
end

#to_json(options = nil) ⇒ Object



12592
12593
12594
# File 'lib/schemas.rb', line 12592

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