Class: PostMocksResponseMockConfigDelay

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



24575
24576
24577
24578
24579
24580
24581
24582
# File 'lib/schemas.rb', line 24575

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    duration:                                   d["duration"],
    preset:                                     d["preset"],
    post_mocks_response_mock_config_delay_type: d["type"],
  )
end

.from_json!(json) ⇒ Object



24584
24585
24586
# File 'lib/schemas.rb', line 24584

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

Instance Method Details

#to_dynamicObject



24588
24589
24590
24591
24592
24593
24594
# File 'lib/schemas.rb', line 24588

def to_dynamic
  {
    "duration" => duration,
    "preset"   => preset,
    "type"     => post_mocks_response_mock_config_delay_type,
  }
end

#to_json(options = nil) ⇒ Object



24596
24597
24598
# File 'lib/schemas.rb', line 24596

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