Sha256: c6b52384d6b1174dfd2083c8e50d4b14d037119aca4201222be8f98226b85a84

Contents?: true

Size: 742 Bytes

Versions: 17

Compression:

Stored size: 742 Bytes

Contents

require_dependency "renalware/feeds"
require "attr_extras"

module Renalware
  module Feeds
    module Files
      module Practices
        class ImportCSV
          pattr_initialize :csv_path

          def call
            Rails.logger.info("Importing CSV file #{csv_path}...")
            import_practices_csv_using_sql_function
            Rails.logger.info("... done")
          end

          private

          # See migration for SQL function definition
          def import_practices_csv_using_sql_function
            conn = ActiveRecord::Base.connection
            conn.execute(
              "SELECT import_practices_csv(#{conn.quote(csv_path.realpath.to_s)})"
            )
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.7 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.5 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.4 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.3 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.2 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.1 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/feeds/files/practices/import_csv.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/feeds/files/practices/import_csv.rb