Class: AwsS3Export::Config

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.

Raises:



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/aws_s3_export/config.rb', line 19

def initialize(options = {})
  validation_options.each do |o|
    raise NoParams.new if options[o].empty?
  end

  raise NotDir.new unless File.stat(options[:export_dir]).directory?

  @access_key = options[:access_key]
  @secret_access_key = options[:secret_access_key]
  @export_dir = options[:export_dir] || "./" # the current directory
  @bucket_name = options[:bucket_name]
  @prefix = options[:prefix] || ""
end

Instance Attribute Details

#access_keyObject (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_nameObject (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_dirObject (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

#prefixObject (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_keyObject (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