Class: SecretVerificationRequest

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



585
586
587
588
589
590
591
# File 'lib/schemas.rb', line 585

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    master_password: d["masterPassword"],
    otp:             d["otp"],
  )
end

.from_json!(json) ⇒ Object



593
594
595
# File 'lib/schemas.rb', line 593

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

Instance Method Details

#to_dynamicObject



597
598
599
600
601
602
# File 'lib/schemas.rb', line 597

def to_dynamic
  {
    "masterPassword" => master_password,
    "otp"            => otp,
  }
end

#to_json(options = nil) ⇒ Object



604
605
606
# File 'lib/schemas.rb', line 604

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