Class: CreateSecretResponseSecret

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



973
974
975
976
977
978
979
980
981
982
983
984
985
986
# File 'lib/schemas.rb', line 973

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



988
989
990
# File 'lib/schemas.rb', line 988

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

Instance Method Details

#to_dynamicObject



992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
# File 'lib/schemas.rb', line 992

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



1006
1007
1008
# File 'lib/schemas.rb', line 1006

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