Class: SupportOps::GitLab::MergeRequests

Inherits:
Base
  • Object
show all
Defined in:
lib/support_ops_gitlab/gitlab/merge_requests.rb

Overview

TODO:

Populate readonly_attributes

TODO:

A lot of things listed at docs.gitlab.com/api/merge_requests

TODO:

A lot of things listed at docs.gitlab.com/api/merge_request_approvals/

TODO:
TODO:
TODO:

Defines the class MergeRequests within the module SupportOps::GitLab.

Author:

  • Jason Colyer

Since:

  • 1.0.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#activate!, #approve!, attributes, #badges, #ban!, #block!, client, #client=, #commits, configure, #contributors, #create_support_pin!, #deactivate!, define_attributes, #delete!, #disable_2fa!, #discussions, #emails, #encoded_path, #events, #find, #find!, #gpg_keys, #hard_delete!, #impersonations, #initialize, #issues, #jobs, #latest_pipeline, #members, #memberships, #merge_requests, #move!, #paid?, #pats, #pipeline_variables, #pipelines, #preferences, #projects, readonly_attributes, #reject!, #revoke!, #rotate!, #save!, #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

#allow_collaborationBoolean

Allow commits from members who can merge to the target branch

Returns:

  • (Boolean)

    the current value of allow_collaboration



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def allow_collaboration
  @allow_collaboration
end

#allow_maintainer_to_pushBoolean

Alias of allow_collaboration

Returns:

  • (Boolean)

    the current value of allow_maintainer_to_push



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def allow_maintainer_to_push
  @allow_maintainer_to_push
end

#assigneeHash

Information on the first merge request assignee

Returns:

  • (Hash)

    the current value of assignee



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def assignee
  @assignee
end

#assigneesArray

An array of users assigned to the merge request

Returns:

  • (Array)

    the current value of assignees



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def assignees
  @assignees
end

#authorHash

The author of the merge request

Returns:

  • (Hash)

    the current value of author



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def author
  @author
end

#closed_atString

The timestamp the merge request was closed at

Returns:

  • (String)

    the current value of closed_at



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def closed_at
  @closed_at
end

#closed_byHash

The user who closed the merge request

Returns:

  • (Hash)

    the current value of closed_by



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def closed_by
  @closed_by
end

#created_atString

The timestamp of when the ismerge requestsue was created

Returns:

  • (String)

    the current value of created_at



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def created_at
  @created_at
end

#descriptionString

The merge request’s description

Returns:

  • (String)

    the current value of description



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def description
  @description
end

#detailed_merge_statusString

Detailed merge status of the merge request

Returns:

  • (String)

    the current value of detailed_merge_status



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def detailed_merge_status
  @detailed_merge_status
end

#discussion_lockedBoolean

If discussion on the merge request is locked or not

Returns:

  • (Boolean)

    the current value of discussion_locked



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def discussion_locked
  @discussion_locked
end

#downvotesInteger

The number of downvotes the merge request has

Returns:

  • (Integer)

    the current value of downvotes



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def downvotes
  @downvotes
end

#draftBoolean

If the merge request is in draft mode or not

Returns:

  • (Boolean)

    the current value of draft



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def draft
  @draft
end

#force_remove_source_branchBoolean

Indicates if the project settings lead to source branch deletion after merge

Returns:

  • (Boolean)

    the current value of force_remove_source_branch



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def force_remove_source_branch
  @force_remove_source_branch
end

#idInteger

The global ID or URL-encoded path of the project

Returns:

  • (Integer)

    the current value of id



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def id
  @id
end

#iidInteger

The internal ID of a project’s merge request

Returns:

  • (Integer)

    the current value of iid



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def iid
  @iid
end

#importedBoolean

If the merge request was imported or not

Returns:

  • (Boolean)

    the current value of imported



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def imported
  @imported
end

#imported_fromString

Returns the current value of imported_from.

Returns:

  • (String)

    the current value of imported_from



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def imported_from
  @imported_from
