Sha256: a676ad79496cc72cb7a3def48108c90934e14ce14bb884f038534b5d3014ec1b

Contents?: true

Size: 478 Bytes

Versions: 25

Compression:

Stored size: 478 Bytes

Contents

module Propono
  class TopicCreatorError < ProponoError
  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
      arn = body.fetch('TopicArn') { raise TopicCreatorError.new("No TopicArn returned from SNS") }
      Topic.new(arn)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
propono-0.8.0 lib/propono/services/topic_creator.rb
propono-0.7.0 lib/propono/services/topic_creator.rb
propono-0.6.3 lib/propono/services/topic_creator.rb
propono-0.6.1 lib/propono/services/topic_creator.rb
propono-0.6.0 lib/propono/services/topic_creator.rb