Class: APIKeyLoginRequest

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

Overview

Login to Bitwarden with Api Key

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



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

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    client_id:     d.fetch("clientId"),
    client_secret: d.fetch("clientSecret"),
    password:      d.fetch("password"),
  )
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
428
# File 'lib/schemas.rb', line 422

def to_dynamic
  {
    "clientId"     => client_id,
    "clientSecret" => client_secret,
    "password"     => password,
  }
end

#to_json(options = nil) ⇒ Object



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

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