Class: ResponseForCreateSecretResponse

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



1047
1048
1049
1050
1051
1052
1053
1054
# File 'lib/schemas.rb', line 1047

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    data:          d["data"] ? CreateSecretResponse.from_dynamic!(d["data"]) : nil,
    error_message: d["errorMessage"],
    success:       d.fetch("success"),
  )
end

.from_json!(json) ⇒ Object



1056
1057
1058
# File 'lib/schemas.rb', line 1056

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

Instance Method Details

#to_dynamicObject



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

def to_dynamic
  {
    "data"         => data&.to_dynamic,
    "errorMessage" => error_message,
    "success"      => success,
  }
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