Class: AndSon::Client

Inherits:
Object
  • Object
show all
Includes:
CallRunnerMethods
Defined in:
lib/and-son/client.rb

Constant Summary collapse

DEFAULT_TIMEOUT =

seconds

60

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CallRunnerMethods

#logger, #params, #timeout

Constructor Details

#initialize(host, port) ⇒ Client

Returns a new instance of Client.



48
49
50
51
# File 'lib/and-son/client.rb', line 48

def initialize(host, port)
  @host, @port = host, port
  @responses = AndSon::StoredResponses.new
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



46
47
48
# File 'lib/and-son/client.rb', line 46

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



46
47
48
# File 'lib/and-son/client.rb', line 46

def port
  @port
end

#responsesObject (readonly)

Returns the value of attribute responses.



46
47
48
# File 'lib/and-son/client.rb', line 46

def responses
  @responses
end

Instance Method Details

#call(*args, &block) ⇒ Object

proxy the call method to the call runner



54
# File 'lib/and-son/client.rb', line 54

def call(*args, &block); self.call_runner.call(*args, &block); end

#call_runnerObject



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/and-son/client.rb', line 56

def call_runner
  # always start with this default CallRunner
  CallRunner.new({
    :host     => host,
    :port     => port,
    :timeout_value => (ENV['ANDSON_TIMEOUT'] || DEFAULT_TIMEOUT).to_f,
    :params_value  => {},
    :logger_value  => NullLogger.new,
    :responses     => @responses,
  })
end