Class: Atlassian::JiraConnect::Client

Inherits:
Gitlab::HTTP show all
Defined in:
lib/atlassian/jira_connect/client.rb

Constant Summary

Constants inherited from Gitlab::HTTP

Gitlab::HTTP::BlockedUrlError, Gitlab::HTTP::DEFAULT_TIMEOUT_OPTIONS, Gitlab::HTTP::HTTP_ERRORS, Gitlab::HTTP::HTTP_TIMEOUT_ERRORS, Gitlab::HTTP::RedirectionTooDeep

Instance Method Summary collapse

Methods inherited from Gitlab::HTTP

httparty_perform_request, perform_request, try_get

Constructor Details

#initialize(base_uri, shared_secret) ⇒ Client

Returns a new instance of Client.


6
7
8
9
# File 'lib/atlassian/jira_connect/client.rb', line 6

def initialize(base_uri, shared_secret)
  @base_uri = base_uri
  @shared_secret = shared_secret
end

Instance Method Details

#store_dev_info(project:, commits: nil, branches: nil, merge_requests: nil) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/atlassian/jira_connect/client.rb', line 11

def store_dev_info(project:, commits: nil, branches: nil, merge_requests: nil)
  dev_info_json = {
    repositories: [
      Serializers::RepositoryEntity.represent(
        project,
        commits: commits,
        branches: branches,
        merge_requests: merge_requests
      )
    ]
  }.to_json

  uri = URI.join(@base_uri, '/rest/devinfo/0.10/bulk')

  headers = {
    'Authorization' => "JWT #{jwt_token('POST', uri)}",
    'Content-Type' => 'application/json'
  }

  self.class.post(uri, headers: headers, body: dev_info_json)
end