module Support
  class DynamoDbClient
    def self.query_dynamodb(params)
      @dynamodb_client ||= new.client
      # Keep pagination in mind when using this at higher limits:
      # http://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/DynamoDB/Client.html#query-instance_method
      @dynamodb_client.query(params)
    end

    def self.delete_dynamodb_record(params)
      @dynamodb_client ||= new.client
      @dynamodb_client.delete_item(params)
    end

    attr_reader :client

    private

    def initialize
      @client ||= Aws::DynamoDB::Client.new(region: "us-east-1")
    end
  end
end