end

#labelsArray

Comma-separated list of label names

Returns:

  • (Array)

    the current value of labels



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def labels
  @labels
end

#merge_afterString

Date after which the merge request can be merged

Returns:

  • (String)

    the current value of merge_after



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def merge_after
  @merge_after
end

#merge_commit_shaString

SHA of the merge request commit; returns null until merged

Returns:

  • (String)

    the current value of merge_commit_sha



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def merge_commit_sha
  @merge_commit_sha
end

#merge_statusString

Status of the merge request; can be unchecked, checking, can_be_merged, cannot_be_merged, or cannot_be_merged_recheck. Affects the has_conflicts property

Returns:

  • (String)

    the current value of merge_status



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def merge_status
  @merge_status
end

#merge_userString

The user who merged this merge request, the user who set it to auto-merge, or null

Returns:

  • (String)

    the current value of merge_user



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def merge_user
  @merge_user
end

#merge_when_pipeline_succeedsBoolean

Indicates if the merge is set to merge when its pipeline succeeds

Returns:

  • (Boolean)

    the current value of merge_when_pipeline_succeeds



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def merge_when_pipeline_succeeds
  @merge_when_pipeline_succeeds
end

#merged_atString

The timestamp the merge request was merged

Returns:

  • (String)

    the current value of merged_at



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def merged_at
  @merged_at
end

#milestoneHash

The milestone the merge request is attached to

Returns:

  • (Hash)

    the current value of milestone



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def milestone
  @milestone
end

#prepared_atString

Timestamp of when the merge request was prepared; this field populates one time, only after all the preparation steps complete, and is not updated if more changes are added

Returns:

  • (String)

    the current value of prepared_at



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def prepared_at
  @prepared_at
end

#project_idInteger

The ID of the project the merge request is within

Returns:

  • (Integer)

    the current value of project_id



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def project_id
  @project_id
end

#referencesHash

Reference tags for the merge request

Returns:

  • (Hash)

    the current value of references



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def references
  @references
end

#reviewersArray

Reviewers of the merge request

Returns:

  • (Array)

    the current value of reviewers



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def reviewers
  @reviewers
end

#shaString

Diff head SHA of the merge request

Returns:

  • (String)

    the current value of sha



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def sha
  @sha
end

#should_remove_source_branchBoolean

Indicates if the source branch of the merge request should be deleted after merge

Returns:

  • (Boolean)

    the current value of should_remove_source_branch



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def should_remove_source_branch
  @should_remove_source_branch
end

#source_branchString

Source branch of the merge request

Returns:

  • (String)

    the current value of source_branch



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def source_branch
  @source_branch
end

#source_project_idInteger

ID of the merge request source project

Returns:

  • (Integer)

    the current value of source_project_id



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def source_project_id
  @source_project_id
end

#squashBoolean

Indicates if squash on merge is enabled

Returns:

  • (Boolean)

    the current value of squash



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def squash
  @squash
end

#squash_commit_shaString

SHA of the squash commit; empty until merged.

Returns:

  • (String)

    the current value of squash_commit_sha



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def squash_commit_sha
  @squash_commit_sha
end

#stateString

The current state of the merge request

Returns:

  • (String)

    the current value of state



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def state
  @state
end

#target_branchString

Target branch of the merge request

Returns:

  • (String)

    the current value of target_branch



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def target_branch
  @target_branch
end

#target_project_idInteger

ID of the merge request target project

Returns:

  • (Integer)

    the current value of target_project_id



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def target_project_id
  @target_project_id
end

#task_completion_statusHash

Information on the task status of a merge request

Returns:

  • (Hash)

    the current value of task_completion_status



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def task_completion_status
  @task_completion_status
end

#time_statsHash

Information on the time spent on the merge request

Returns:

  • (Hash)

    the current value of time_stats



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def time_stats
  @time_stats
end

#titleString

The mnerge request title

Returns:

  • (String)

    the current value of title



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def title
  @title
end

#updated_atString

