class SeaFood::Service::ServiceResult
def failed?
-
(Boolean)
- True if failed, false otherwise.
def failed? !success end
def initialize(success: true, data: nil, errors: nil)
-
data
(Any
) -- The data returned by the service. -
success
(Boolean
) -- Indicates if the service call was successful.
def initialize(success: true, data: nil, errors: nil) @success = success @data = (data || {}).with_indifferent_access @errors = (errors.to_h || {}).with_indifferent_access end
def method_missing(key)
def method_missing(key) if succeeded? @data[key] else @errors[key] end end
def succeeded?
-
(Boolean)
- True if successful, false otherwise.
def succeeded? success end