class Eye::Notify::EyeS3

Constants

VERSION

Public Instance Methods

execute() click to toggle source
# File lib/eye/notify/eye_s3.rb, line 17
def execute
  Aws::S3::Object.new(options).put object
end

Private Instance Methods

body() click to toggle source
# File lib/eye/notify/eye_s3.rb, line 43
def body
  JSON.generate event
end
client() click to toggle source
# File lib/eye/notify/eye_s3.rb, line 39
def client
  Aws::S3::Client.new(region: region)
end
event() click to toggle source
# File lib/eye/notify/eye_s3.rb, line 47
def event
  {
    host:      msg_host,
    timestamp: msg_at.to_i,
    message:   msg_message,
    name:      msg_name,
    level:     msg_level
  }
end
key() click to toggle source
# File lib/eye/notify/eye_s3.rb, line 57
def key
  now = Time.now
  [now.year, now.month, now.day, "#{now.to_i}_#{msg_host}.json"].join '/'
end
object() click to toggle source
# File lib/eye/notify/eye_s3.rb, line 31
def object
  {
    acl:          'authenticated-read',
    content_type: 'application/json',
    body:         body
  }
end
options() click to toggle source
# File lib/eye/notify/eye_s3.rb, line 23
def options
  {
    bucket_name: bucket_name,
    key:         key,
    client:      client
  }
end