Class: GetMocksResponseMocksItemConfigDelay

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



12094
12095
12096
12097
12098
12099
12100
12101
# File 'lib/schemas.rb', line 12094

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

.from_json!(json) ⇒ Object



12103
12104
12105
# File 'lib/schemas.rb', line 12103

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

Instance Method Details

#to_dynamicObject



12107
12108
12109
12110
12111
12112
12113
# File 'lib/schemas.rb', line 12107

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

#to_json(options = nil) ⇒ Object



12115
12116
12117
# File 'lib/schemas.rb', line 12115

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