Class: MetabaseQuerySync::CLI::Sync

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/metabase_query_sync/cli.rb

Instance Method Summary collapse

Instance Method Details

#call(root_collection_id:, path:, dry_run: false, host: nil, user: nil, pass: nil) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/metabase_query_sync/cli.rb', line 23

def call(root_collection_id:, path:, dry_run: false, host: nil, user: nil, pass: nil)
  config = MetabaseQuerySync::Config.new(
    credentials: MetabaseQuerySync::MetabaseCredentials.from_env(host: host, user: user, pass: pass),
    path: path,
  )
  sync = MetabaseQuerySync::Sync.from_config(config, Logger.new(STDOUT))
  sync.(MetabaseQuerySync::SyncRequest.new(root_collection_id: root_collection_id.to_i, dry_run: dry_run))
end