Class: ResponseForFingerprintResponse

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



2360
2361
2362
2363
2364
2365
2366
2367
# File 'lib/schemas.rb', line 2360

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

.from_json!(json) ⇒ Object



2369
2370
2371
# File 'lib/schemas.rb', line 2369

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

Instance Method Details

#to_dynamicObject



2373
2374
2375
2376
2377
2378
2379
# File 'lib/schemas.rb', line 2373

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

#to_json(options = nil) ⇒ Object



2381
2382
2383
# File 'lib/schemas.rb', line 2381

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