Class: PostMocksResponseMockConfig

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



24623
24624
24625
24626
24627
24628
24629
24630
24631
24632
24633
# File 'lib/schemas.rb', line 24623

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    delay:              d["delay"] ? PostMocksResponseMockConfigDelay.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



24635
24636
24637
# File 'lib/schemas.rb', line 24635

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

Instance Method Details

#to_dynamicObject



24639
24640
24641
24642
24643
24644
24645
24646
24647
24648
# File 'lib/schemas.rb', line 24639

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



24650
24651
24652
# File 'lib/schemas.rb', line 24650

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