Sha256: 975fb38fcd59aae2ceacb96cf2f7d7f2a7e857cff5d75973f09e35aa661e1990

Contents?: true

Size: 624 Bytes

Versions: 14

Compression:

Stored size: 624 Bytes

Contents

class Export < ActiveRecord::Base
  belongs_to :user

  enum file_type: [:ttl, :nt, :xml]

  validates_presence_of :default_namespace

  before_destroy :delete_dump_file

  def finish!(messages)
    self.output = messages
    self.success = true
    self.finished_at = Time.now
    save!
  end

  def fail!(exception)
    self.output = exception.to_s + "\n\n" + exception.backtrace.join("\n")
    self.finished_at = Time.now
    save!
  end

  def build_filename
    File.join(Iqvoc.export_path, "#{self.token.to_s}.#{self.file_type}")
  end

  private

  def delete_dump_file
    File.delete(self.build_filename)
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
iqvoc-4.11.1 app/models/export.rb
iqvoc-4.11.0 app/models/export.rb
iqvoc-4.10.0 app/models/export.rb
iqvoc-4.9.0 app/models/export.rb
iqvoc-4.8.2 app/models/export.rb
iqvoc-4.8.1 app/models/export.rb
iqvoc-4.8.0 app/models/export.rb
iqvoc-4.7.0 app/models/export.rb
iqvoc-4.6.1 app/models/export.rb
iqvoc-4.5.2 app/models/export.rb
iqvoc-4.6.0 app/models/export.rb
iqvoc-4.5.1 app/models/export.rb
iqvoc-4.5.0 app/models/export.rb
iqvoc-4.4.0 app/models/export.rb