Class: APIResultForDecryptSymmetricResponse

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



1147
1148
1149
1150
1151
1152
1153
1154
# File 'lib/schemas.rb', line 1147

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

.from_json!(json) ⇒ Object



1156
1157
1158
# File 'lib/schemas.rb', line 1156

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

Instance Method Details

#to_dynamicObject



1160
1161
1162
1163
1164
1165
1166
# File 'lib/schemas.rb', line 1160

def to_dynamic
  {
    "data"    => data&.to_dynamic,
    "message" => message,
    "status"  => status,
  }
end

#to_json(options = nil) ⇒ Object



1168
1169
1170
# File 'lib/schemas.rb', line 1168

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