Class: ResponseForCreateSymmetricKeyResponse

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



1109
1110
1111
1112
1113
1114
1115
1116
# File 'lib/schemas.rb', line 1109

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

.from_json!(json) ⇒ Object



1118
1119
1120
# File 'lib/schemas.rb', line 1118

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

Instance Method Details

#to_dynamicObject



1122
1123
1124
1125
1126
1127
1128
# File 'lib/schemas.rb', line 1122

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

#to_json(options = nil) ⇒ Object



1130
1131
1132
# File 'lib/schemas.rb', line 1130

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