Class: GeneratorsCommand

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

Overview

Generate a password

Returns: [String]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



552
553
554
555
556
557
# File 'lib/schemas.rb', line 552

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    generate_password: PasswordGeneratorRequest.from_dynamic!(d.fetch("generatePassword")),
  )
end

.from_json!(json) ⇒ Object



559
560
561
# File 'lib/schemas.rb', line 559

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

Instance Method Details

#to_dynamicObject



563
564
565
566
567
# File 'lib/schemas.rb', line 563

def to_dynamic
  {
    "generatePassword" => generate_password.to_dynamic,
  }
end

#to_json(options = nil) ⇒ Object



569
570
571
# File 'lib/schemas.rb', line 569

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