Class: SecretResponse

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



2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
# File 'lib/schemas.rb', line 2020

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    creation_date:   d.fetch("creationDate"),
    id:              d.fetch("id"),
    key:             d.fetch("key"),
    note:            d.fetch("note"),
    organization_id: d.fetch("organizationId"),
    project_id:      d["projectId"],
    revision_date:   d.fetch("revisionDate"),
    value:           d.fetch("value"),
  )
end

.from_json!(json) ⇒ Object



2034
2035
2036
# File 'lib/schemas.rb', line 2034

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

Instance Method Details

#to_dynamicObject



2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
# File 'lib/schemas.rb', line 2038

def to_dynamic
  {
    "creationDate"   => creation_date,
    "id"             => id,
    "key"            => key,
    "note"           => note,
    "organizationId" => organization_id,
    "projectId"      => project_id,
    "revisionDate"   => revision_date,
    "value"          => value,
  }
end

#to_json(options = nil) ⇒ Object



2051
2052
2053
# File 'lib/schemas.rb', line 2051

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