Sha256: 9c83d947656f549beaf50a6988b69eb43e417f89fdffa5b3ce1385feb1e13f81

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'byebug'

module QPush
  module Web
    class Get
      class << self
        def stats
          stats = Apis::Stats.new
          stats.call.to_json
        end

        def heartbeat
          heart = Apis::Heart.new
          heart.call.to_json
        end

        def history
          history = Apis::History.new
          history.call.to_json
        end

        def jobs
          jobs = Apis::Jobs.new
          jobs.call.to_json
        end

        def retries(s, c)
          retries = Apis::Retries.new(s, c)
          retries.call.to_json
        end

        def morgue(s, c)
          morgue = Apis::Morgue.new(s, c)
          morgue.call.to_json
        end

        def delays(s, e)
          jobs = Get.all_delays[s, e]

          jobs.map! { |job| JSON.parse(job.first).merge(perform_at: job.last) }
        end

        def crons(s, c)
          crons = Apis::Crons.new(s, c)
          crons.call.to_json
        end



        def all_delays
          QPush.redis.with do |conn|
            conn.zrange(QPush.keys.delay, 0, -1, with_scores: true)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qpush-0.1.4 lib/qpush/web/get.rb