Sha256: e0bdf4cb7b93c894580823e0ecc327b628af835f034dc32c9539ea712c6791f1

Contents?: true

Size: 1009 Bytes

Versions: 3

Compression:

Stored size: 1009 Bytes

Contents

# frozen_string_literal: true

module SampleDataDump
  module Commands
    class DownloadCompressedSampleDataDumps
      def initialize(local_file_system_gateway, compressed_dump_storage_gateway)
        @local_file_system_gateway = local_file_system_gateway
        @compressed_dump_storage_gateway = compressed_dump_storage_gateway
      end

      def result
        @local_file_system_gateway.clean_dump_directory.bind do
          @local_file_system_gateway.load_table_configurations.fmap do |table_configs|
            result = process_table_configs_list(table_configs)
            return result if result.failure?
          end
        end
      end

      private

      def process_table_configs_list(table_configs)
        results = table_configs.map do |table_config|
          result = @compressed_dump_storage_gateway.retrieve_compressed_dump_file(table_config)
          return result if result.failure?
        end
        results.last || Dry::Monads::Success(true)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sample_data_dump-0.0.4 lib/sample_data_dump/commands/download_compressed_sample_data_dumps.rb
sample_data_dump-0.0.3 lib/sample_data_dump/commands/download_compressed_sample_data_dumps.rb
sample_data_dump-0.0.2 lib/sample_data_dump/commands/download_compressed_sample_data_dumps.rb