Class: Gitlab::Triage::Resource::Issue

Inherits:
Base
  • Object
show all
Includes:
Shared::Issuable
Defined in:
lib/gitlab/triage/resource/issue.rb

Direct Known Subclasses

LinkedIssue

Constant Summary collapse

DATE_FIELDS =
%i[
  due_date
].freeze

Constants included from Shared::Issuable

Shared::Issuable::MAX_PARENT_LOOKUP, Shared::Issuable::SourceTooDeep

Constants inherited from Base

Base::CONFIDENTIAL_TEXT

Instance Attribute Summary

Attributes inherited from Base

#parent, #resource

Instance Method Summary collapse

Methods included from Shared::Issuable

#author, #full_resource_reference, #group_url, #label_events, #labels, #labels_chronologically, #labels_with_details, #milestone, #project_path, #project_url, #query_label_events, #request_group, #request_project, #root_id, #state

Methods inherited from Base

#build_url, define_field, #expand_resource!, #initialize, #network, #redact_confidential_attributes?, #resource_id, #resource_url, #source, #source_resource, #source_url, #url, #url_opts

Constructor Details

This class inherits a constructor from Gitlab::Triage::Resource::Base

Instance Method Details

#closed_byObject



34
35
36
37
38
# File 'lib/gitlab/triage/resource/issue.rb', line 34

def closed_by
  @closed_by ||= network.query_api_cached(
    resource_url(sub_resource_type: 'closed_by'))
    .map { |merge_request| MergeRequest.new(merge_request, parent: self) }
end

#expired?(today = Date.today) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/gitlab/triage/resource/issue.rb', line 46

def expired?(today = Date.today)
  due_date && due_date < today
end

#linked_issuesObject



40
41
42
43
44
# File 'lib/gitlab/triage/resource/issue.rb', line 40

def linked_issues
  @linked_issues ||= network.query_api_cached(
    resource_url(sub_resource_type: 'links'))
    .map { |issue| LinkedIssue.new(issue, parent: self) }
end

#merge_requests_countObject



24
25
26
# File 'lib/gitlab/triage/resource/issue.rb', line 24

def merge_requests_count
  @merge_requests_count ||= resource.dig(:merge_requests_count)
end


28
29
30
31
32
# File 'lib/gitlab/triage/resource/issue.rb', line 28

def related_merge_requests
  @related_merge_requests ||= network.query_api_cached(
    resource_url(sub_resource_type: 'related_merge_requests'))
    .map { |merge_request| MergeRequest.new(merge_request, parent: self) }
end