nominet-epp 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.md ADDED
@@ -0,0 +1,37 @@
1
+ 0.0.3 / 2011-01-17
2
+ ==================
3
+
4
+ * Tweak how #poll method works w.r.t blocks
5
+
6
+ 0.0.2 / 2011-01-07
7
+ ==================
8
+
9
+ * Add Documentation
10
+ * Support the 'abuse-limit' on Nominet check operation
11
+ * Fix issue with info operation XML response parsing
12
+
13
+ 0.0.1 / 2010-05-26
14
+ ==================
15
+
16
+ * Add support for 'none' and 'all' options on list operation
17
+ * Fix bugs in info operation for account objects
18
+ * Improve handling of XML namespaces and schema locations
19
+
20
+ 0.0.0 / 2010-05-25
21
+ ==================
22
+
23
+ * Initial release
24
+ * Supports the following operations
25
+ * Create
26
+ * Delete
27
+ * Fork
28
+ * Hello
29
+ * Info
30
+ * List
31
+ * Lock
32
+ * Merge
33
+ * Poll
34
+ * Transfer
35
+ * Unlock
36
+ * Unrenew
37
+ * Update
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -2,23 +2,41 @@ module NominetEPP
2
2
  module Operations
3
3
  # EPP Poll Operation
4
4
  module Poll
5
- # Poll the EPP server for events
5
+ class AckError < RuntimeError; end
6
+
7
+ # Poll the EPP server for events.
8
+ #
9
+ # If a block is given then it will be invoked once for
10
+ # each pending event. If no block is given the only the
11
+ # first received event will be returned along with the
12
+ # message ID of the event to allow the message to be
13
+ # ack'd. nil is returned if there is an error in the
14
+ # response or if there are not further messages to process.
15
+ #
16
+ # @example Without a block
17
+ # msgID, xml = client.poll
18
+ # ... process xml ...
19
+ # client.ack(msgID)
20
+ #
21
+ # @example With a block
22
+ # client.poll do |xml|
23
+ # ... process xml ...
24
+ # end
6
25
  #
7
26
  # @yield [data] process data if messages to poll
8
27
  # @yieldparam [XML::Node] data Response data
9
28
  # @return [nil] no messages to handle
10
- # @return [Boolean] ack successful
29
+ # @return [Array<String,XML::Node>] message ID and response xml data
30
+ # @raise [AckError] ack of event notification failed
11
31
  # @see ack
12
32
  def poll
13
- resp = @client.poll do |poll|
14
- poll['op'] = 'req'
15
- end
16
-
17
- return if resp.code != 1301 || resp.msgQ['count'] == '0'
18
-
19
- yield resp.data
33
+ while resp = poll_req
34
+ return if resp.code != 1301 || resp.msgQ['count'] == '0'
35
+ return [resp.msgQ['id'], resp.data] unless block_given?
20
36
 
21
- ack(resp.msgQ['id'])
37
+ yield resp.data
38
+ raise AckError, "failed to acknowledge message #{resp.msgQ['id']}" unless ack(resp.msgQ['id'])
39
+ end
22
40
  end
23
41
 
24
42
  # Acknowledges a polled message ID
@@ -33,6 +51,13 @@ module NominetEPP
33
51
 
34
52
  return resp.success?
35
53
  end
54
+
55
+ protected
56
+ def poll_req
57
+ @client.poll do |poll|
58
+ poll['op'] = 'req'
59
+ end
60
+ end
36
61
  end
37
62
  end
38
63
  end
data/nominet-epp.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{nominet-epp}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Geoff Garside"]
12
- s.date = %q{2011-01-07}
12
+ s.date = %q{2011-01-17}
13
13
  s.description = %q{Client for communicating with the Nominet EPP}
14
14
  s.email = %q{geoff@geoffgarside.co.uk}
15
15
  s.extra_rdoc_files = [
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
+ "History.md",
21
22
  "LICENSE",
22
23
  "README.rdoc",
23
24
  "Rakefile",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nominet-epp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Geoff Garside
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-07 00:00:00 +00:00
18
+ date: 2011-01-17 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -71,6 +71,7 @@ extra_rdoc_files:
71
71
  - README.rdoc
72
72
  files:
73
73
  - .document
74
+ - History.md
74
75
  - LICENSE
75
76
  - README.rdoc
76
77
  - Rakefile