Sha256: 6bf90263544edd424ac65c351c878e7ee8ff18a4698b070fa946ea87573a1a33

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module Aws
  module ActionMailbox
    module SES
      module RSpec
        # @api private
        class Email
          def initialize(authentic: true, topic: 'topic:arn:default', mail: default_mail, message_params: {})
            @authentic = authentic
            @topic = topic
            @mail = mail
            @message_params = message_params
          end

          def headers
            { 'content-type' => 'application/json' }
          end

          def url
            '/rails/action_mailbox/ses/inbound_emails'
          end

          def params
            {
              'Type' => 'Notification',
              'TopicArn' => @topic,
              'Message' => message_json
            }
          end

          def message_json
            {
              'notificationType' => 'Received',
              'content' => @mail.encoded
            }.merge(@message_params).to_json
          end

          def authentic?
            @authentic
          end

          def default_mail
            Mail.new
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aws-actionmailbox-ses-0.1.0 lib/aws/action_mailbox/ses/rspec/email.rb