Class: Headsail::Client

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

Overview

The main event loop for retrieving data from APIS

Instance Method Summary collapse

Constructor Details

#initialize(configure) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
12
# File 'lib/headsail/client.rb', line 7

def initialize(configure)
  @configure = configure
  @threads = []
  @tasks = []
  setup_tasks
end

Instance Method Details

#runObject



14
15
16
17
18
19
# File 'lib/headsail/client.rb', line 14

def run
  @tasks.each { |task| @threads << task.run }
  @threads.map(&:execute)
  Headsail.info('Started up the Headsail Client.')
  loop { sleep 300 }
end