Sha256: 11fc1a5c6a430222fae072c0cb64421cb2d2c7443c3fc0e17600fdc471c7b80f

Contents?: true

Size: 953 Bytes

Versions: 2

Compression:

Stored size: 953 Bytes

Contents

require 'fog'

module Stackster
  class AWS
    class SimpleDB

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

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

      def domain_exists?(domain)
        domains.include? domain
      end

      def create_domain(domain)
        @connect.create_domain(domain) unless domain_exists?(domain)
      end

      def put_attributes(domain, key, attributes, options)
        @connect.put_attributes domain, key, attributes, options
      end

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

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

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stackster-0.2.9 lib/stackster/aws/simpledb.rb
stackster-0.2.8 lib/stackster/aws/simpledb.rb