Class: AuctionFunCore::Contracts::BidContext::CreateBidPennyContract

Inherits:
ApplicationContract
  • Object
show all
Defined in:
lib/auction_fun_core/contracts/bid_context/create_bid_penny_contract.rb

Overview

This class validates the creation of new bids for penny-type auctions. It guarantees that the bid can only be made within the correct status of this type of auction, in addition, the participant must have sufficient balance in their wallet to place a new bid.

Examples:

Creating a bid for a penny auction

contract = AuctionFunCore::Contracts::BidContext::CreateBidPennyContract.new
attributes = { auction_id: 123, user_id: 2 }
result = contract.call(attributes)
if result.success?
  puts "Bid created successfully."
else
  puts "Failed to create bid: #{result.errors.to_h}"
end

Constant Summary

Constants inherited from ApplicationContract

ApplicationContract::EMAIL_REGEX, ApplicationContract::I18N_MACRO_SCOPE

Constants included from Business::Configuration

Business::Configuration::AUCTION_KINDS, Business::Configuration::AUCTION_MAX_TITLE_LENGTH, Business::Configuration::AUCTION_MIN_TITLE_LENGTH, Business::Configuration::AUCTION_STATUSES, Business::Configuration::AUCTION_STOPWATCH_MAX_VALUE, Business::Configuration::AUCTION_STOPWATCH_MIN_VALUE, Business::Configuration::MAX_NAME_LENGTH, Business::Configuration::MAX_PASSWORD_LENGTH, Business::Configuration::MIN_NAME_LENGTH, Business::Configuration::MIN_PASSWORD_LENGTH