Class: Turbotlib::Processor

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/turbotlib/processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_dir, cache_dir, expires_in, level, logdev) ⇒ Processor

Returns a new instance of Processor.



9
10
11
12
13
14
15
# File 'lib/turbotlib/processor.rb', line 9

def initialize(output_dir, cache_dir, expires_in, level, logdev)
  @logger = Logger.new('turbot', level, logdev)
  @client = Client.new(cache_dir, expires_in, level, logdev)

  @output_dir = output_dir
  FileUtils.mkdir_p(@output_dir)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/turbotlib/processor.rb', line 5

def client
  @client
end

Instance Method Details

#assert(message) ⇒ Object



21
22
23
# File 'lib/turbotlib/processor.rb', line 21

def assert(message)
  error(message) unless yield
end

#get(url) ⇒ Object



17
18
19
# File 'lib/turbotlib/processor.rb', line 17

def get(url)
  client.get(url).body
end

#nowString

Returns the present UTC time in ISO 8601 format.

Returns:

  • (String)

    the present UTC time in ISO 8601 format



26
27
28
# File 'lib/turbotlib/processor.rb', line 26

def now
  Time.now.utc.strftime('%Y-%m-%dT%H:%M:%SZ')
end