Class: ClientSettings

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

Overview

Basic client behavior settings. These settings specify the various targets and behavior of the Bitwarden Client. They are optional and uneditable once the client is initialized.

Defaults to

“‘ # use bitwarden::client::client_settings::DeviceType; let settings

ClientSettings { identity_url: “identity.bitwarden.com”.to_string(), api_url:

api.bitwarden.com”.to_string(), user_agent: “Bitwarden Rust-SDK”.to_string(), device_type: DeviceType::SDK, }; let default = ClientSettings::default(); “‘

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



374
375
376
377
378
379
380
381
382
# File 'lib/schemas.rb', line 374

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    api_url:      d["apiUrl"],
    device_type:  d["deviceType"],
    identity_url: d["identityUrl"],
    user_agent:   d["userAgent"],
  )
end

.from_json!(json) ⇒ Object



384
385
386
# File 'lib/schemas.rb', line 384

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

Instance Method Details

#to_dynamicObject



388
389
390
391
392
393
394
395
# File 'lib/schemas.rb', line 388

def to_dynamic
  {
    "apiUrl"      => api_url,
    "deviceType"  => device_type,
    "identityUrl" => identity_url,
    "userAgent"   => user_agent,
  }
end

#to_json(options = nil) ⇒ Object



397
398
399
# File 'lib/schemas.rb', line 397

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