pubcontrol 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubcontrol.rb +6 -6
- data/lib/pubcontrolclient.rb +29 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8535c6bdbb6bfd0abeb75b7dc08a4d561bb679b
|
4
|
+
data.tar.gz: 9f019cc934e4cebdd07d84b7f662503eb44d1661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f159d79255a34f0969f4ad71a9e00ec29518ec7e743298e35023b4037e91782e613fea8fc2bada8ff90475b0306841f207c39565523c8a43e58feff2bfadff00
|
7
|
+
data.tar.gz: 6eef70a1cb4d6049218dc5d69347b74c85e200a9d563ca33a6cf7b44605d2db9f446d5b755dfca59767c675a94cfb0d30c1e6a785f864877ef43cfc275284adf
|
data/lib/pubcontrol.rb
CHANGED
@@ -64,27 +64,27 @@ class PubControl
|
|
64
64
|
end
|
65
65
|
|
66
66
|
# The synchronous publish method for publishing the specified item to the
|
67
|
-
# specified
|
68
|
-
def publish(
|
67
|
+
# specified channels for all of the configured PubControlClient instances.
|
68
|
+
def publish(channels, item)
|
69
69
|
@clients.each do |pub|
|
70
|
-
pub.publish(
|
70
|
+
pub.publish(channels, item)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
# The asynchronous publish method for publishing the specified item to the
|
75
|
-
# specified
|
75
|
+
# specified channels on the configured endpoint. The callback method is
|
76
76
|
# optional and will be passed the publishing results after publishing is
|
77
77
|
# complete. Note that a failure to publish in any of the configured
|
78
78
|
# PubControlClient instances will result in a failure result being passed
|
79
79
|
# to the callback method along with the first encountered error message.
|
80
|
-
def publish_async(
|
80
|
+
def publish_async(channels, item, callback=nil)
|
81
81
|
cb = nil
|
82
82
|
if !callback.nil?
|
83
83
|
cb = PubControlClientCallbackHandler.new(@clients.length, callback).
|
84
84
|
handler_method_symbol
|
85
85
|
end
|
86
86
|
@clients.each do |pub|
|
87
|
-
pub.publish_async(
|
87
|
+
pub.publish_async(channels, item, cb)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
data/lib/pubcontrolclient.rb
CHANGED
@@ -55,34 +55,40 @@ class PubControlClient
|
|
55
55
|
end
|
56
56
|
|
57
57
|
# The synchronous publish method for publishing the specified item to the
|
58
|
-
# specified
|
59
|
-
def publish(
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
58
|
+
# specified channels on the configured endpoint.
|
59
|
+
def publish(channels, item)
|
60
|
+
exports = [channels].flatten.map do |channel|
|
61
|
+
export = item.export
|
62
|
+
export['channel'] = channel
|
63
|
+
export
|
64
|
+
end
|
65
|
+
uri = nil
|
66
|
+
auth = nil
|
64
67
|
@lock.synchronize do
|
65
|
-
uri
|
66
|
-
auth
|
68
|
+
uri = @uri
|
69
|
+
auth = gen_auth_header
|
67
70
|
end
|
68
|
-
pubcall(uri, auth,
|
71
|
+
pubcall(uri, auth, exports)
|
69
72
|
end
|
70
73
|
|
71
74
|
# The asynchronous publish method for publishing the specified item to the
|
72
|
-
# specified
|
75
|
+
# specified channels on the configured endpoint. The callback method is
|
73
76
|
# optional and will be passed the publishing results after publishing is
|
74
77
|
# complete.
|
75
|
-
def publish_async(
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
78
|
+
def publish_async(channels, item, callback=nil)
|
79
|
+
exports = [channels].flatten.map do |channel|
|
80
|
+
export = item.export
|
81
|
+
export['channel'] = channel
|
82
|
+
export
|
83
|
+
end
|
84
|
+
uri = nil
|
85
|
+
auth = nil
|
80
86
|
@lock.synchronize do
|
81
|
-
uri
|
82
|
-
auth
|
87
|
+
uri = @uri
|
88
|
+
auth = gen_auth_header
|
83
89
|
ensure_thread
|
84
90
|
end
|
85
|
-
queue_req(['pub', uri, auth,
|
91
|
+
queue_req(['pub', uri, auth, exports, callback])
|
86
92
|
end
|
87
93
|
|
88
94
|
# The finish method is a blocking method that ensures that all asynchronous
|
@@ -149,7 +155,11 @@ class PubControlClient
|
|
149
155
|
items = Array.new
|
150
156
|
callbacks = Array.new
|
151
157
|
reqs.each do |req|
|
152
|
-
|
158
|
+
if req[2].is_a? Array
|
159
|
+
items = items + req[2]
|
160
|
+
else
|
161
|
+
items.push(req[2])
|
162
|
+
end
|
153
163
|
callbacks.push(req[3])
|
154
164
|
end
|
155
165
|
begin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubcontrol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Konstantin Bokarius
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: algorithms
|