Class: CreateSecretOptions

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/schemas.rb', line 411

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    environment:                d.fetch("environment"),
    path:                       d["path"],
    project_id:                 d.fetch("projectId"),
    secret_comment:             d["secretComment"],
    secret_name:                d.fetch("secretName"),
    secret_value:               d.fetch("secretValue"),
    skip_multiline_encoding:    d["skipMultilineEncoding"],
    create_secret_options_type: d["type"],
  )
end

.from_json!(json) ⇒ Object



425
426
427
# File 'lib/schemas.rb', line 425

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

Instance Method Details

#to_dynamicObject



429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/schemas.rb', line 429

def to_dynamic
  {
    "environment"           => environment,
    "path"                  => path,
    "projectId"             => project_id,
    "secretComment"         => secret_comment,
    "secretName"            => secret_name,
    "secretValue"           => secret_value,
    "skipMultilineEncoding" => skip_multiline_encoding,
    "type"                  => create_secret_options_type,
  }
end

#to_json(options = nil) ⇒ Object



442
443
444
# File 'lib/schemas.rb', line 442

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