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



1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
# File 'lib/schemas.rb', line 1873

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



1887
1888
1889
# File 'lib/schemas.rb', line 1887

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

Instance Method Details

#to_dynamicObject



1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
# File 'lib/schemas.rb', line 1891

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



1904
1905
1906
# File 'lib/schemas.rb', line 1904

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