class WithEvents::Aws::Publisher

Attributes

event[R]
resource[R]

Public Class Methods

new(event, resource) click to toggle source
# File lib/with_events/aws/publisher.rb, line 8
def initialize(event, resource)
  @event = event
  @resource = resource
end

Public Instance Methods

publish() click to toggle source
# File lib/with_events/aws/publisher.rb, line 13
def publish
  return unless event.identifier && identifier
  topic.publish(message)
end

Private Instance Methods

identifier() click to toggle source
# File lib/with_events/aws/publisher.rb, line 23
def identifier
  @identifier ||= Invoker.new(event.identifier).invoke(resource)
end
message() click to toggle source
# File lib/with_events/aws/publisher.rb, line 31
def message
  @message ||= Message.new(event: event.name,
                           stream: stream.name,
                           identifier: identifier)
end
topic() click to toggle source
# File lib/with_events/aws/publisher.rb, line 27
def topic
  @topic ||= Topic.new(stream.topic)
end