Sha256: 340a4e94ca6119986c1b2c1efb5a6efe3330bf9520c98fea415696dcec51495c

Contents?: true

Size: 445 Bytes

Versions: 3

Compression:

Stored size: 445 Bytes

Contents

module Propono
  class PublisherError < Exception
  end

  class Publisher
    include Sns

    def self.publish(topic, message)
      new.publish(topic, message)
    end

    def publish(topic_id, message)
      raise PublisherError.new("Topic is nil") if topic_id.nil?
      raise PublisherError.new("Message is nil") if message.nil?

      topic = TopicCreator.find_or_create(topic_id)
      sns.publish(topic.arn, message)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
propono-0.5.4 lib/propono/services/publisher.rb
propono-0.5.3 lib/propono/services/publisher.rb
propono-0.5.2 lib/propono/services/publisher.rb