Class: PostMonitorsMonitorIDRunResponseRunExecutionsItem

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



25212
25213
25214
25215
25216
25217
25218
25219
25220
# File 'lib/schemas.rb', line 25212

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    id:       d["id"],
    item:     d["item"] ? PostMonitorsMonitorIDRunResponseRunExecutionsItemItem.from_dynamic!(d["item"]) : nil,
    request:  d["request"] ? PostMonitorsMonitorIDRunResponseRunExecutionsItemRequest.from_dynamic!(d["request"]) : nil,
    response: d["response"] ? PostMonitorsMonitorIDRunResponseRunExecutionsItemResponse.from_dynamic!(d["response"]) : nil,
  )
end

.from_json!(json) ⇒ Object



25222
25223
25224
# File 'lib/schemas.rb', line 25222

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

Instance Method Details

#to_dynamicObject



25226
25227
25228
25229
25230
25231
25232
25233
# File 'lib/schemas.rb', line 25226

def to_dynamic
  {
    "id"       => id,
    "item"     => item&.to_dynamic,
    "request"  => request&.to_dynamic,
    "response" => response&.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



25235
25236
25237
# File 'lib/schemas.rb', line 25235

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