Class: ResponseForDecryptSymmetricResponse

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



1171
1172
1173
1174
1175
1176
1177
1178
# File 'lib/schemas.rb', line 1171

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

.from_json!(json) ⇒ Object



1180
1181
1182
# File 'lib/schemas.rb', line 1180

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

Instance Method Details

#to_dynamicObject



1184
1185
1186
1187
1188
1189
1190
# File 'lib/schemas.rb', line 1184

def to_dynamic
  {
    "data"         => data&.to_dynamic,
    "errorMessage" => error_message,
    "success"      => success,
  }
end

#to_json(options = nil) ⇒ Object



1192
1193
1194
# File 'lib/schemas.rb', line 1192

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