Class: PostMonitorsMonitorIDRunResponseRunExecutionsItemResponse

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



25168
25169
25170
25171
25172
25173
25174
25175
25176
25177
# File 'lib/schemas.rb', line 25168

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    body:          d["body"],
    code:          d["code"],
    headers:       d["headers"],
    response_size: d["responseSize"],
    response_time: d["responseTime"],
  )
end

.from_json!(json) ⇒ Object



25179
25180
25181
# File 'lib/schemas.rb', line 25179

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

Instance Method Details

#to_dynamicObject



25183
25184
25185
25186
25187
25188
25189
25190
25191
# File 'lib/schemas.rb', line 25183

def to_dynamic
  {
    "body"         => body,
    "code"         => code,
    "headers"      => headers,
    "responseSize" => response_size,
    "responseTime" => response_time,
  }
end

#to_json(options = nil) ⇒ Object



25193
25194
25195
# File 'lib/schemas.rb', line 25193

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