Class: Gitlab::FogbugzImport::Importer

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/fogbugz_import/importer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ Importer

Returns a new instance of Importer


6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/gitlab/fogbugz_import/importer.rb', line 6

def initialize(project)
  @project = project

  import_data = project.import_data.try(:data)
  repo_data = import_data['repo'] if import_data
  if repo_data
    @repo = FogbugzImport::Repository.new(repo_data)
    @known_labels = Set.new
  else
    raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}"
  end
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project


4
5
6
# File 'lib/gitlab/fogbugz_import/importer.rb', line 4

def project
  @project
end

#repoObject (readonly)

Returns the value of attribute repo


4
5
6
# File 'lib/gitlab/fogbugz_import/importer.rb', line 4

def repo
  @repo
end

Instance Method Details

#executeObject


19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gitlab/fogbugz_import/importer.rb', line 19

def execute
  return true unless repo.valid?
  client = Gitlab::FogbugzImport::Client.new(token: fb_session[:token], uri: fb_session[:uri])

  @cases = client.cases(@repo.id.to_i)
  @categories = client.categories

  import_cases

  true
end