Sha256: e3248381e14c7d21b24edfa610fa5a932a6e5720870e0014c123df0c0cafd3c3

Contents?: true

Size: 830 Bytes

Versions: 3

Compression:

Stored size: 830 Bytes

Contents

require 'fog'

module Heirloom
  module AWS
    class SimpleDB

      def initialize(args)
        @config = args[:config]
        @sdb = Fog::AWS::SimpleDB.new :aws_access_key_id => @config.access_key,
                                      :aws_secret_access_key => @config.secret_key,
                                      :region => @config.primary_region
      end

      def domains
        @sdb.list_domains.body['Domains']
      end

      def create_domain(domain)
        @sdb.create_domain(domain) unless domains.include? domain
      end

      def put_attributes(domain, key, args)
        @sdb.put_attributes domain, key, args
      end

      def select(query)
        @sdb.select(query).body['Items']
      end

      def delete(domain, key)
        @sdb.delete_attributes domain, key
      end

    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heirloom-0.1.0 lib/heirloom/aws/simpledb.rb
heirloom-0.0.9 lib/heirloom/aws/simpledb.rb
heirloom-0.0.8 lib/heirloom/aws/simpledb.rb