lib/heirloom/acl/s3.rb in heirloom-0.1.3 vs lib/heirloom/acl/s3.rb in heirloom-0.1.4
- old
+ new
@@ -1,17 +1,19 @@
module Heirloom
module ACL
class S3
+ attr_accessor :accounts, :config, :logger, :region
+
def initialize(args)
- @config = args[:config]
- @region = args[:region]
- @logger = args[:logger]
- @accounts = @config.authorized_aws_accounts
+ self.config = args[:config]
+ self.region = args[:region]
+ self.logger = config.logger
+ self.accounts = config.authorized_aws_accounts
end
- def allow_read_acccess_from_accounts(args)
+ def allow_read_access_from_accounts(args)
bucket = args[:bucket]
key_name = args[:key_name]
key_folder = args[:key_folder]
key = "#{key_folder}/#{key_name}.tar.gz"
@@ -21,13 +23,13 @@
name = current_acls['Owner']['Name']
id = current_acls['Owner']['ID']
grants = build_bucket_grants :id => id,
:name => name,
- :accounts => @accounts
+ :accounts => accounts
- @accounts.each do |a|
- @logger.info "Authorizing #{a} to s3://#{bucket}/#{key}"
+ accounts.each do |a|
+ logger.info "Authorizing #{a} to s3://#{bucket}/#{key}."
end
s3.put_object_acl bucket, key, grants
end
private