Class: EurekaRuby::Executor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExecutor

Returns a new instance of Executor.



9
10
11
12
13
14
# File 'lib/eureka_ruby/executor.rb', line 9

def initialize
  api_base = EurekaRuby.configuration.eureka_url
  timeout = 30
  skip_verify_ssl = EurekaRuby.configuration.scheme == 'http'
  @client = HttpClient.new(api_base, timeout, skip_verify_ssl)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/eureka_ruby/executor.rb', line 7

def client
  @client
end

Instance Method Details

#run(action_type) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eureka_ruby/executor.rb', line 16

def run(action_type)
  raise 'Unknow message type' unless [:send_heartbeat, :register, :deregister].include?(action_type)
  case action_type
  when :send_heartbeat
    send_heartbeat
  when :register
    register_application_instance
  when :deregister
    deregister_application_instance
  end
end