module JamRuby
  module S3ManagerMixin
    extend ActiveSupport::Concern
    include AppConfig

    included do
    end

    module ClassMethods
      def s3_manager(options={:bucket => nil, :public => false})
        @s3_manager ||= S3Manager.new(options[:bucket] ? options[:bucket] : (options[:public] ? APP_CONFIG.aws_bucket_public : APP_CONFIG.aws_bucket), APP_CONFIG.aws_access_key_id, APP_CONFIG.aws_secret_access_key)
      end
    end

    def s3_manager(options={:bucket => nil, :public => false})
      @s3_manager ||= S3Manager.new(options[:bucket] ? options[:bucket] : (options[:public] ? app_config.aws_bucket_public : app_config.aws_bucket), app_config.aws_access_key_id, app_config.aws_secret_access_key)
    end
  end
end