Class: Eye::Notify::AWSSDK

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

Instance Method Summary collapse

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
# File 'lib/eye/notify/awssdk.rb', line 12

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

#messageObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/eye/notify/awssdk.rb', line 22

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