class Holistics::Dbt

Public Instance Methods

upload() click to toggle source
# File lib/dbt.rb, line 9
def upload
  data_source_name = options[:data_source_name]
  manifest_file = get_manifest_file_from(options)

  params = {
    data_source_name: data_source_name
  }

  http_request.post_file('api/v2/data_sources/upload_dbt_manifest.json', params, manifest_file, 'application/json',
                         'Error uploading manifest.json file')

  puts 'Upload completed!'
end

Private Instance Methods

get_manifest_file_from(options) click to toggle source
# File lib/dbt.rb, line 25
def get_manifest_file_from(options)
  local_filepath =
    if options[:filepath].present?
      options[:filepath]
    else
      Dir['./**/manifest.json'].first
    end

  begin
    file = File.open(local_filepath)
  rescue StandardError
    warn "Could not open file at '#{local_filepath}'."
    puts 'Invalid file path. Please check your file path.'
    return
  end

  file
end
http_request() click to toggle source
# File lib/dbt.rb, line 44
def http_request
  @http_request ||= Helpers::HttpRequest.new
end