Sha256: 84c57557cc1ddb6360d4d44f7b798c6692c3f53ae341f77f0c8d95a954c20b89

Contents?: true

Size: 686 Bytes

Versions: 55

Compression:

Stored size: 686 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.find_or_create_by({
      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

55 entries across 55 versions & 1 rubygems

Version Path
wco_email-0.1.1.72 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.71 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.70 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.69 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.68 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.67 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.66 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.65 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.64 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.63 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.62 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.61 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.60 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.59 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.58 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.56 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.55 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.54 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.53 app/controllers/wco_email/api_controller.rb
wco_email-0.1.1.52 app/controllers/wco_email/api_controller.rb