Class: TpCommon::FileStorage::Configuration
- Inherits:
-
Object
- Object
- TpCommon::FileStorage::Configuration
- Defined in:
- lib/tp_common/file_storage/configuration.rb
Instance Attribute Summary collapse
-
#aws_key_id ⇒ Object
Returns the value of attribute aws_key_id.
-
#aws_region ⇒ Object
Returns the value of attribute aws_region.
-
#aws_secret_key ⇒ Object
Returns the value of attribute aws_secret_key.
-
#default_bucket ⇒ Object
Returns the value of attribute default_bucket.
-
#key_prefix ⇒ Object
Returns the value of attribute key_prefix.
Instance Method Summary collapse
- #connection ⇒ Object
- #get_directory(directory_path) ⇒ Object
-
#initialize(aws_region, aws_key_id = nil, aws_secret_key = nil, key_prefix = nil, default_bucket = nil) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(aws_region, aws_key_id = nil, aws_secret_key = nil, key_prefix = nil, default_bucket = nil) ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/tp_common/file_storage/configuration.rb', line 7 def initialize(aws_region, aws_key_id = nil, aws_secret_key = nil, key_prefix = nil, default_bucket = nil) @aws_region = aws_region @aws_key_id = aws_key_id @aws_secret_key = aws_secret_key @key_prefix = key_prefix @default_bucket = default_bucket end |
Instance Attribute Details
#aws_key_id ⇒ Object
Returns the value of attribute aws_key_id.
20 21 22 |
# File 'lib/tp_common/file_storage/configuration.rb', line 20 def aws_key_id @aws_key_id end |
#aws_region ⇒ Object
Returns the value of attribute aws_region.
20 21 22 |
# File 'lib/tp_common/file_storage/configuration.rb', line 20 def aws_region @aws_region end |
#aws_secret_key ⇒ Object
Returns the value of attribute aws_secret_key.
20 21 22 |
# File 'lib/tp_common/file_storage/configuration.rb', line 20 def aws_secret_key @aws_secret_key end |
#default_bucket ⇒ Object
Returns the value of attribute default_bucket.
20 21 22 |
# File 'lib/tp_common/file_storage/configuration.rb', line 20 def default_bucket @default_bucket end |
#key_prefix ⇒ Object
Returns the value of attribute key_prefix.
20 21 22 |
# File 'lib/tp_common/file_storage/configuration.rb', line 20 def key_prefix @key_prefix end |
Instance Method Details
#connection ⇒ Object
26 27 28 29 30 |
# File 'lib/tp_common/file_storage/configuration.rb', line 26 def connection @connection ||= Fog::Storage.new(provider: 'AWS', aws_access_key_id: aws_key_id, aws_secret_access_key: aws_secret_key) end |
#get_directory(directory_path) ⇒ Object
32 33 34 |
# File 'lib/tp_common/file_storage/configuration.rb', line 32 def get_directory(directory_path) cached_directories[directory_path.to_sym] end |