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



2609
2610
2611
2612
2613
2614
2615
2616
# File 'lib/schemas.rb', line 2609

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



2618
2619
2620
# File 'lib/schemas.rb', line 2618

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

Instance Method Details

#to_dynamicObject



2622
2623
2624
2625
2626
2627
2628
# File 'lib/schemas.rb', line 2622

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

#to_json(options = nil) ⇒ Object



2630
2631
2632
# File 'lib/schemas.rb', line 2630

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