Class: SecretPutRequest

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



1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
# File 'lib/schemas.rb', line 1227

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    id:              d.fetch("id"),
    key:             d.fetch("key"),
    note:            d.fetch("note"),
    organization_id: d.fetch("organizationId"),
    project_ids:     d["projectIds"],
    value:           d.fetch("value"),
  )
end

.from_json!(json) ⇒ Object



1239
1240
1241
# File 'lib/schemas.rb', line 1239

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

Instance Method Details

#to_dynamicObject



1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
# File 'lib/schemas.rb', line 1243

def to_dynamic
  {
    "id"             => id,
    "key"            => key,
    "note"           => note,
    "organizationId" => organization_id,
    "projectIds"     => project_ids,
    "value"          => value,
  }
end

#to_json(options = nil) ⇒ Object



1254
1255
1256
# File 'lib/schemas.rb', line 1254

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