Class: Pebblebed::QuorumClient
Instance Method Summary
collapse
#delete, #get, #post, #put
Constructor Details
#initialize(services, session_key) ⇒ QuorumClient
7
8
9
10
11
12
|
# File 'lib/pebblebed/clients/quorum_client.rb', line 7
def initialize(services, session_key)
@clients = Hash[services.map do |service|
[service, Pebblebed::GenericClient.new(session_key, Pebblebed.root_url_for(service))]
end]
end
|
Instance Method Details
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/pebblebed/clients/quorum_client.rb', line 14
def perform(method, url = '', params = {}, &block)
results = @clients.map do |service, client|
response = [service]
response << Future::Value.new do
begin
client.perform(method, url, params, &block)
rescue HttpError => e
e
end
end
response
end
Hash[results.map{|service, response| [service, response.value]}]
end
|