Class: Eye::Notify::AWSSDK

Inherits:
Eye::Notify show all
Defined in:
lib/eye/notify/awssdk.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



24
25
26
27
28
29
30
# File 'lib/eye/notify/awssdk.rb', line 24

def execute
  options = { region: "us-east-1" } # default to us-east-1
  options[:region] = region if region
  options[:credentials] = Aws::Credentials.new(access_key_id, secret_access_key) if access_key_id && secret_access_key
  client = Aws::SES::Client.new(options)
  client.send_email(message)
end

#messageObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/eye/notify/awssdk.rb', line 32

def message
  {
    source: from,
    destination: {
      to_addresses: [contact],
    },
    message: {
      subject: {
        data: message_subject,
      },
      body: {
        text: {
          data: message_body,
        },
        html: {
          data: message_body,
        },
      },
    },
  }
end