module Puller
Public Class Methods
activate(name, endpoint, timeout)
click to toggle source
# File lib/harvester/puller.rb, line 26 def self.activate(name, endpoint, timeout) loop do puts send fetch_data(endpoint), name sleep timeout end end
fetch_data(endpoint)
click to toggle source
# File lib/harvester/puller.rb, line 10 def self.fetch_data(endpoint) conn = Faraday.new(url: endpoint) do |faraday| faraday.adapter :excon faraday.headers['X-Api-Key'] = Settings.newrelic_key end conn.get.body # rescue Exception => e # puts "Puller#fetch_data" # puts "#{e.inspect}: #{e.message}" end
send(data, topic)
click to toggle source
# File lib/harvester/puller.rb, line 21 def self.send(data, topic) # puts "Puller#send" @broadcaster.send data, topic: topic end