Class: TwoFactorRequest

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



652
653
654
655
656
657
658
659
# File 'lib/schemas.rb', line 652

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    provider: d.fetch("provider"),
    remember: d.fetch("remember"),
    token:    d.fetch("token"),
  )
end

.from_json!(json) ⇒ Object



661
662
663
# File 'lib/schemas.rb', line 661

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

Instance Method Details

#to_dynamicObject



665
666
667
668
669
670
671
# File 'lib/schemas.rb', line 665

def to_dynamic
  {
    "provider" => provider,
    "remember" => remember,
    "token"    => token,
  }
end

#to_json(options = nil) ⇒ Object



673
674
675
# File 'lib/schemas.rb', line 673

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