Class: Jobshop::Postmaster::S3EventMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/jobshop/postmaster.rb

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ S3EventMessage

Returns a new instance of S3EventMessage.



70
71
72
73
74
# File 'lib/jobshop/postmaster.rb', line 70

def initialize(message)
  @message = JSON.parse(message)

  return false unless records
end

Instance Method Details

#bucketObject



80
81
82
# File 'lib/jobshop/postmaster.rb', line 80

def bucket
  records.first.dig "s3", "bucket", "name"
end

#keyObject



84
85
86
# File 'lib/jobshop/postmaster.rb', line 84

def key
  records.first.dig "s3", "object", "key"
end

#recordsObject



76
77
78
# File 'lib/jobshop/postmaster.rb', line 76

def records
  @records ||= @message["Records"] || []
end