Module: TpCommon::FileStorage

Defined in:
lib/tp_common/file_storage.rb,
lib/tp_common/file_storage/base.rb,
lib/tp_common/file_storage/key_protector.rb,
lib/tp_common/file_storage/fog_connection.rb,
lib/tp_common/file_storage/cleaners/cleaner.rb,
lib/tp_common/file_storage/uploaders/public.rb,
lib/tp_common/file_storage/uploaders/private.rb,
lib/tp_common/file_storage/downloaders/private.rb,
lib/tp_common/file_storage/errors/file_not_found.rb,
lib/tp_common/file_storage/direct_uploaders/public.rb,
lib/tp_common/file_storage/errors/failed_to_download.rb

Defined Under Namespace

Modules: Cleaners, DirectUploaders, Downloaders, Errors, FogConnection, KeyProtector, Uploaders Classes: Base, Configuration

Class Method Summary collapse

Class Method Details

.configurationObject

Raises:

  • (::StandardError)

30
31
32
33
34
# File 'lib/tp_common/file_storage.rb', line 30

def self.configuration
  raise ::StandardError.new('FileStorage is not config yet.') unless defined?(@configuration)

  @configuration
end

.configure {|@configuration| ... } ⇒ Object

Yields:


11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tp_common/file_storage.rb', line 11

def self.configure
  @configuration = Configuration.new('us-east-1', nil, nil, nil, nil)

  yield(@configuration)

  Aws.config.update({
    region: @configuration.aws_region,
    credentials: Aws::Credentials.new(
      @configuration.aws_key_id,
      @configuration.aws_secret_key)
  })
end

.key_prefixObject

Raises:

  • (::StandardError)

24
25
26
27
28
# File 'lib/tp_common/file_storage.rb', line 24

def self.key_prefix
  raise ::StandardError.new('FileStorage is not config yet.') unless defined?(@configuration)

  @configuration.key_prefix
end