Sha256: ec5adf1ac17377a2933960bdb5b1dc5c91f3f23405032a9054057970e6414314

Contents?: true

Size: 733 Bytes

Versions: 5

Compression:

Stored size: 733 Bytes

Contents

require 'aws-sdk'

module Alephant
  module Harness
    module Service
      module SQS

        def self.client
          @@client ||= ::AWS::SQS.new
        end

        def self.create(queue)
          client.queues.create queue_name(queue)
        end

        def self.get(queue)
          client.queues.named(queue_name(queue))
        rescue ::AWS::SQS::Errors::NonExistentQueue
          false
        end

        def self.exists?(queue_name)
          if get(queue_name)
            yield
          end
        end

        def self.delete(queue_name)
          get(queue_name).delete
        end

        def self.queue_name(queue)
          /(?<name>[^\/]+)$/.match(queue)[:name]
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alephant-harness-0.2.2 lib/alephant/harness/service/sqs.rb
alephant-harness-0.2.1 lib/alephant/harness/service/sqs.rb
alephant-harness-0.2.0 lib/alephant/harness/service/sqs.rb
alephant-harness-0.1.3 lib/alephant/harness/service/sqs.rb
alephant-harness-0.1.2 lib/alephant/harness/service/sqs.rb