Class: Bosh::Agent::BaseClient

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

Direct Known Subclasses

HTTPClient

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object

Raises:



18
19
20
21
22
23
# File 'lib/agent_client/base.rb', line 18

def method_missing(method_name, *args)
  result = handle_method(method_name, args)

  raise HandlerError, result['exception'] if result.has_key?('exception')
  result['value']
end

Instance Method Details

#run_task(method, *args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/agent_client/base.rb', line 7

def run_task(method, *args)
  task = send(method.to_sym, *args)

  while task['state'] == 'running'
    sleep(1.0)
    task = get_task(task['agent_task_id'])
  end

  task
end