Class: LoadBalancedRestClient::RestClientProxyCall

Inherits:
Object
  • Object
show all
Defined in:
lib/rest_client_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(load_balancer, uri = nil) ⇒ RestClientProxyCall

Returns a new instance of RestClientProxyCall.



3
4
5
6
# File 'lib/rest_client_proxy.rb', line 3

def initialize(load_balancer, uri = nil)
  @load_balancer = load_balancer
  @uri           = uri
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &blk) ⇒ Object



8
9
10
11
12
# File 'lib/rest_client_proxy.rb', line 8

def method_missing(method_name, *args, &blk)
  @load_balancer.with_server do |server|
    server.client[@uri].send(method_name, *args, &blk)
  end
end