module GitlabToDoap::Utilities

Attributes

gitlab_api_token[R]
gitlab_endpoint[R]

Public Instance Methods

gitlab() click to toggle source

Build a Gitlab API client, if one does not exist already

# File lib/gitlab-to-doap/utilities.rb, line 20
def gitlab
  @gitlab ||= Gitlab.client(
    endpoint: @gitlab_endpoint,
    private_token: @gitlab_api_token
  )
end
gitlab_project(project_id) click to toggle source
# File lib/gitlab-to-doap/utilities.rb, line 27
def gitlab_project(project_id)
  gitlab.get("/projects/#{gitlab.url_encode project_id}?license=true&statistics=true")
end
strip_markdown(text) click to toggle source

Given some markdown formatted plain text, remove all of the formatting

# File lib/gitlab-to-doap/utilities.rb, line 14
def strip_markdown(text)
  markdown = Redcarpet::Markdown.new(Redcarpet::Render::StripDown)
  markdown.render(text).strip
end