Sha256: bfdfaae732d08bf84d4e16385032e67cd1af474a173648d2bdcebda1146efc52

Contents?: true

Size: 835 Bytes

Versions: 30

Compression:

Stored size: 835 Bytes

Contents

require 'json'

# Job public methods get turned into Lambda functions.
#
# Jets::Job::Base < Jets::Lambda::Functions
# Both Jets::Job::Base and Jets::Lambda::Functions have Dsl modules included.
# So the Jets::Job::Dsl overrides some of the Jets::Lambda::Functions behavior.
class Jets::Job
  class Base < Jets::Lambda::Functions
    include Dsl

    class << self
      def process(event, context, meth)
        job = new(event, context, meth)
        job.send(meth)
      end

      def perform_now(meth, event, context=nil)
        new(event, context, meth).send(meth)
      end

      def perform_later(meth, event, context=nil)
        function_name = "#{self.to_s.underscore}-#{meth}"
        call = Jets::Commands::Call.new(function_name, JSON.dump(event), invocation_type: "Event")
        call.run
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
jets-0.8.9 lib/jets/job/base.rb
jets-0.8.8 lib/jets/job/base.rb
jets-0.8.6 lib/jets/job/base.rb
jets-0.8.5 lib/jets/job/base.rb
jets-0.8.4 lib/jets/job/base.rb
jets-0.8.3 lib/jets/job/base.rb
jets-0.8.2 lib/jets/job/base.rb
jets-0.8.1 lib/jets/job/base.rb
jets-0.8.0 lib/jets/job/base.rb
jets-0.7.1 lib/jets/job/base.rb
jets-0.7.0 lib/jets/job/base.rb
jets-0.6.9 lib/jets/job/base.rb
jets-0.6.8 lib/jets/job/base.rb
jets-0.6.7 lib/jets/job/base.rb
jets-0.6.6 lib/jets/job/base.rb
jets-0.6.5 lib/jets/job/base.rb
jets-0.6.4 lib/jets/job/base.rb
jets-0.6.3 lib/jets/job/base.rb
jets-0.6.2 lib/jets/job/base.rb
jets-0.6.1 lib/jets/job/base.rb