Sha256: fd990eafc9009fcc4890ef08af034ad1befbc0848e0cd1733574328290070596
Contents?: true
Size: 920 Bytes
Versions: 1
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(:query).value(:hash) end end private def operate if resource success else failure('Not found') end end def resource @resource ||= resource_class.where(params[:query]).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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ledger_sync-domains-1.0.2 | lib/ledger_sync/domains/operation/find.rb |