Class: Gitlab::LegacyGithubImport::ReleaseFormatter

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/gitlab/legacy_github_import/release_formatter.rb

Instance Attribute Summary

Attributes inherited from BaseFormatter

#client, #formatter, #project, #raw_data

Instance Method Summary collapse

Methods inherited from BaseFormatter

#create!, #initialize, #url

Constructor Details

This class inherits a constructor from Gitlab::LegacyGithubImport::BaseFormatter

Instance Method Details

#attributesObject



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

def attributes
  {
    project: project,
    tag: raw_data[:tag_name],
    name: raw_data[:name],
    description: raw_data[:body],
    created_at: raw_data[:created_at],
    # Draft releases will have a null published_at
    released_at: raw_data[:published_at] || Time.current,
    updated_at: raw_data[:created_at]
  }
end

#find_conditionObject



23
24
25
# File 'lib/gitlab/legacy_github_import/release_formatter.rb', line 23

def find_condition
  { tag: raw_data[:tag_name] }
end

#project_associationObject



19
20
21
# File 'lib/gitlab/legacy_github_import/release_formatter.rb', line 19

def project_association
  :releases
end

#valid?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/gitlab/legacy_github_import/release_formatter.rb', line 27

def valid?
  !raw_data[:draft] && raw_data[:tag_name].present?
end