Class: Gitlab::Triage::Resource::Label

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/triage/resource/label.rb

Constant Summary collapse

LabelDoesntExistError =
Class.new(StandardError)
FIELDS =
%i[
  id
  project_id
  group_id
  name
  description
  color
  priority
].freeze
TIME_FIELDS =
%i[
  added_at
].freeze

Constants inherited from Base

Base::CONFIDENTIAL_TEXT

Instance Attribute Summary

Attributes inherited from Base

#parent, #resource

Instance Method Summary collapse

Methods inherited from Base

#build_url, define_field, #expand_resource!, #initialize, #network, #redact_confidential_attributes?, #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

#exist?Boolean

Returns:

  • (Boolean)


41
42
43
44
45
46
# File 'lib/gitlab/triage/resource/label.rb', line 41

def exist?
  label = network.query_api_cached(resource_url).first
  return false unless label

  label[:name] == name
end

#resource_idObject (private)



50
51
52
# File 'lib/gitlab/triage/resource/label.rb', line 50

def resource_id
  name
end