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
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.
-
#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.
-
#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.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/aws_s3_export/config.rb', line 19 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] || "" end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Returns the value of attribute access_key.
17 18 19 |
# File 'lib/aws_s3_export/config.rb', line 17 def access_key @access_key end |
#bucket_name ⇒ Object (readonly)
Returns the value of attribute bucket_name.
17 18 19 |
# File 'lib/aws_s3_export/config.rb', line 17 def bucket_name @bucket_name end |
#export_dir ⇒ Object (readonly)
Returns the value of attribute export_dir.
17 18 19 |
# File 'lib/aws_s3_export/config.rb', line 17 def export_dir @export_dir end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
17 18 19 |
# File 'lib/aws_s3_export/config.rb', line 17 def prefix @prefix end |
#secret_access_key ⇒ Object (readonly)
Returns the value of attribute secret_access_key.
17 18 19 |
# File 'lib/aws_s3_export/config.rb', line 17 def secret_access_key @secret_access_key end |