Class: GetMocksResponse

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



12254
12255
12256
12257
12258
12259
# File 'lib/schemas.rb', line 12254

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    mocks: d["mocks"]&.map { |x| GetMocksResponseMocksItem.from_dynamic!(x) },
  )
end

.from_json!(json) ⇒ Object



12261
12262
12263
# File 'lib/schemas.rb', line 12261

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

Instance Method Details

#to_dynamicObject



12265
12266
12267
12268
12269
# File 'lib/schemas.rb', line 12265

def to_dynamic
  {
    "mocks" => mocks&.map { |x| x.to_dynamic },
  }
end

#to_json(options = nil) ⇒ Object



12271
12272
12273
# File 'lib/schemas.rb', line 12271

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