Module: EPPClient::Poll
- Included in:
- Base
- Defined in:
- lib/epp-client/poll.rb
Constant Summary collapse
- PARSERS =
{}
Instance Method Summary collapse
-
#poll_ack(mid = @msgQ_id) ⇒ Object
sends a
<epp:poll op="ack" msgID="<mid>">
command to the server. -
#poll_ack_xml(mid) ⇒ Object
:nodoc:.
-
#poll_req ⇒ Object
sends a
<epp:poll op="req">
command to the server. -
#poll_req_process(xml) ⇒ Object
:nodoc:.
-
#poll_req_xml ⇒ Object
:nodoc:.
Instance Method Details
#poll_ack(mid = @msgQ_id) ⇒ Object
sends a <epp:poll op="ack" msgID="<mid>">
command to the server. Most of the time, you should not pass any argument, as it will “do the right thing”.
64 65 66 67 68 |
# File 'lib/epp-client/poll.rb', line 64 def poll_ack(mid = @msgQ_id) response = send_request(poll_ack_xml(mid)) get_result(response) end |
#poll_ack_xml(mid) ⇒ Object
:nodoc:
55 56 57 58 59 |
# File 'lib/epp-client/poll.rb', line 55 def poll_ack_xml(mid) #:nodoc: command do |xml| xml.poll(:op => :ack, :msgID => mid) end end |
#poll_req ⇒ Object
sends a <epp:poll op="req">
command to the server.
if there is a message in the queue, returns a hash with the following keys :
:qDate
-
the date and time that the message was enqueued.
:msg
,:msg_xml
-
a human readble message, the
:msg
version has all the possible xml stripped, whereas the:msg_xml
contains the original message. :obj
,:obj_xml
-
contains a possible
<epp:resData>
object, the original one in:obj_xml
, and if a parser is available, the parsed one in:obj
.
21 22 23 24 25 |
# File 'lib/epp-client/poll.rb', line 21 def poll_req response = send_request(poll_req_xml) get_result(:xml => response, :callback => :poll_req_process) end |
#poll_req_process(xml) ⇒ Object
:nodoc:
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/epp-client/poll.rb', line 29 def poll_req_process(xml) #:nodoc: ret = {} if (date = xml.xpath("epp:msgQ/epp:qDate", EPPClient::SCHEMAS_URL)).size > 0 ret[:qDate] = DateTime.parse(date.text) end if (msg = xml.xpath("epp:msgQ/epp:msg", EPPClient::SCHEMAS_URL)).size > 0 ret[:msg] = msg.text ret[:msg_xml] = msg.to_s end if (obj = xml.xpath('epp:resData', EPPClient::SCHEMAS_URL)).size > 0 || (obj = xml.xpath('epp:extension', EPPClient::SCHEMAS_URL)).size > 0 ret[:obj_xml] = obj.to_s PARSERS.each do |xpath,parser| if obj.xpath(xpath, EPPClient::SCHEMAS_URL).size > 0 ret[:obj] = case parser when Symbol send(parser, xml) else raise NotImplementedError end end end end ret end |
#poll_req_xml ⇒ Object
:nodoc:
3 4 5 6 7 |
# File 'lib/epp-client/poll.rb', line 3 def poll_req_xml #:nodoc: command do |xml| xml.poll(:op => :req) end end |