The timestamp of when the merge request was last updated

Returns:

  • (String)

    the current value of updated_at



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def updated_at
  @updated_at
end

#upvotesInteger

The number of upvotes on a merge request

Returns:

  • (Integer)

    the current value of upvotes



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def upvotes
  @upvotes
end

#user_notes_countInteger

The number of notes on the merge request

Returns:

  • (Integer)

    the current value of user_notes_count



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def user_notes_count
  @user_notes_count
end

#web_urlString

The URL of the merge request

Returns:

  • (String)

    the current value of web_url



64
65
66
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 64

def web_url
  @web_url
end

Class Method Details

.get(object) ⇒ Object

Locates a specific merge request in the GitLab system

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

mr = SupportOps::GitLab::MergeRequests.get(987654)
pp mr.title
# => "Awesome merge request"
pp mr.id
# => 28
pp mr.project_id
# => 123456
require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

mr = SupportOps::GitLab::MergeRequests.get(iid: 28, project_id: 123456)
pp mr.title
# => "Awesome merge request"
pp mr.id
# => 987654

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



339
340
341
342
343
344
345
346
347
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 339

def self.get(object)
  if object.is_a? MergeRequests
    MergeRequests.new(id: id).find
  elsif object.is_a? Hash
    MergeRequests.new({ id: object[:id], iid: object[:iid], project_id: object[:project_id] }).find
  else
    MergeRequests.new(id: object).find
  end
end

.get!(object) ⇒ Object

Locates a specific merge request in the GitLab system

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

mr = SupportOps::GitLab::MergeRequests.get!(987654)
pp mr.title
# => "Awesome merge request"
pp mr.id
# => 28
pp mr.project_id
# => 123456
require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.com/api/v4'
  config.token = 'abc123'
end

mr = SupportOps::GitLab::MergeRequests.get!(iid: 28, project_id: 123456)
pp mr.title
# => "Awesome merge request"
pp mr.id
# => 987654

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



386
387
388
389
390
391
392
393
394
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 386

def self.get!(object)
  if object.is_a? MergeRequests
    MergeRequests.new(id: id).find!
  elsif object.is_a? Hash
    MergeRequests.new({ id: object[:id], iid: object[:iid], project_id: object[:project_id] }).find!
  else
    MergeRequests.new(id: object).find!
  end
end

.list(key: value) ⇒ Array

Lists issues

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.url = 'https://gitlab.example.com/api/v4'
  config.token = 'abc123'
end

mrs = SupportOps::GitLab::MergeRequests.list(project_id: 123456)
pp mrs.count
# => 30
pp mrs.last.due_date
# => "2018-07-31"

