Sha256: 0d7cd7c72af97c9e52b2e4af86b977eb763734cd3b3f2cd5064298b25c98cdaf
Contents?: true
Size: 1.27 KB
Versions: 7
Compression:
Stored size: 1.27 KB
Contents
require 'stackster/entry/entry_lister' module Stackster class Entry attr_accessor :name, :attributes def initialize(args) @domain = 'stacks' @config = args[:config] self.name = "#{args[:name]}-#{@config.region}" get_attributes end def self.find(args) e = Entry.new :name => args[:name], :config => args[:config] e.get_attributes e end def create_domain sdb_connect.create_domain @domain end def get_attributes u = {} attrs = sdb_connect.select("select * from stacks where itemName() = '#{name}'") if attrs[name] attrs[name].each_pair do |k, v| u[k] = v.first end end self.attributes = u end def save attributes.each_pair do |k,v| sdb_connect.put_attributes('stacks', name, { k => v }, { :replace => k }) end end def set_attributes(a) a.each { |attribute| set_attribute(attribute) } end def set_attribute(attribute) create_domain self.attributes = attributes.merge(attribute) end def delete_attributes sdb_connect.delete('stacks', name) end private def sdb_connect @sdb_connect ||= AWS::SimpleDB.new :config => @config end end end
Version data entries
7 entries across 7 versions & 1 rubygems