blob: 692004c446068306186dbebf8dd10c23df43eb99 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# frozen_string_literal: true
module Gitlab
module GithubImport
module Representation
module PullRequests
class ReviewRequests
include ToHash
include ExposeAttribute
attr_reader :attributes
expose_attribute :merge_request_id, :users
class << self
# Builds a list of requested reviewers from a GitHub API response.
#
# review_requests - An instance of `Hash` containing the review requests details.
def from_api_response(review_requests, _additional_data = {})
review_requests = Representation.symbolize_hash(review_requests)
users = review_requests[:users].map do |user_data|
Representation::User.from_api_response(user_data)
end
new(
merge_request_id: review_requests[:merge_request_id],
users: users
)
end
alias_method :from_json_hash, :from_api_response
end
# attributes - A Hash containing the review details. The keys of this
# Hash (and any nested hashes) must be symbols.
def initialize(attributes)
@attributes = attributes
end
def github_identifiers
{ merge_request_id: merge_request_id }
end
end
end
end
end
end
|