Sha256: 90269015971066ceb923119fc297e8cba7f5720842cdf1ed4b651aefd450d14f
Contents?: true
Size: 716 Bytes
Versions: 4
Compression:
Stored size: 716 Bytes
Contents
require 'concurrent' require 'headsail/api' require 'headsail/http' require 'headsail/redis' module Headsail class Task def initialize(config) @api = API.new(config) @redis = Redis.new(@api.name) @http = HTTP.new(@api) Headsail.info("API Task '#{@api.name}' added.") end def run Concurrent::TimerTask.new(execution_interval: @api.timer) do @redis.add(@http.body) if @http.run request_message end end private def request_message @http.code_status == :SUCCESS ? Headsail.info(msg) : Headsail.err(msg) end def msg "#{@api.name} / #{@api.method} REQUEST / #{@http.code} - #{@http.code_status.to_s}" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
headsail-0.1.15 | lib/headsail/task.rb |
headsail-0.1.14 | lib/headsail/task.rb |
headsail-0.1.13 | lib/headsail/task.rb |
headsail-0.1.12 | lib/headsail/task.rb |