Class: Gitlab::GithubImport::ProjectRelationType

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

Constant Summary collapse

CACHE_ORGS_EXPIRES_IN =
5.minutes
CACHE_USER_EXPIRES_IN =
1.hour

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ProjectRelationType

Returns a new instance of ProjectRelationType.



9
10
11
# File 'lib/gitlab/github_import/project_relation_type.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#for(import_source) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/gitlab/github_import/project_relation_type.rb', line 13

def for(import_source)
  namespace = import_source.split('/')[0]
  if user?(namespace)
    'owned'
  elsif organization?(namespace)
    'organization'
  else
    'collaborated'
  end
end