Class: AffiliateWindow::ETL
- Inherits:
-
Object
- Object
- AffiliateWindow::ETL
- Defined in:
- lib/affiliate_window/etl/base.rb,
lib/affiliate_window/etl/config.rb,
lib/affiliate_window/etl/loader.rb,
lib/affiliate_window/etl/version.rb,
lib/affiliate_window/etl/database.rb,
lib/affiliate_window/etl/extracter.rb,
lib/affiliate_window/etl/scheduler.rb,
lib/affiliate_window/etl/normaliser.rb,
lib/affiliate_window/etl/transformer.rb
Defined Under Namespace
Classes: Config, Database, Extracter, Loader, Normaliser, Scheduler, Transformer
Constant Summary collapse
- VERSION =
"0.0.3"
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(env: ENV, logger: nil) ⇒ ETL
constructor
A new instance of ETL.
- #migrate ⇒ Object
- #migration_filenames ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(env: ENV, logger: nil) ⇒ ETL
Returns a new instance of ETL.
5 6 7 8 |
# File 'lib/affiliate_window/etl/base.rb', line 5 def initialize(env: ENV, logger: nil) self.config = Config.new(env: env) self.logger = logger || config.logger end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/affiliate_window/etl/base.rb', line 3 def config @config end |
#logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/affiliate_window/etl/base.rb', line 3 def logger @logger end |
Instance Method Details
#migrate ⇒ Object
22 23 24 25 |
# File 'lib/affiliate_window/etl/base.rb', line 22 def migrate database.connect! ActiveRecord::Migrator.migrate("db/migrate") end |
#migration_filenames ⇒ Object
27 28 29 30 |
# File 'lib/affiliate_window/etl/base.rb', line 27 def migration_filenames path = File.("../../../db/migrate/*", File.dirname(__FILE__)) Dir[path].each end |
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/affiliate_window/etl/base.rb', line 10 def run database.connect! scheduler.jobs.each do |job| extracter.extract(job.type, job.args).each do |record| transformer.transform(record).each do |transformed_record| loader.load(transformed_record) end end end end |