Module: NominetEPP::Operations::Poll
- Included in:
- Client
- Defined in:
- lib/nominet-epp/operations/poll.rb
Overview
EPP Poll Operation
Defined Under Namespace
Classes: AckError
Instance Method Summary collapse
-
#ack(msgID) ⇒ Boolean
Acknowledges a polled message ID.
-
#poll {|data| ... } ⇒ nil, Array<String,XML::Node>
Poll the EPP server for events.
Instance Method Details
#ack(msgID) ⇒ Boolean
Acknowledges a polled message ID
47 48 49 50 51 52 53 54 |
# File 'lib/nominet-epp/operations/poll.rb', line 47 def ack(msgID) resp = @client.poll do |poll| poll['op'] = 'ack' poll['msgID'] = msgID end return resp.success? end |
#poll {|data| ... } ⇒ nil, Array<String,XML::Node>
Poll the EPP server for events.
If a block is given then it will be invoked once for each pending event. If no block is given the only the first received event will be returned along with the message ID of the event to allow the message to be ack’d. nil is returned if there is an error in the response or if there are not further messages to process.
33 34 35 36 37 38 39 40 41 |
# File 'lib/nominet-epp/operations/poll.rb', line 33 def poll while resp = poll_req return if resp.code != 1301 || resp.msgQ['count'] == '0' return [resp.msgQ['id'], resp.data] unless block_given? yield resp.data raise AckError, "failed to acknowledge message #{resp.msgQ['id']}" unless ack(resp.msgQ['id']) end end |