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



410
411
412
413
414
415
416
# File 'lib/schemas.rb', line 410

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

.from_json!(json) ⇒ Object



418
419
420
# File 'lib/schemas.rb', line 418

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

Instance Method Details

#to_dynamicObject



422
423
424
425
426
427
# File 'lib/schemas.rb', line 422

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

#to_json(options = nil) ⇒ Object



429
430
431
# File 'lib/schemas.rb', line 429

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