mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 23:24:48 +02:00
Add auctions endpoint to REPP
This commit is contained in:
parent
82109c506c
commit
fda3d346b3
5 changed files with 88 additions and 1 deletions
23
app/controllers/repp/v1/auctions_controller.rb
Normal file
23
app/controllers/repp/v1/auctions_controller.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue