Class: GetMocksResponseMocksItemConfig

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



12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
# File 'lib/schemas.rb', line 12142

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    delay:              d["delay"] ? GetMocksResponseMocksItemConfigDelay.from_dynamic!(d["delay"]) : nil,
    headers:            d["headers"],
    match_body:         d["matchBody"],
    match_query_params: d["matchQueryParams"],
    match_wildcards:    d["matchWildcards"],
    server_response_id: d["serverResponseId"],
  )
end

.from_json!(json) ⇒ Object



12154
12155
12156
# File 'lib/schemas.rb', line 12154

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

Instance Method Details

#to_dynamicObject



12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
# File 'lib/schemas.rb', line 12158

def to_dynamic
  {
    "delay"            => delay&.to_dynamic,
    "headers"          => headers,
    "matchBody"        => match_body,
    "matchQueryParams" => match_query_params,
    "matchWildcards"   => match_wildcards,
    "serverResponseId" => server_response_id,
  }
end

#to_json(options = nil) ⇒ Object



12169
12170
12171
# File 'lib/schemas.rb', line 12169

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