Class: PasswordGeneratorRequest
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- PasswordGeneratorRequest
- Defined in:
- lib/schemas.rb
Overview
Password generator request options.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/schemas.rb', line 506 def self.from_dynamic!(d) d = Types::Hash[d] new( avoid_ambiguous: d.fetch("avoidAmbiguous"), length: d.fetch("length"), lowercase: d.fetch("lowercase"), min_lowercase: d["minLowercase"], min_number: d["minNumber"], min_special: d["minSpecial"], min_uppercase: d["minUppercase"], numbers: d.fetch("numbers"), special: d.fetch("special"), uppercase: d.fetch("uppercase"), ) end |
.from_json!(json) ⇒ Object
522 523 524 |
# File 'lib/schemas.rb', line 522 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
# File 'lib/schemas.rb', line 526 def to_dynamic { "avoidAmbiguous" => avoid_ambiguous, "length" => length, "lowercase" => lowercase, "minLowercase" => min_lowercase, "minNumber" => min_number, "minSpecial" => min_special, "minUppercase" => min_uppercase, "numbers" => numbers, "special" => special, "uppercase" => uppercase, } end |
#to_json(options = nil) ⇒ Object
541 542 543 |
# File 'lib/schemas.rb', line 541 def to_json( = nil) JSON.generate(to_dynamic, ) end |