Sha256: 09a23d5d9e97fb3a3c6da19fbb9f2197f557044f21bfd3a5aacca643ca872bdc
Contents?: true
Size: 856 Bytes
Versions: 8
Compression:
Stored size: 856 Bytes
Contents
# frozen_string_literal: true require_relative '../operation' require_relative 'resource' module LedgerSync module Domains class Operation class Add < Resource private def operate if resource.save success else failure( 'Please review the problems below:', data: serialize(resource: resource) ) end end def resource @resource ||= resource_class.new(params) end def success super(resource) end def failure(message, data: nil) super( LedgerSync::Error::OperationError.new( operation: self, message: message, response: data ) ) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems