Class: Gitlab::GithubImport::Representation::PullRequests::ReviewRequests
- Inherits:
-
Object
- Object
- Gitlab::GithubImport::Representation::PullRequests::ReviewRequests
- Includes:
- ExposeAttribute, ToHash
- Defined in:
- lib/gitlab/github_import/representation/pull_requests/review_requests.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
-
.from_api_response(review_requests, _additional_data = {}) ⇒ Object
(also: from_json_hash)
Builds a list of requested reviewers from a GitHub API response.
Instance Method Summary collapse
- #github_identifiers ⇒ Object
-
#initialize(attributes) ⇒ ReviewRequests
constructor
attributes - A Hash containing the review details.
Methods included from ExposeAttribute
Methods included from ToHash
#convert_value_for_to_hash, #to_hash
Constructor Details
#initialize(attributes) ⇒ ReviewRequests
attributes - A Hash containing the review details. The keys of this
Hash (and any nested hashes) must be symbols.
36 37 38 |
# File 'lib/gitlab/github_import/representation/pull_requests/review_requests.rb', line 36 def initialize(attributes) @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
11 12 13 |
# File 'lib/gitlab/github_import/representation/pull_requests/review_requests.rb', line 11 def attributes @attributes end |
Class Method Details
.from_api_response(review_requests, _additional_data = {}) ⇒ Object Also known as: from_json_hash
Builds a list of requested reviewers from a GitHub API response.
review_requests - An instance of ‘Hash` containing the review requests details.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gitlab/github_import/representation/pull_requests/review_requests.rb', line 19 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], merge_request_iid: review_requests[:merge_request_iid], users: users ) end |
Instance Method Details
#github_identifiers ⇒ Object
40 41 42 43 44 45 |
# File 'lib/gitlab/github_import/representation/pull_requests/review_requests.rb', line 40 def github_identifiers { merge_request_iid: merge_request_iid, requested_reviewers: users.pluck(:login) # rubocop: disable CodeReuse/ActiveRecord } end |