Class: GetMonitorsMonitorIDResponseMonitor

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



12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
# File 'lib/schemas.rb', line 12752

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    collection_uid:                                   d["collectionUid"],
    distribution:                                     d["distribution"],
    environment_uid:                                  d["environmentUid"],
    id:                                               d["id"],
    last_run:                                         d["lastRun"] ? GetMonitorsMonitorIDResponseMonitorLastRun.from_dynamic!(d["lastRun"]) : nil,
    get_monitors_monitor_id_response_monitor_name:    d["name"],
    notifications:                                    d["notifications"] ? GetMonitorsMonitorIDResponseMonitorNotifications.from_dynamic!(d["notifications"]) : nil,
    get_monitors_monitor_id_response_monitor_options: d["options"] ? GetMonitorsMonitorIDResponseMonitorOptions.from_dynamic!(d["options"]) : nil,
    owner:                                            d["owner"],
    schedule:                                         d["schedule"] ? GetMonitorsMonitorIDResponseMonitorSchedule.from_dynamic!(d["schedule"]) : nil,
    uid:                                              d["uid"],
  )
end

.from_json!(json) ⇒ Object



12769
12770
12771
# File 'lib/schemas.rb', line 12769

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

Instance Method Details

#to_dynamicObject



12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
# File 'lib/schemas.rb', line 12773

def to_dynamic
  {
    "collectionUid"  => collection_uid,
    "distribution"   => distribution,
    "environmentUid" => environment_uid,
    "id"             => id,
    "lastRun"        => last_run&.to_dynamic,
    "name"           => get_monitors_monitor_id_response_monitor_name,
    "notifications"  => notifications&.to_dynamic,
    "options"        => get_monitors_monitor_id_response_monitor_options&.to_dynamic,
    "owner"          => owner,
    "schedule"       => schedule&.to_dynamic,
    "uid"            => uid,
  }
end

#to_json(options = nil) ⇒ Object



12789
12790
12791
# File 'lib/schemas.rb', line 12789

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