debian-mirror-gitlab/lib/gitlab/github_import/milestone_formatter.rb

41 lines
779 B
Ruby
Raw Normal View History

2016-06-02 11:05:42 +05:30
module Gitlab
module GithubImport
class MilestoneFormatter < BaseFormatter
def attributes
{
2017-08-17 22:00:37 +05:30
iid: number,
2016-06-02 11:05:42 +05:30
project: project,
2016-09-29 09:46:39 +05:30
title: raw_data.title,
description: raw_data.description,
due_date: raw_data.due_on,
2016-06-02 11:05:42 +05:30
state: state,
2016-09-29 09:46:39 +05:30
created_at: raw_data.created_at,
updated_at: raw_data.updated_at
2016-06-02 11:05:42 +05:30
}
end
2016-11-03 12:29:30 +05:30
def project_association
:milestones
end
def find_condition
2017-08-17 22:00:37 +05:30
{ iid: number }
end
def number
if project.gitea_import?
raw_data.id
else
raw_data.number
end
end
2016-06-02 11:05:42 +05:30
private
def state
raw_data.state == 'closed' ? 'closed' : 'active'
end
end
end
end