Class: ResponseForSecretsSyncResponse

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



2284
2285
2286
2287
2288
2289
2290
2291
# File 'lib/schemas.rb', line 2284

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    data:          d["data"] ? SecretsSyncResponse.from_dynamic!(d["data"]) : nil,
    error_message: d["errorMessage"],
    success:       d.fetch("success"),
  )
end

.from_json!(json) ⇒ Object



2293
2294
2295
# File 'lib/schemas.rb', line 2293

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

Instance Method Details

#to_dynamicObject



2297
2298
2299
2300
2301
2302
2303
# File 'lib/schemas.rb', line 2297

def to_dynamic
  {
    "data"         => data&.to_dynamic,
    "errorMessage" => error_message,
    "success"      => success,
  }
end

#to_json(options = nil) ⇒ Object



2305
2306
2307
# File 'lib/schemas.rb', line 2305

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