Parameters:

  • approved (String optional)

    Filters merge requests by their approved status; ‘yes’ returns only approved merge requests; ‘no’ returns only non-approved merge requests; requires the mr_approved_filter feature flag, disabled by default

  • approved_by_ids (Array optional)

    Returns the merge requests approved by all the users with the given id, up to 5 users; ‘None’ returns merge requests with no approvals; ‘Any’ returns merge requests with an approval

  • approved_by_usernames (Array optional)

    Returns the merge requests approved by all the users with the given username, up to 5 users; ‘None’ returns merge requests with no approvals; ‘Any’ returns merge requests with an approval

  • approver_ids (Array optional)

    Returns merge requests which have specified all the users with the given id as individual approvers; ‘None’ returns merge requests without approvers; ‘Any’ returns merge requests with an approver

  • assignee_id (Integer optional)

    Returns merge requests assigned to the given user id; ‘None’ returns unassigned merge requests; ‘Any’ returns merge requests with an assignee

  • author_id (Integer optional)

    Returns merge requests created by the given user id; mutually exclusive with author_username

  • author_username (String optional)

    Returns merge requests created by the given username; mutually exclusive with author_id

  • created_after (String optional)

    Returns merge requests created on or after the given time; expected in ISO 8601 format (2019-03-15T08:00:00Z)

  • created_before (String optional)

    Returns merge requests created on or before the given time; expected in ISO 8601 format (2019-03-15T08:00:00Z)

  • labels (String optional)

    Returns merge requests matching a comma-separated list of labels; ‘None’ lists all merge requests with no labels; ‘Any’ lists all merge requests with at least one label; predefined names are case-insensitive

  • merge_user_id (Integer optional)

    Returns merge requests merged by the user with the given user id; mutually exclusive with merge_user_username

  • merge_user_username (String optional)

    Returns merge requests merged by the user with the given username; mutually exclusive with merge_user_id

  • milestone (String optional)

    Returns merge requests for a specific milestone; ‘None’ returns merge requests with no milestone; ‘Any’ returns merge requests that have an assigned milestone

  • my_reaction_emoji (String optional)

    Returns merge requests reacted by the authenticated user by the given emoji; ‘None’ returns issues not given a reaction; ‘Any’ returns issues given at least one reaction

  • non_archived (Boolean optional)

    Returns merge requests from non archived projects only

  • order_by (String optional)

    Returns merge requests ordered by created_at, title or updated_at fields

  • project_id (Integer optional)

    The project to scope the list to (not providing it scopes it to the whole instance)

  • reviewer_id (Integer optional)

    Returns merge requests which have the user as a reviewer with the given user id; ‘None’ returns merge requests with no reviewers; ‘Any’ returns merge requests with any reviewer; mutually exclusive with reviewer_username

  • reviewer_username (String optional)

    Returns merge requests which have the user as a reviewer with the given username; ‘None’ returns merge requests with no reviewers; ‘Any’ returns merge requests with any reviewer; mutually exclusive with reviewer_id

  • scope (String optional)

    Returns merge requests for the given scope: created_by_me, assigned_to_me or all

  • search (String optional)

    Search merge requests against their title and description

  • sort (String optional)

    Returns merge requests sorted in asc or desc order

  • source_branch (String optional)

    Returns merge requests with the given source branch

  • state (String optional)

    Returns all merge requests (all) or just those that are opened, closed, locked, or merged

  • target_branch (String optional)

    Returns merge requests with the given target branch

  • updated_after (String optional)

    Returns merge requests updated on or after the given time; expected in ISO 8601 format (2019-03-15T08:00:00Z)

  • updated_before (String optional)

    Returns merge requests updated on or before the given time; expected in ISO 8601 format (2019-03-15T08:00:00Z)

  • limit (Integer optional)

    The limit to the number of users returned. Default to 0 (i.e. no limit)

Returns:

  • (Array)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 224

