Class: Gitlab::GithubImport::Importer::IssueEventImporter

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

Constant Summary collapse

SUPPORTED_EVENTS =
%w[
  assigned
  closed
  cross-referenced
  demilestoned
  labeled
  merged
  milestoned
  renamed
  reopened
  review_request_removed
  review_requested
  unassigned
  unlabeled
  commented
  reviewed
].freeze
EVENT_COUNTER_MAP =
{
  'commented' => 'note',
  'reviewed' => 'pull_request_review',
  'merged' => 'pull_request_merged_by'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(issue_event, project, client) ⇒ IssueEventImporter

issue_event - An instance of Gitlab::GithubImport::Representation::IssueEvent. project - An instance of Project. client - An instance of Gitlab::GithubImport::Client.



36
37
38
39
40
# File 'lib/gitlab/github_import/importer/issue_event_importer.rb', line 36

def initialize(issue_event, project, client)
  @issue_event = issue_event
  @project = project
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



7
8
9
# File 'lib/gitlab/github_import/importer/issue_event_importer.rb', line 7

def client
  @client
end

#issue_eventObject (readonly)

Returns the value of attribute issue_event.



7
8
9
# File 'lib/gitlab/github_import/importer/issue_event_importer.rb', line 7

def issue_event
  @issue_event
end

#projectObject (readonly)

Returns the value of attribute project.



7
8
9
# File 'lib/gitlab/github_import/importer/issue_event_importer.rb', line 7

def project
  @project
end

Instance Method Details

#executeObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/gitlab/github_import/importer/issue_event_importer.rb', line 42

def execute
  importer = event_importer_class(issue_event)
  if importer
    importer.new(project, client).execute(issue_event)
  else
    Gitlab::GithubImport::Logger.debug(
      message: 'UNSUPPORTED_EVENT_TYPE',
      event_type: issue_event.event, event_github_id: issue_event.id
    )
  end
end