Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-16 21:08:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-16 21:08:46 +0300
commitaa0f0e992153e84e1cdec8a1c7310d5eb93a9f8f (patch)
tree4a662bc77fb43e1d1deec78cc7a95d911c0da1c5 /lib/sentry/client
parentd47f9d2304dbc3a23bba7fe7a5cd07218eeb41cd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/sentry/client')
-rw-r--r--lib/sentry/client/issue_link.rb27
-rw-r--r--lib/sentry/client/repo.rb38
2 files changed, 65 insertions, 0 deletions
diff --git a/lib/sentry/client/issue_link.rb b/lib/sentry/client/issue_link.rb
new file mode 100644
index 00000000000..200b1a6b435
--- /dev/null
+++ b/lib/sentry/client/issue_link.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+module Sentry
+ class Client
+ module IssueLink
+ def create_issue_link(integration_id, sentry_issue_identifier, issue)
+ issue_link_url = issue_link_api_url(integration_id, sentry_issue_identifier)
+
+ params = {
+ project: issue.project.id,
+ externalIssue: "#{issue.project.id}##{issue.iid}"
+ }
+
+ http_put(issue_link_url, params)
+ end
+
+ private
+
+ def issue_link_api_url(integration_id, sentry_issue_identifier)
+ issue_link_url = URI(url)
+ issue_link_url.path = "/api/0/groups/#{sentry_issue_identifier}/integrations/#{integration_id}/"
+
+ issue_link_url
+ end
+ end
+ end
+end
diff --git a/lib/sentry/client/repo.rb b/lib/sentry/client/repo.rb
new file mode 100644
index 00000000000..9a0ed3c7342
--- /dev/null
+++ b/lib/sentry/client/repo.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+module Sentry
+ class Client
+ module Repo
+ def repos(organization_slug)
+ repos_url = repos_api_url(organization_slug)
+
+ repos = http_get(repos_url)[:body]
+
+ handle_mapping_exceptions do
+ map_to_repos(repos)
+ end
+ end
+
+ private
+
+ def repos_api_url(organization_slug)
+ repos_url = URI(url)
+ repos_url.path = "/api/0/organizations/#{organization_slug}/repos/"
+
+ repos_url
+ end
+
+ def map_to_repos(repos)
+ repos.map(&method(:map_to_repo))
+ end
+
+ def map_to_repo(repo)
+ Gitlab::ErrorTracking::Repo.new(
+ status: repo.fetch('status'),
+ integration_id: repo.fetch('integrationId'),
+ project_id: repo.fetch('externalSlug')
+ )
+ end
+ end
+ end
+end