Class: Readiness::GitLab::Issues
- Inherits:
-
Client
- Object
- Client
- Readiness::GitLab::Issues
show all
- Defined in:
- lib/support_readiness/gitlab/issues.rb
Overview
Instance Attribute Summary collapse
Class Method Summary
collapse
-
.comments(client, project, issue) ⇒ Array
Get all comments on a project issue within GitLab.
-
.create!(client, project, issue) ⇒ Object
Creates a project issue within GitLab.
-
.create_comment!(client, project, issue, params) ⇒ Hash
Create a comment on a project issue within GitLab.
-
.delete!(client, project, issue) ⇒ Boolean
Deletes a project issue within GitLab.
-
.delete_comment!(client, project, issue, cid) ⇒ Boolean
Deletes a comment on a project issue within GitLab.
-
.find(client, project, iid) ⇒ Hash
Locates a project issue within GitLab.
-
.find!(client, project, iid) ⇒ Object
Locates a project issue within GitLab.
-
.list(client, object, limit = 0, filters = []) ⇒ Array
Lists all issues for an object.
-
.update!(client, project, issue) ⇒ Object
Updates a project issue within GitLab.
-
.update_comment!(client, project, issue, cid, params) ⇒ Hash
Updates a comment on a project issue within GitLab.
Instance Method Summary
collapse
Methods inherited from Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Constructor Details
#initialize(object = {}) ⇒ Issues
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/support_readiness/gitlab/issues.rb', line 25
def initialize(object = {})
@assignee_id = object['assignee_id']
@assignee_ids = object['assignee_ids']
@assignees = object['assignees']
@author = object['author']
@blocking_issues_count = object['blocking_issues_count']
@closed_at = object['closed_at']
@closed_by = object['closed_by']
@confidential = object['confidential']
@created_at = object['created_at']
@description = object['description']
@discussion_locked = object['discussion_locked']
@downvotes = object['downvotes']
@due_date = object['due_date']
@epic = object['epic']
@epic_issue_id = object['epic_issue_id']
@has_tasks = object['has_tasks']
@health_status = object['health_status']
@id = object['id']
@iid = object['iid']
@imported = object['imported']
@imported_from = object['imported_from']
@issue_type = object['issue_type']
@iteration = object['iteration']
@labels = object['labels']
@_links = object['_links']
@merge_requests_count = object['merge_requests_count']
@milestone = object['milestone']
@moved_to_id = object['moved_to_id']
@project_id = object['project_id']
@references = object['references']
@service_desk_reply_to = object['service_desk_reply_to']
@severity = object['severity']
@state = object['state']
@state_event = object['state_event']
@task_completion_status = object['task_completion_status']
@task_status = object['task_status']
@time_stats = object['time_stats']
@title = object['title']
@type = object['type']
@updated_at = object['updated_at']
@upvotes = object['upvotes']
@user_notes_count = object['user_notes_count']
@web_url = object['web_url']
@weight = object['weight']
end
|
Instance Attribute Details
#_links ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def _links
@_links
end
|
#assignee_id ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def assignee_id
@assignee_id
end
|
#assignee_ids ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def assignee_ids
@assignee_ids
end
|
#assignees ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def assignees
@assignees
end
|
#author ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def author
@author
end
|
#blocking_issues_count ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def blocking_issues_count
@blocking_issues_count
end
|
#closed_at ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def closed_at
@closed_at
end
|
#closed_by ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def closed_by
@closed_by
end
|
#confidential ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def confidential
@confidential
end
|
#created_at ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def created_at
@created_at
end
|
#description ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def description
@description
end
|
#discussion_locked ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def discussion_locked
@discussion_locked
end
|
#downvotes ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def downvotes
@downvotes
end
|
#due_date ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def due_date
@due_date
end
|
#epic ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def epic
@epic
end
|
#epic_issue_id ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def epic_issue_id
@epic_issue_id
end
|
#has_tasks ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def has_tasks
@has_tasks
end
|
#health_status ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def health_status
@health_status
end
|
#id ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def id
@id
end
|
#iid ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def iid
@iid
end
|
#imported ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def imported
@imported
end
|
#imported_from ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def imported_from
@imported_from
end
|
#issue_type ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def issue_type
@issue_type
end
|
#iteration ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def iteration
@iteration
end
|
#labels ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def labels
@labels
end
|
#merge_requests_count ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def merge_requests_count
@merge_requests_count
end
|
#milestone ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def milestone
@milestone
end
|
#moved_to_id ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def moved_to_id
@moved_to_id
end
|
#project_id ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def project_id
@project_id
end
|
#references ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def references
@references
end
|
#service_desk_reply_to ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def service_desk_reply_to
@service_desk_reply_to
end
|
#severity ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def severity
@severity
end
|
#state ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def state
@state
end
|
#state_event ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def state_event
@state_event
end
|
#task_completion_status ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def task_completion_status
@task_completion_status
end
|
#task_status ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def task_status
@task_status
end
|
#time_stats ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def time_stats
@time_stats
end
|
#title ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def title
@title
end
|
#type ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def type
@type
end
|
#updated_at ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def updated_at
@updated_at
end
|
#upvotes ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def upvotes
@upvotes
end
|
#user_notes_count ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def user_notes_count
@user_notes_count
end
|
#web_url ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def web_url
@web_url
end
|
#weight ⇒ Object
14
15
16
|
# File 'lib/support_readiness/gitlab/issues.rb', line 14
def weight
@weight
end
|
Class Method Details
Get all comments on a project issue within GitLab.
271
272
273
274
275
276
277
278
279
280
281
282
283
284
|
# File 'lib/support_readiness/gitlab/issues.rb', line 271
def self.(client, project, issue)
array = []
page = 1
loop do
response = client.connection.get "projects/#{project.id}/issues/#{issue.iid}/notes?per_page=100&page=#{page}"
handle_request_error(0, 'GitLab', response.status) unless response.status == 200
body = Oj.load(response.body)
array += body
break if body.count < 100
page += 1
end
array
end
|
.create!(client, project, issue) ⇒ Object
Creates a project issue within GitLab. This will exit on error
193
194
195
196
197
|
# File 'lib/support_readiness/gitlab/issues.rb', line 193
def self.create!(client, project, issue)
response = client.connection.post "projects/#{project.id}/issues", to_clean_json(issue)
handle_request_error(1, 'GitLab', response.status, { action: 'Create issue', id: project.id }) unless response.status == 200
Issues.new(Oj.load(response.body))
end
|
Create a comment on a project issue within GitLab.
311
312
313
314
315
|
# File 'lib/support_readiness/gitlab/issues.rb', line 311
def self.(client, project, issue, params)
response = client.connection.post "projects/#{project.id}/issues/#{issue.iid}/notes", params.to_json
handle_request_error(1, 'GitLab', response.status, { action: 'Create issue comment', id: issue.id }) unless response.status == 200
Oj.load(response.body)
end
|
.delete!(client, project, issue) ⇒ Boolean
Deletes a project issue within GitLab. This will exit on error
245
246
247
248
249
|
# File 'lib/support_readiness/gitlab/issues.rb', line 245
def self.delete!(client, project, issue)
response = client.connection.delete "projects/#{project.id}/issues/#{issue.iid}"
handle_request_error(1, 'GitLab', response.status, { action: 'Delete an issue', id: "#{project.id}/issues/#{issue.iid}" }) unless response.status == 204
true
end
|
Deletes a comment on a project issue within GitLab.
369
370
371
372
373
|
# File 'lib/support_readiness/gitlab/issues.rb', line 369
def self.(client, project, issue, cid)
response = client.connection.delete "projects/#{project.id}/issues/#{issue.iid}/notes/#{cid}"
handle_request_error(1, 'GitLab', response.status, { action: 'Delete issue comment', id: issue.id }) unless response.status == 204
true
end
|
.find(client, project, iid) ⇒ Hash
Locates a project issue within GitLab. This will not exit on error (except Authentication errors)
137
138
139
140
141
142
143
|
# File 'lib/support_readiness/gitlab/issues.rb', line 137
def self.find(client, project, iid)
response = client.connection.get "projects/#{project.id}/issues/#{iid}"
handle_request_error(0, 'GitLab', response.status, { action: 'get', id: iid }) unless response.status == 200
return Issues.new(Oj.load(response.body)) if response.status == 200
Oj.load(response.body)
end
|
.find!(client, project, iid) ⇒ Object
Locates a project issue within GitLab. This will exit on error
164
165
166
167
168
|
# File 'lib/support_readiness/gitlab/issues.rb', line 164
def self.find!(client, project, iid)
response = client.connection.get "projects/#{project.id}/issues/#{iid}"
handle_request_error(1, 'GitLab', response.status, { action: 'Find issue', id: iid }) unless response.status == 200
Issues.new(Oj.load(response.body))
end
|
.list(client, object, limit = 0, filters = []) ⇒ Array
Lists all issues for an object. Does not stop until it ends or the page limit is hit. This method can take a long time to run depending on the parameters used.
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/support_readiness/gitlab/issues.rb', line 102
def self.list(client, object, limit = 0, filters = [])
array = []
page = 1
loop do
response = client.connection.get "#{object.class.name.split('::').last.downcase}/#{object.id}/issues?per_page=100&page=#{page}&#{to_param_string(filters)}"
handle_request_error(0, 'GitLab', response.status) unless response.status == 200
body = Oj.load(response.body)
array += body.map { |p| Issues.new(p) }
break if body.count < 100
break if limit != 0 && array.count >= (limit * 100)
page += 1
end
array
end
|
.update!(client, project, issue) ⇒ Object
Updates a project issue within GitLab. This will exit on error
220
221
222
223
224
|
# File 'lib/support_readiness/gitlab/issues.rb', line 220
def self.update!(client, project, issue)
response = client.connection.put "projects/#{project.id}/issues/#{issue.iid}", to_clean_json(issue)
handle_request_error(1, 'GitLab', response.status, { action: 'Update an issue', id: "#{project.id}/issues/#{issue.iid}" }) unless response.status == 200
Issues.new(Oj.load(response.body))
end
|
Updates a comment on a project issue within GitLab.
342
343
344
345
346
|
# File 'lib/support_readiness/gitlab/issues.rb', line 342
def self.(client, project, issue, cid, params)
response = client.connection.put "projects/#{project.id}/issues/#{issue.iid}/notes/#{cid}", params.to_json
handle_request_error(1, 'GitLab', response.status, { action: 'Update issue comment', id: issue.id }) unless response.status == 200
Oj.load(response.body)
end
|