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



754
755
756
757
758
759
760
761
# File 'lib/schemas.rb', line 754

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



763
764
765
# File 'lib/schemas.rb', line 763

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

Instance Method Details

#to_dynamicObject



767
768
769
770
771
772
773
# File 'lib/schemas.rb', line 767

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

#to_json(options = nil) ⇒ Object



775
776
777
# File 'lib/schemas.rb', line 775

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