Sha256: ebb9ed65a25ad12d0423d56b98bc228ae64cadd77f74d6ff703aacec1d82501b

Contents?: true

Size: 802 Bytes

Versions: 185

Compression:

Stored size: 802 Bytes

Contents

class Jets::Controller::Middleware::Local
  class MimicAwsCall
    extend Memoist

    def initialize(route, env)
      @route, @env = route, env
    end

    def vars
      {
        'jets.controller' => controller,
        'lambda.context' => context,
        'lambda.event' => event,
        'lambda.meth' => meth,
      }
    end

    # Actual controller instance
    def controller
      controller_class = @route.controller_name.constantize
      meth = @route.action_name
      controller_class.new(event, context, meth)
    end

    def meth
      @route.action_name
    end

    def event
      @env['adapter.event'] || ApiGateway.new(@route, @env).event
    end
    memoize :event

    def context
      @env['adapter.context'] || {"fake" => "context in mimic_aws_call.rb"}
    end
  end
end

Version data entries

185 entries across 185 versions & 4 rubygems

Version Path
jets-4.0.12 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.11 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.10 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.9 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.8 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.7 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.6 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.5 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.4 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.3 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.2 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.1 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-4.0.0 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-3.2.2 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-3.2.1 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets.benforeva-3.0.17.pre.mount.pre.fix lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-3.2.0 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-3.1.5 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-3.1.4 lib/jets/controller/middleware/local/mimic_aws_call.rb
jets-3.1.3 lib/jets/controller/middleware/local/mimic_aws_call.rb