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



941
942
943
944
945
946
947
948
949
950
# File 'lib/schemas.rb', line 941

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



952
953
954
# File 'lib/schemas.rb', line 952

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

Instance Method Details

#to_dynamicObject



956
957
958
959
960
961
962
963
964
# File 'lib/schemas.rb', line 956

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

#to_json(options = nil) ⇒ Object



966
967
968
# File 'lib/schemas.rb', line 966

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