Class: AuctionFunCore::Relations::Auctions

Inherits:
Object
  • Object
show all
Defined in:
lib/auction_fun_core/relations/auctions.rb

Overview

SQL relation for auctions.

Constant Summary collapse

KINDS =
Types::Coercible::String.default("standard").enum("standard", "penny", "closed")
STATUSES =
Types::Coercible::String.default("scheduled")
.enum("scheduled", "running", "paused", "canceled", "finished")

Instance Method Summary collapse

Instance Method Details

#all(page = 1, per_page = 10, options = {bidders_count: 3}) ⇒ Object



42
43
44
45
46
# File 'lib/auction_fun_core/relations/auctions.rb', line 42

def all(page = 1, per_page = 10, options = {bidders_count: 3})
  offset = ((page - 1) * per_page)

  read(all_auctions_with_bid_info(per_page, offset, options))
end

#info(auction_id, options = {bidders_count: 3}) ⇒ Object



48
49
50
51
52
# File 'lib/auction_fun_core/relations/auctions.rb', line 48

def info(auction_id, options = {bidders_count: 3})
  raise "Invalid argument" unless auction_id.is_a?(Integer)

  read(auction_with_bid_info(auction_id, options))
end