Class: SecretCreateRequest

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



1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
# File 'lib/schemas.rb', line 1043

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    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



1054
1055
1056
# File 'lib/schemas.rb', line 1054

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

Instance Method Details

#to_dynamicObject



1058
1059
1060
1061
1062
1063
1064
1065
1066
# File 'lib/schemas.rb', line 1058

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

#to_json(options = nil) ⇒ Object



1068
1069
1070
# File 'lib/schemas.rb', line 1068

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