Sha256: 5086cd1727aff7aca93016faa7b64110a798d9a1e3c4aa3120e48aa473b51500

Contents?: true

Size: 676 Bytes

Versions: 8

Compression:

Stored size: 676 Bytes

Contents

class WcoEmail::ApiController < ActionController::Base

  before_action      :check_credentials
  skip_before_action :verify_authenticity_token

  def create_email_message
    puts! params, 'params'

    stub = WcoEmail::MessageStub.create!({
      bucket:     params[:bucket],
      object_key: params[:object_key],
    })

    WcoEmail::MessageIntakeJob.perform_async( stub.id.to_s )
    render status: :ok, json: { status: :ok }
  end

  ##
  ## private
  ##
  private

  def check_credentials
    if params[:secret] != AWS_SES_LAMBDA_SECRET
      render status: 400, json: { status: 400, message: "#check_credentials says unauthorized." }
      return
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wco_email-0.1.1.16 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.15 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.14 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.13 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.12 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.11 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.10 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.9 app/controllers/wco_email/api_controller.rb