Sha256: 8896b092172d3c3e5264c2d8a9e60c2b48016213af0047558b632a5bff6f7abe
Contents?: true
Size: 920 Bytes
Versions: 9
Compression:
Stored size: 920 Bytes
Contents
# frozen_string_literal: true require_relative '../operation' require_relative 'resource' module LedgerSync module Domains class Operation class Find < Resource class Contract < LedgerSync::Ledgers::Contract params do required(:id).filled(:integer) required(:limit).value(:hash) end end private def operate if resource success else failure('Not found') end end def resource @resource ||= resource_class.where(params[:limit]).find_by(id: params[:id]) end def success super(resource) end def failure(message) super( LedgerSync::Error::OperationError.new( operation: self, message: message ) ) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems