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_core::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



369
370
371
372
373
374
375
376
377
# File 'lib/schemas.rb', line 369

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



379
380
381
# File 'lib/schemas.rb', line 379

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

Instance Method Details

#to_dynamicObject



383
384
385
386
387
388
389
390
# File 'lib/schemas.rb', line 383

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

#to_json(options = nil) ⇒ Object



392
393
394
# File 'lib/schemas.rb', line 392

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