class Result
def self.failure(error: {})
def self.failure(error: {}) Result.new(success: false, error: OpenStruct.new(error)) end
def self.success(data: {})
def self.success(data: {}) Result.new(success: true, data: OpenStruct.new(data)) end
def failure?
def failure? !@success end
def initialize(success:, data: nil, error: nil)
def initialize(success:, data: nil, error: nil) @success = success @data = data @error = error end
def success?
def success? @success end
def to_h
def to_h { success: @success, data: @data, error: @error, } end