Sha256: 7c1d98debcc58482ff1d7ebe20f60153d12b8a9dc058d9c14da0e7db3a75a4b3

Contents?: true

Size: 449 Bytes

Versions: 6

Compression:

Stored size: 449 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_arn = TopicCreator.find_or_create(topic_id)
      sns.publish(topic_arn, message)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
propono-0.5.1 lib/propono/services/publisher.rb
propono-0.5.0 lib/propono/services/publisher.rb
propono-0.4.0 lib/propono/services/publisher.rb
propono-0.3.0 lib/propono/services/publisher.rb
propono-0.2.0 lib/propono/services/publisher.rb
propono-0.1.0 lib/propono/publisher.rb