Sha256: 2227b0be6d045da7015113f854ed5b7d13570e901510ac7bba3540e72415273f

Contents?: true

Size: 638 Bytes

Versions: 4

Compression:

Stored size: 638 Bytes

Contents

module Lambdakiq
  class Client

    class_attribute :default_options,
                    instance_writer: false,
                    instance_predicate: false
    self.default_options = Hash.new

    attr_reader :queues

    def initialize
      @queues = Hash.new do |h, name|
        h[name] = Queue.new(name)
      end
    end

    def sqs
      @sqs ||= begin
        require 'aws-sdk-sqs'
        Aws::SQS::Client.new(options)
      end
    end

    private

    def options
      default_options.tap do |opts|
        opts[:region] ||= region if region
      end
    end

    def region
      ENV['AWS_REGION']
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lambdakiq-2.3.0 lib/lambdakiq/client.rb
lambdakiq-2.2.0 lib/lambdakiq/client.rb
lambdakiq-2.1.0 lib/lambdakiq/client.rb
lambdakiq-2.0.2 lib/lambdakiq/client.rb