Class: AwsS3Export::Config
- Inherits:
-
Object
- Object
- AwsS3Export::Config
- Defined in:
- lib/aws_s3_export/config.rb
Overview
Set config for export: s3_config = AwsS3Export::Config.new(:export_dir => ‘/your/dir/’, :bucket_name =>‘your_bucker_name’, :prefix => “dir”, :access_key => xxx, :secret_access_key => xxx )
:export_dir - directory of files or directories for export :prefix - prefix for saving to s3 :bucket_name - name of bucket s3 :access_key - access key id of s3 :secret_access_key - secret access key of s3 :rewrite_existing_files - if you want to rewrite set as true :acl - access controll like in docs.amazonwebservices.com/AWSRubySDK/latest/AWS/S3/S3Object.html#write-instance_method in aws-sdk default as public_read
Get config for example the export_dir: s3_config.export_dir #=> /your/dir/
Instance Attribute Summary collapse
-
#access_key ⇒ Object
readonly
Returns the value of attribute access_key.
-
#acl ⇒ Object
readonly
Returns the value of attribute acl.
-
#bucket_name ⇒ Object
readonly
Returns the value of attribute bucket_name.
-
#export_dir ⇒ Object
readonly
Returns the value of attribute export_dir.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#rewrite_existing_files ⇒ Object
readonly
Returns the value of attribute rewrite_existing_files.
-
#secret_access_key ⇒ Object
readonly
Returns the value of attribute secret_access_key.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/aws_s3_export/config.rb', line 22 def initialize( = {}) .each do |o| raise NoParams.new if [o].empty? end raise NotDir.new unless File.stat([:export_dir]).directory? @access_key = [:access_key] @secret_access_key = [:secret_access_key] @export_dir = [:export_dir] || "./" # the current directory @bucket_name = [:bucket_name] @prefix = [:prefix] || "" @rewrite_existing_files = [:rewrite_existing_files] || false @acl = [:acl] || :public_read end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Returns the value of attribute access_key.
20 21 22 |
# File 'lib/aws_s3_export/config.rb', line 20 def access_key @access_key end |
#acl ⇒ Object (readonly)
Returns the value of attribute acl.
20 21 22 |
# File 'lib/aws_s3_export/config.rb', line 20 def acl @acl end |
#bucket_name ⇒ Object (readonly)
Returns the value of attribute bucket_name.
20 21 22 |
# File 'lib/aws_s3_export/config.rb', line 20 def bucket_name @bucket_name end |
#export_dir ⇒ Object (readonly)
Returns the value of attribute export_dir.
20 21 22 |
# File 'lib/aws_s3_export/config.rb', line 20 def export_dir @export_dir end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
20 21 22 |
# File 'lib/aws_s3_export/config.rb', line 20 def prefix @prefix end |
#rewrite_existing_files ⇒ Object (readonly)
Returns the value of attribute rewrite_existing_files.
20 21 22 |
# File 'lib/aws_s3_export/config.rb', line 20 def rewrite_existing_files @rewrite_existing_files end |
#secret_access_key ⇒ Object (readonly)
Returns the value of attribute secret_access_key.
20 21 22 |
# File 'lib/aws_s3_export/config.rb', line 20 def secret_access_key @secret_access_key end |