Class: Fgi::GitServices::Gitlab

Inherits:
Object
  • Object
show all
Defined in:
lib/fgi/git_services/gitlab.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: CONFIG) ⇒ Gitlab

Returns a new instance of Gitlab.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/fgi/git_services/gitlab.rb', line 8

def initialize(config: CONFIG)
  @version      = 'v4'
  @main_url     = "#{config[:url]}/api/#{@version}"
  @token_header = 'PRIVATE-TOKEN'
  @routes = {
    projects:        "#{@main_url}/projects",
    search_projects: "#{@main_url}/projects?search=",
    issues:          "#{@main_url}/projects/#{config[:project_id]}/issues",
    branches:        "#{@main_url}/projects/#{config[:project_id]}/repository/branches"
  }
end

Instance Attribute Details

#routesObject (readonly)

Returns the value of attribute routes.



6
7
8
# File 'lib/fgi/git_services/gitlab.rb', line 6

def routes
  @routes
end

#token_headerObject (readonly)

Returns the value of attribute token_header.



6
7
8
# File 'lib/fgi/git_services/gitlab.rb', line 6

def token_header
  @token_header
end

#versionObject (readonly)

Returns the value of attribute version.



6
7
8
# File 'lib/fgi/git_services/gitlab.rb', line 6

def version
  @version
end

Instance Method Details

#to_sObject



24
25
26
# File 'lib/fgi/git_services/gitlab.rb', line 24

def to_s
  'Gitlab'
end

#to_symObject



20
21
22
# File 'lib/fgi/git_services/gitlab.rb', line 20

def to_sym
  :gitlab
end