mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Add contacts, keyrelays, poll
This commit is contained in:
parent
ea51bb50b2
commit
d468068b96
5 changed files with 469 additions and 7 deletions
48
app/controllers/epp/polls_controller.rb
Normal file
48
app/controllers/epp/polls_controller.rb
Normal file
|
@ -0,0 +1,48 @@
|
|||
class Epp::PollsController < ApplicationController
|
||||
include Epp::Common
|
||||
|
||||
def poll
|
||||
req_poll if parsed_frame.css('poll').first['op'] == 'req'
|
||||
ack_poll if parsed_frame.css('poll').first['op'] == 'ack'
|
||||
end
|
||||
|
||||
def req_poll
|
||||
@message = current_epp_user.queued_messages.last
|
||||
render_epp_response 'epp/poll/poll_no_messages' and return unless @message
|
||||
|
||||
if @message.attached_obj_type && @message.attached_obj_id
|
||||
@object = Object.const_get(@message.attached_obj_type).find(@message.attached_obj_id)
|
||||
end
|
||||
|
||||
if @message.attached_obj_type == 'Keyrelay'
|
||||
render_epp_response 'epp/poll/poll_keyrelay'
|
||||
else
|
||||
render_epp_response 'epp/poll/poll_req'
|
||||
end
|
||||
end
|
||||
|
||||
def ack_poll
|
||||
@message = current_epp_user.queued_messages.find_by(id: parsed_frame.css('poll').first['msgID'])
|
||||
|
||||
unless @message
|
||||
epp_errors << {
|
||||
code: '2303',
|
||||
msg: I18n.t('message_was_not_found'),
|
||||
value: { obj: 'msgID', val: parsed_frame.css('poll').first['msgID'] }
|
||||
}
|
||||
handle_errors and return
|
||||
end
|
||||
|
||||
handle_errors(@message) and return unless @message.dequeue
|
||||
render_epp_response 'epp/poll/poll_ack'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_poll
|
||||
op = parsed_frame.css('poll').first[:op]
|
||||
return true if %w(ack req).include?(op)
|
||||
epp_errors << { code: '2306', msg: I18n.t('errors.messages.attribute_op_is_invalid') }
|
||||
false
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue