Class: AccessTokenLoginRequest

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schemas.rb

Overview

Login to Bitwarden with access token

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



617
618
619
620
621
622
623
# File 'lib/schemas.rb', line 617

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    access_token: d.fetch("accessToken"),
    state_file:   d["stateFile"],
  )
end

.from_json!(json) ⇒ Object



625
626
627
# File 'lib/schemas.rb', line 625

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

Instance Method Details

#to_dynamicObject



629
630
631
632
633
634
# File 'lib/schemas.rb', line 629

def to_dynamic
  {
    "accessToken" => access_token,
    "stateFile"   => state_file,
  }
end

#to_json(options = nil) ⇒ Object



636
637
638
# File 'lib/schemas.rb', line 636

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