Class: SupportOps::GitLab::Issues
- Defined in:
- lib/support_ops_gitlab/gitlab/issues.rb
Overview
Promote an issue to an epic => docs.gitlab.com/api/issues/#promote-an-issue-to-an-epic
Clone an issue => docs.gitlab.com/api/issues/#clone-an-issue
Time tracking => docs.gitlab.com/api/issues/#time-tracking
List issue state events => docs.gitlab.com/api/issues/#list-issue-state-events
Incidents => docs.gitlab.com/api/issues/#incidents
Create a to-do item => docs.gitlab.com/api/issues/#create-a-to-do-item
List participants in an issue => docs.gitlab.com/api/issues/#list-participants-in-an-issue
Defines the class Issues within the module SupportOps::GitLab.
Instance Attribute Summary collapse
-
#_links ⇒ Hash
Various links related to the issue.
-
#add_labels ⇒ String
Comma-separated label names to add to an issue; if a label does not already exist, this creates a new project label and assigns it to the issue.
-
#assignee_ids ⇒ Array
The IDs of the users to assign the issue to.
-
#assignees ⇒ Array
An array of users assigned to the issue.
-
#author ⇒ Hash
The author of the issue.
-
#closed_at ⇒ String
The timestamp the issue was closed at.
-
#closed_by ⇒ Hash
The user who closed the issue.
-
#confidential ⇒ Boolean
If the issue is confidential or not.
-
#created_at ⇒ String
The timestamp of when the issue was created.
-
#description ⇒ String
The issue’s description.
-
#discussion_locked ⇒ Boolean
If discussion on the issue is locked or not.
-
#discussion_to_resolve ⇒ String
The ID of a discussion to resolve; this fills out the issue with a default description and mark the discussion as resolved.
-
#downvotes ⇒ Integer
The number of downvotes the issue has.
-
#due_date ⇒ String
The due date.
-
#epic ⇒ Hash
the epic the issue is attached to.
-
#epic_id ⇒ Integer
The ID of the epic the issue is attached to.
-
#epic_iid ⇒ Integer
IID of the epic to add the issue to.
-
#has_tasks ⇒ Boolean
If the issue has attached tasks or not.
-
#health_status ⇒ String
The current health status of the issue.
-
#id ⇒ Integer
The global ID or URL-encoded path of the project.
-
#iid ⇒ Integer
The internal ID of a project’s issue.
-
#imported ⇒ Boolean
If the issue was imported or not.
-
#imported_from ⇒ String
The current value of imported_from.
-
#issue_type ⇒ String
The type of issue; either issue, incident, test_case, or task.
-
#iteration ⇒ Hash
The iteration the issue is in.
-
#labels ⇒ Array
Comma-separated list of label names.
-
#merge_request_to_resolve_discussions_of ⇒ Integer
The IID of a merge request in which to resolve all issues.
-
#merge_requests_count ⇒ Integer
The number of merge requests attached to the issue4.
-
#milestone ⇒ Hash
The milestone the issue is attached to.
-
#milestone_id ⇒ Integer
The ID ofthe milestone the issue is attached to.
-
#moved_to_id ⇒ Integer
The ID of the new issue the current issue was moved to.
-
#project_id ⇒ Integer
The ID of the project the issue is within.
-
#references ⇒ Hash
Reference tags for the issue.
-
#remove_labels ⇒ String
Comma-separated label names to remove from an issue.
-
#severity ⇒ String
The current value of severity.
-
#state ⇒ String
The current state of the issue.
-
#state_event ⇒ String
The state event of an issue; to close the issue, use close, and to reopen it, use reopen.
-
#task_completion_status ⇒ Hash
Informaiton on the task status of an issue.
-
#task_status ⇒ String
A string of the task status of an issue.
-
#time_stats ⇒ Hash
Information on the time spent on the issue.
-
#title ⇒ String
The issue title.
-
#to_project_id ⇒ Integer
The ID of the new project to move the issue to.
-
#type ⇒ String
The type of issue; either issue, incident, test_case, or task.
-
#updated_at ⇒ String
The timestamp of when the issue was last updated.
-
#upvotes ⇒ Integer
The number of upvotes on an issue.
-
#user_notes_count ⇒ Integer
The number of notes on the issue.
-
#web_url ⇒ String
The URL of the issue.
-
#weight ⇒ Integer
The weight of an issue.
-
#with_notes ⇒ Boolean
Clone the issue with notes.
Class Method Summary collapse
-
.get(object) ⇒ Object
Locates a specific issue in the GitLab system.
-
.get!(object) ⇒ Object
Locates a specific issue in the GitLab system.
-
.list(key: value) ⇒ Array
Lists issues.
Instance Method Summary collapse
-
#delete! ⇒ Object
Deletes an issue.
-
#merge_requests ⇒ Boolean
List merge requests related to issue.
-
#move! ⇒ Object
Moves an issue.
-
#notes ⇒ Boolean
List notes on an issue.
-
#save! ⇒ Object
Creates/updates an issue.
-
#subscribe! ⇒ Object
Subscribe to an issue.
-
#unsubscribe! ⇒ Object
Unsubscribe to an issue.
Methods inherited from Base
#activate!, #approve!, attributes, #badges, #ban!, #block!, client, #client=, #commits, configure, #contributors, #create_support_pin!, #deactivate!, define_attributes, #diffs, #disable_2fa!, #discussions, #emails, #encoded_path, #events, #find, #find!, #gpg_keys, #hard_delete!, #impersonations, #initialize, #issues, #jobs, #latest_pipeline, #members, #memberships, #paid?, #pats, #pipeline_variables, #pipelines, #preferences, #projects, readonly_attributes, #reject!, #revoke!, #rotate!, #ssh_keys, #status, #store_original_attributes, #support_pin, to_hash, #tokens, #unban!, #unblock!, #webhooks
Constructor Details
This class inherits a constructor from SupportOps::GitLab::Base
Instance Attribute Details
#_links ⇒ Hash
Various links related to the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def _links @_links end |
#add_labels ⇒ String
Comma-separated label names to add to an issue; if a label does not already exist, this creates a new project label and assigns it to the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def add_labels @add_labels end |
#assignee_ids ⇒ Array
The IDs of the users to assign the issue to
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def assignee_ids @assignee_ids end |
#assignees ⇒ Array
An array of users assigned to the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def assignees @assignees end |
#author ⇒ Hash
The author of the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def @author end |
#closed_at ⇒ String
The timestamp the issue was closed at
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def closed_at @closed_at end |
#closed_by ⇒ Hash
The user who closed the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def closed_by @closed_by end |
#confidential ⇒ Boolean
If the issue is confidential or not
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def confidential @confidential end |
#created_at ⇒ String
The timestamp of when the issue was created
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def created_at @created_at end |
#description ⇒ String
The issue’s description
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def description @description end |
#discussion_locked ⇒ Boolean
If discussion on the issue is locked or not
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def discussion_locked @discussion_locked end |
#discussion_to_resolve ⇒ String
The ID of a discussion to resolve; this fills out the issue with a default description and mark the discussion as resolved
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def discussion_to_resolve @discussion_to_resolve end |
#downvotes ⇒ Integer
The number of downvotes the issue has
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def downvotes @downvotes end |
#due_date ⇒ String
The due date
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def due_date @due_date end |
#epic ⇒ Hash
the epic the issue is attached to
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def epic @epic end |
#epic_id ⇒ Integer
The ID of the epic the issue is attached to
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def epic_id @epic_id end |
#epic_iid ⇒ Integer
IID of the epic to add the issue to
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def epic_iid @epic_iid end |
#has_tasks ⇒ Boolean
If the issue has attached tasks or not
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def has_tasks @has_tasks end |
#health_status ⇒ String
The current health status of the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def health_status @health_status end |
#id ⇒ Integer
The global ID or URL-encoded path of the project
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def id @id end |
#iid ⇒ Integer
The internal ID of a project’s issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def iid @iid end |
#imported ⇒ Boolean
If the issue was imported or not
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def imported @imported end |
#imported_from ⇒ String
Returns the current value of imported_from.
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def imported_from @imported_from end |
#issue_type ⇒ String
The type of issue; either issue, incident, test_case, or task
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def issue_type @issue_type end |
#iteration ⇒ Hash
The iteration the issue is in
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def iteration @iteration end |
#labels ⇒ Array
Comma-separated list of label names
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def labels @labels end |
#merge_request_to_resolve_discussions_of ⇒ Integer
The IID of a merge request in which to resolve all issues
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def merge_request_to_resolve_discussions_of @merge_request_to_resolve_discussions_of end |
#merge_requests_count ⇒ Integer
The number of merge requests attached to the issue4
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def merge_requests_count @merge_requests_count end |
#milestone ⇒ Hash
The milestone the issue is attached to
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def milestone @milestone end |
#milestone_id ⇒ Integer
The ID ofthe milestone the issue is attached to
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def milestone_id @milestone_id end |
#moved_to_id ⇒ Integer
The ID of the new issue the current issue was moved to
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def moved_to_id @moved_to_id end |
#project_id ⇒ Integer
The ID of the project the issue is within
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def project_id @project_id end |
#references ⇒ Hash
Reference tags for the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def references @references end |
#remove_labels ⇒ String
Comma-separated label names to remove from an issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def remove_labels @remove_labels end |
#severity ⇒ String
Returns the current value of severity.
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def severity @severity end |
#state ⇒ String
The current state of the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def state @state end |
#state_event ⇒ String
The state event of an issue; to close the issue, use close, and to reopen it, use reopen
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def state_event @state_event end |
#task_completion_status ⇒ Hash
Informaiton on the task status of an issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def task_completion_status @task_completion_status end |
#task_status ⇒ String
A string of the task status of an issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def task_status @task_status end |
#time_stats ⇒ Hash
Information on the time spent on the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def time_stats @time_stats end |
#title ⇒ String
The issue title
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def title @title end |
#to_project_id ⇒ Integer
The ID of the new project to move the issue to
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def to_project_id @to_project_id end |
#type ⇒ String
The type of issue; either issue, incident, test_case, or task
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def type @type end |
#updated_at ⇒ String
The timestamp of when the issue was last updated
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def updated_at @updated_at end |
#upvotes ⇒ Integer
The number of upvotes on an issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def upvotes @upvotes end |
#user_notes_count ⇒ Integer
The number of notes on the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def user_notes_count @user_notes_count end |
#web_url ⇒ String
The URL of the issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def web_url @web_url end |
#weight ⇒ Integer
The weight of an issue
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def weight @weight end |
#with_notes ⇒ Boolean
Clone the issue with notes
68 69 70 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 68 def with_notes @with_notes end |
Class Method Details
.get(object) ⇒ Object
Locates a specific issue in the GitLab system
444 445 446 447 448 449 450 451 452 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 444 def self.get(object) if object.is_a? Issues Issues.new(id: id).find elsif object.is_a? Hash Issues.new({ id: object[:id], iid: object[:iid], project_id: object[:project_id] }).find else Issues.new(id: object).find end end |
.get!(object) ⇒ Object
Locates a specific issue in the GitLab system
491 492 493 494 495 496 497 498 499 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 491 def self.get!(object) if object.is_a? Issues Issues.new(id: id).find! elsif object.is_a? Hash Issues.new({ id: object[:id], iid: object[:iid], project_id: object[:project_id] }).find! else Issues.new(id: object).find! end end |
.list(key: value) ⇒ Array
Lists issues
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 328 def self.list(**args) args[:assignee_id] = nil unless args[:assignee_id] args[:assignee_username] = nil unless args[:assignee_username] args[:author_id] = nil unless args[:author_id] args[:author_username] = nil unless args[:author_username] args[:confidential] = nil unless args[:confidential] args[:created_after] = nil unless args[:created_after] args[:created_before] = nil unless args[:created_before] args[:due_date] = nil unless args[:due_date] args[:epic_id] = nil unless args[:epic_id] args[:health_status] = nil unless args[:health_status] args[:iids] = nil unless args[:iids] args[:issue_type] = nil unless args[:issue_type] args[:iteration_id] = nil unless args[:iteration_id] args[:iteration_title] = nil unless args[:iteration_title] args[:labels] = nil unless args[:labels] args[:milestone] = nil unless args[:milestone] args[:milestone_id] = nil unless args[:milestone_id] args[:my_reaction_emoji] = nil unless args[:my_reaction_emoji] args[:non_archived] = nil unless args[:non_archived] args[:order_by] = nil unless args[:order_by] args[:project_id] = nil unless args[:project_id] args[:scope] = nil unless args[:scope] args[:search] = nil unless args[:search] args[:sort] = nil unless args[:sort] args[:state] = nil unless args[:state] args[:updated_after] = nil unless args[:updated_after] args[:updated_before] = nil unless args[:updated_before] args[:weight] = nil unless args[:weight] args[:limit] = 0 unless args[:limit] params = '' params += "assignee_id=#{args[:assignee_id]}&" unless args[:assignee_id].nil? params += "assignee_username=#{args[:assignee_username]}&" unless args[:assignee_username].nil? params += "author_id=#{args[:author_id]}&" unless args[:author_id].nil? params += "author_username=#{args[:author_username]}&" unless args[:author_username].nil? params += "confidential=#{args[:confidential]}&" unless args[:confidential].nil? params += "created_after=#{args[:created_after]}&" unless args[:created_after].nil? params += "created_before=#{args[:created_before]}&" unless args[:created_before].nil? params += "due_date=#{args[:due_date]}&" unless args[:due_date].nil? params += "epic_id=#{args[:epic_id]}&" unless args[:epic_id].nil? params += "health_status=#{args[:health_status]}&" unless args[:health_status].nil? params += "iids=#{args[:iids]}&" unless args[:iids].nil? params += "issue_type=#{args[:issue_type]}&" unless args[:issue_type].nil? params += "iteration_id=#{args[:iteration_id]}&" unless args[:iteration_id].nil? params += "iteration_title=#{args[:iteration_title]}&" unless args[:iteration_title].nil? params += "labels=#{args[:labels]}&" unless args[:labels].nil? params += "milestone=#{args[:milestone]}&" unless args[:milestone].nil? params += "milestone_id=#{args[:milestone_id]}&" unless args[:milestone_id].nil? params += "my_reaction_emoji=#{args[:my_reaction_emoji]}&" unless args[:my_reaction_emoji].nil? params += "non_archived=#{args[:non_archived]}&" unless args[:non_archived].nil? params += "order_by=#{args[:order_by]}&" unless args[:order_by].nil? params += "scope=#{args[:scope]}&" unless args[:scope].nil? params += "search=#{args[:search]}&" unless args[:search].nil? params += "sort=#{args[:sort]}&" unless args[:sort].nil? params += "state=#{args[:state]}&" unless args[:state].nil? params += "updated_after=#{args[:updated_after]}&" unless args[:updated_after].nil? params += "updated_before=#{args[:updated_before]}&" unless args[:updated_before].nil? params += "weight=#{args[:weight]}&" unless args[:weight].nil? array = [] page = 1 base_url = if args[:project_id].nil? "issues" else "projects/#{args[:project_id]}/issues" end loop do response = client.connection.get("#{base_url}?#{params}&page=#{page}&per_page=100") body = Oj.load(response.body) array += body.map { |i| Issues.new(i) } break if args[:limit].to_i.positive? && array.count >= args[:limit].to_i break if body.count < 100 page += 1 end return array if args[:limit].to_i.zero? array.first(args[:limit].to_i) end |
Instance Method Details
#delete! ⇒ Object
This is inherited from Base#delete!
Deletes an issue
20 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 20 def delete!; end |
#merge_requests ⇒ Boolean
This is inherited from Base#merge_requests
List merge requests related to issue
22 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 22 def merge_requests; end |
#move! ⇒ Object
This is inherited from Base#move!
Moves an issue
23 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 23 def move!; end |
#notes ⇒ Boolean
This is inherited from Base#notes
List notes on an issue
22 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 22 def notes; end |
#save! ⇒ Object
This is inherited from Base#save!
Creates/updates an issue
48 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 48 def save!; end |
#subscribe! ⇒ Object
This is inherited from Base#subscribe!
Subscribe to an issue
20 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 20 def subscribe!; end |
#unsubscribe! ⇒ Object
This is inherited from Base#unsubscribe!
Unsubscribe to an issue
20 |
# File 'lib/support_ops_gitlab/gitlab/issues.rb', line 20 def unsubscribe!; end |