Sha256: d6533cd2500d3acac8dcee40d76865f3bc6e1ecb80ba0610aafda857f51e2dd9

Contents?: true

Size: 988 Bytes

Versions: 2

Compression:

Stored size: 988 Bytes

Contents

module QPush
  module Server
    module Apis
      # A Base class for all API classes.
      #
      class Base
        def self.call(*args)
          api = new(*args)
          api.call
        end

        def initialize(job)
          @job = job
        end
      end
    end

    # The ApiWrapper provides simple wrapper functions for all the API
    # classes available for jobs. This provides a single entry point to
    # the API's for job objects.
    #
    class ApiWrapper
      def initialize(job)
        @job = job
      end

      def queue
        Apis::Queue.call(@job)
      end

      def perform
        Apis::Perform.call(@job)
      end

      def execute
        Apis::Execute.call(@job)
      end

      def delay
        Apis::Delay.call(@job, :delay)
      end

      def retry
        Apis::Delay.call(@job, :retry)
      end

      def morgue
        Apis::Morgue.call(@job)
      end

      def setup
        Apis::Setup.call(@job)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qpush-0.1.7 lib/qpush/server/apis.rb
qpush-0.1.6 lib/qpush/server/apis.rb