Class: Auctify::Api::V1::AuctionsController

Inherits:
BaseController show all
Defined in:
app/controllers/auctify/api/v1/auctions_controller.rb

Instance Method Summary collapse

Instance Method Details

#bidsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/auctify/api/v1/auctions_controller.rb', line 17

def bids
  if params[:terms_confirmation] == "1"
    if @auction.bid!(new_bid)
      @auction.reload

      store_confirmations_checkboxes

      render_record @auction, success: true, overbid_by_limit: overbid_by_limit?(new_bid)
    else
      store_confirmations_checkboxes

      render_record @auction, bid: new_bid, status: 400
    end
  else
    new_bid.errors.add(:base, :not_confirmed)
    render_record @auction, bid: new_bid, status: 400
  end
end

#showObject



9
10
11
12
13
14
15
# File 'app/controllers/auctify/api/v1/auctions_controller.rb', line 9

def show
  if params[:updated_at].present? && params[:updated_at].match?(/\A\d+\z/) && params[:updated_at].to_i == @auction.updated_at.to_i
    render json: { current: true }, status: 200
  else
    render_record @auction
  end
end