Sha256: 52370d26a71d7a5521450ae9fb28118158466e715a9febb5e9f6939e6afd03a1

Contents?: true

Size: 730 Bytes

Versions: 10

Compression:

Stored size: 730 Bytes

Contents

module Heirloom
  class Catalog
    class Show

      def initialize(args)
        @config = args[:config]
        @name   = args[:name]
      end

      def regions
        lookup :name => @name, :attribute => 'regions'
      end

      def base
        lookup(:name => @name, :attribute => 'base').first
      end

      private

      def lookup(args)
        name      = args[:name]
        attribute = args[:attribute]
        domain    = "heirloom_#{name}"
        query     = "select #{attribute} from heirloom where itemName() = '#{domain}'"
        result    = sdb.select(query)
        result[domain][attribute]
      end

      def sdb
        @sdb ||= AWS::SimpleDB.new :config => @config
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
heirloom-0.7.4 lib/heirloom/catalog/show.rb
heirloom-0.7.3 lib/heirloom/catalog/show.rb
heirloom-0.7.3rc2 lib/heirloom/catalog/show.rb
heirloom-0.7.3rc1 lib/heirloom/catalog/show.rb
heirloom-0.7.2 lib/heirloom/catalog/show.rb
heirloom-0.7.2rc2 lib/heirloom/catalog/show.rb
heirloom-0.7.2rc1 lib/heirloom/catalog/show.rb
heirloom-0.7.1 lib/heirloom/catalog/show.rb
heirloom-0.7.0 lib/heirloom/catalog/show.rb
heirloom-0.7.0rc1 lib/heirloom/catalog/show.rb