Sha256: e5dcb2edf7dcff0b378b07208745028d1a43ee883279d6a9b3d1f54c6863fd43
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
require 'stackster/entry/entry_lister' module Stackster class Entry attr_accessor :name, :attributes def initialize(args) @environment = args[:environment] @domain = 'stacks' @sdb_connect = AWS::SimpleDB.new @environment self.name = "#{args[:name]}-#{Config.region @environment}" create_domain get_attributes end def self.find(args) e = Entry.new :name => args[:name], :environment => args[:environment] 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) self.attributes = attributes.merge(attribute) end def delete_attributes @sdb_connect.delete('stacks', name) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stackster-0.0.2 | lib/stackster/entry.rb |
stackster-0.0.1 | lib/stackster/entry.rb |