def self.list(**args)
  args[:approved] = nil unless args[:approved]
  args[:approved_by_ids] = nil unless args[:approved_by_ids]
  args[:approved_by_usernames] = nil unless args[:approved_by_usernames]
  args[:approver_ids] = nil unless args[:approver_ids]
  args[:assignee_id] = nil unless args[:assignee_id]
  args[:author_id] = nil unless args[:author_id]
  args[:author_username] = nil unless args[:author_username]
  args[:created_after] = nil unless args[:created_after]
  args[:created_before] = nil unless args[:created_before]
  args[:labels] = nil unless args[:labels]
  args[:merge_user_id] = nil unless args[:merge_user_id]
  args[:merge_user_username] = nil unless args[:merge_user_username]
  args[:milestone] = nil unless args[:milestone]
  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[:reviewer_id] = nil unless args[:reviewer_id]
  args[:reviewer_username] = nil unless args[:reviewer_username]
  args[:scope] = nil unless args[:scope]
  args[:search] = nil unless args[:search]
  args[:sort] = nil unless args[:sort]
  args[:source_branch] = nil unless args[:source_branch]
  args[:state] = nil unless args[:state]
  args[:target_branch] = nil unless args[:target_branch]
  args[:updated_after] = nil unless args[:updated_after]
  args[:updated_before] = nil unless args[:updated_before]
  args[:limit] = 0 unless args[:limit]
  params = ''
  params += "approved=#{args[:approved]}&" unless args[:approved].nil?
  params += "approved_by_ids=#{args[:approved_by_ids]}&" unless args[:approved_by_ids].nil?
  params += "approved_by_usernames=#{args[:approved_by_usernames]}&" unless args[:approved_by_usernames].nil?
  params += "approver_ids=#{args[:approver_ids]}&" unless args[:approver_ids].nil?
  params += "assignee_id=#{args[:assignee_id]}&" unless args[:assignee_id].nil?
  params += "author_id=#{args[:author_id]}&" unless args[:author_id].nil?
  params += "author_username=#{args[:author_username]}&" unless args[:author_username].nil?
  params += "created_after=#{args[:created_after]}&" unless args[:created_after].nil?
  params += "created_before=#{args[:created_before]}&" unless args[:created_before].nil?
  params += "labels=#{args[:labels]}&" unless args[:labels].nil?
  params += "merge_user_id=#{args[:merge_user_id]}&" unless args[:merge_user_id].nil?
  params += "merge_user_username=#{args[:merge_user_username]}&" unless args[:merge_user_username].nil?
  params += "milestone=#{args[:milestone]}&" unless args[:milestone].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 += "project_id=#{args[:project_id]}&" unless args[:project_id].nil?
  params += "reviewer_id=#{args[:reviewer_id]}&" unless args[:reviewer_id].nil?
  params += "reviewer_username=#{args[:reviewer_username]}&" unless args[:reviewer_username].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 += "source_branch=#{args[:source_branch]}&" unless args[:source_branch].nil?
  params += "state=#{args[:state]}&" unless args[:state].nil?
  params += "target_branch=#{args[:target_branch]}&" unless args[:target_branch].nil?
  params += "updated_after=#{args[:updated_after]}&" unless args[:updated_after].nil?
  params += "updated_before=#{args[:updated_before]}&" unless args[:updated_before].nil?
  array = []
  page = 1
  base_url = if args[:project_id].nil?
               "merge_requests"
             else
              "projects/#{args[:project_id]}/merge_requests"
             end
  loop do
    response = client.connection.get("#{base_url}?#{params}&page=#{page}&per_page=100")
    body = Oj.load(response.body)
    array += body.map { |m| MergeRequests.new(m) }
    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

#diffsBoolean

Note:

This is inherited from Base#diffs

List diffs on a merge request

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_mr = SupportOps::GitLab::MergeRequests.get(iid: 28, project_id: 123456)
diffs = existing_mr.diffs
pp diffs.count
# => 3
pp diffs.first.diff
# => "@@ -17,10 +17,11..."

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.2.0



24
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 24

def diffs; end

#notesBoolean

Note:

This is inherited from Base#notes

List notes on a merge request

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_mr = SupportOps::GitLab::MergeRequests.get(iid: 28, project_id: 123456)
notes = existing_mr.notes
pp notes.count
# => 7

Returns:

  • (Boolean)

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



22
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 22

def notes; end

#subscribe!Object

Note:

This is inherited from Base#subscribe!

Subscribe to a merge request

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_mr = SupportOps::GitLab::MergeRequests.get(iid: 28, project_id: 123456)
existing_mr.subscribe!

Returns:

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 20

def subscribe!; end

#unsubscribe!Object

Note:

This is inherited from Base#unsubscribe!

Unsubscribe to a merge request

Examples:

require 'support_ops_gitlab'

SupportOps::GitLab::Configuration.configure do |config|
  config.token = ENV.fetch('GL_TOKEN')
  config.url = 'https://gitlab.com/api/v4'
end

existing_mr = SupportOps::GitLab::MergeRequests.get(iid: 28, project_id: 123456)
existing_mr.unsubscribe!

Returns:

See Also:

Author:

  • Jason Colyer

Since:

  • 1.0.0



20
# File 'lib/support_ops_gitlab/gitlab/merge_requests.rb', line 20

def unsubscribe!; end