Sha256: 9e02a26871ff001f2ae886b8b40167b7d3cd1f9132afd733d0d22d10b48af68b

Contents?: true

Size: 448 Bytes

Versions: 1

Compression:

Stored size: 448 Bytes

Contents

module Propono
  class TopicCreatorError < Exception
  end

  class TopicCreator
    include Sns

    def self.find_or_create(topic_id)
      new(topic_id).find_or_create
    end

    def initialize(topic_id)
      @topic_id = topic_id
    end

    def find_or_create
      result = sns.create_topic(@topic_id)
      body = result.body
      body.fetch('TopicArn') { raise TopicCreatorError.new("No TopicArn returned from SNS") }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
propono-0.1.0 lib/propono/topic_creator.rb