Merge pull request #1583 from internetee/add-auctions-endpoint-to-repp

Add auctions endpoint to REPP
This commit is contained in:
Timo Võhmar 2020-05-21 15:05:06 +03:00 committed by GitHub
commit c0bf470c2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 88 additions and 1 deletions

View file

@ -0,0 +1,23 @@
module Repp
module V1
class AuctionsController < ActionController::API
def index
auctions = Auction.started
render json: { count: auctions.count,
auctions: auctions_to_json(auctions) }
end
private
def auctions_to_json(auctions)
auctions.map do |e|
{
domain_name: e.domain,
punycode_domain_name: SimpleIDN.to_ascii(e.domain),
}
end
end
end
end
end