Class: GetSecretResponseSecret

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



1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
# File 'lib/schemas.rb', line 1361

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    environment:    d.fetch("environment"),
    is_fallback:    d["isFallback"],
    secret_comment: d.fetch("secretComment"),
    secret_key:     d.fetch("secretKey"),
    secret_path:    d["secretPath"],
    secret_value:   d.fetch("secretValue"),
    secret_type:    d.fetch("type"),
    version:        d.fetch("version"),
    workspace:      d.fetch("workspace"),
  )
end

.from_json!(json) ⇒ Object



1376
1377
1378
# File 'lib/schemas.rb', line 1376

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

Instance Method Details

#to_dynamicObject



1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
# File 'lib/schemas.rb', line 1380

def to_dynamic
  {
    "environment"   => environment,
    "isFallback"    => is_fallback,
    "secretComment" => secret_comment,
    "secretKey"     => secret_key,
    "secretPath"    => secret_path,
    "secretValue"   => secret_value,
    "type"          => secret_type,
    "version"       => version,
    "workspace"     => workspace,
  }
end

#to_json(options = nil) ⇒ Object



1394
1395
1396
# File 'lib/schemas.rb', line 1394

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