gitlab 2.2.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +3 -1
- data/LICENSE.txt +1 -1
- data/README.md +9 -1
- data/lib/gitlab.rb +7 -7
- data/lib/gitlab/api.rb +1 -1
- data/lib/gitlab/client.rb +9 -7
- data/lib/gitlab/client/groups.rb +88 -0
- data/lib/gitlab/client/issues.rb +13 -16
- data/lib/gitlab/client/merge_requests.rb +67 -5
- data/lib/gitlab/client/milestones.rb +6 -8
- data/lib/gitlab/client/notes.rb +106 -0
- data/lib/gitlab/client/projects.rb +98 -17
- data/lib/gitlab/client/repositories.rb +4 -6
- data/lib/gitlab/client/snippets.rb +22 -15
- data/lib/gitlab/configuration.rb +2 -1
- data/lib/gitlab/error.rb +9 -0
- data/lib/gitlab/request.rb +25 -20
- data/lib/gitlab/version.rb +1 -1
- data/spec/fixtures/comment_merge_request.json +1 -0
- data/spec/fixtures/create_merge_request.json +1 -0
- data/spec/fixtures/error_already_exists.json +1 -0
- data/spec/fixtures/group.json +60 -0
- data/spec/fixtures/group_create.json +1 -0
- data/spec/fixtures/group_member.json +1 -0
- data/spec/fixtures/group_member_delete.json +1 -0
- data/spec/fixtures/group_members.json +1 -0
- data/spec/fixtures/groups.json +2 -0
- data/spec/fixtures/note.json +1 -0
- data/spec/fixtures/notes.json +1 -0
- data/spec/fixtures/project.json +1 -1
- data/spec/fixtures/project_delete_key.json +8 -0
- data/spec/fixtures/project_for_user.json +1 -0
- data/spec/fixtures/project_fork_link.json +1 -0
- data/spec/fixtures/project_key.json +6 -0
- data/spec/fixtures/project_keys.json +6 -0
- data/spec/fixtures/update_merge_request.json +1 -0
- data/spec/gitlab/client/groups_spec.rb +111 -0
- data/spec/gitlab/client/issues_spec.rb +2 -2
- data/spec/gitlab/client/merge_requests_spec.rb +57 -0
- data/spec/gitlab/client/notes_spec.rb +156 -0
- data/spec/gitlab/client/projects_spec.rb +97 -2
- data/spec/gitlab/client/users_spec.rb +20 -9
- data/spec/gitlab_spec.rb +7 -0
- data/spec/spec_helper.rb +2 -2
- metadata +55 -31
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e73d6232b1c15dcf05f0b58e12e4d93ca076d210
|
4
|
+
data.tar.gz: b8e227455c58f3195448c2712b0ea6f1e3d56ade
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e624e3813e30c96657d5810788dc56bcf032b8f132a8a36a88ad3a7a13aa9a42f2c7bf3f61a47c9c21c5013dc09327e79d305db7a67f985530a6998c5e94da95
|
7
|
+
data.tar.gz: d118ef1b86f69311740d79e0f74390c8041e2c8a5b96345ed0edb52bbbc5bfa243fd380b8e8106eeaf71d28114968aeac879938ec5a76aa399d4adb2c075b47d
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Gitlab
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://travis-ci.org/NARKOZ/gitlab.png)](http://travis-ci.org/NARKOZ/gitlab)
|
4
4
|
|
5
5
|
Gitlab is a Ruby wrapper for the [GitLab API](https://github.com/gitlabhq/gitlabhq/tree/master/doc/api#gitlab-api).
|
6
6
|
|
@@ -57,6 +57,14 @@ user = g.user
|
|
57
57
|
# get a user's email
|
58
58
|
user.email
|
59
59
|
# => "john@example.com"
|
60
|
+
|
61
|
+
# set a sudo mode to perform API calls as another user
|
62
|
+
Gitlab.sudo = 'other_user'
|
63
|
+
# => "other_user"
|
64
|
+
|
65
|
+
# disable a sudo mode
|
66
|
+
Gitlab.sudo = nil
|
67
|
+
# => nil
|
60
68
|
```
|
61
69
|
|
62
70
|
For more information, refer to [documentation](http://rubydoc.info/gems/gitlab/frames).
|
data/lib/gitlab.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
1
|
+
require 'gitlab/version'
|
2
|
+
require 'gitlab/objectified_hash'
|
3
|
+
require 'gitlab/configuration'
|
4
|
+
require 'gitlab/error'
|
5
|
+
require 'gitlab/request'
|
6
|
+
require 'gitlab/api'
|
7
|
+
require 'gitlab/client'
|
8
8
|
|
9
9
|
module Gitlab
|
10
10
|
extend Configuration
|
data/lib/gitlab/api.rb
CHANGED
data/lib/gitlab/client.rb
CHANGED
@@ -3,12 +3,14 @@ module Gitlab
|
|
3
3
|
class Client < API
|
4
4
|
Dir[File.expand_path('../client/*.rb', __FILE__)].each{|f| require f}
|
5
5
|
|
6
|
-
include
|
7
|
-
include
|
8
|
-
include
|
9
|
-
include
|
10
|
-
include
|
11
|
-
include
|
12
|
-
include
|
6
|
+
include Users
|
7
|
+
include Issues
|
8
|
+
include Notes
|
9
|
+
include Milestones
|
10
|
+
include Snippets
|
11
|
+
include Projects
|
12
|
+
include Repositories
|
13
|
+
include MergeRequests
|
14
|
+
include Groups
|
13
15
|
end
|
14
16
|
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to groups.
|
3
|
+
module Groups
|
4
|
+
# Gets a list of groups.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
# Gitlab.groups
|
8
|
+
# Gitlab.groups(:per_page => 40)
|
9
|
+
#
|
10
|
+
# @param [Hash] options A customizable set of options.
|
11
|
+
# @option options [Integer] :page The page number.
|
12
|
+
# @option options [Integer] :per_page The number of results per page.
|
13
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
14
|
+
def groups(options={})
|
15
|
+
get("/groups", :query => options)
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gets a single group.
|
19
|
+
#
|
20
|
+
# @example
|
21
|
+
# Gitlab.group(42)
|
22
|
+
#
|
23
|
+
# @param [Integer] id The ID of a group.
|
24
|
+
# @return [Gitlab::ObjectifiedHash]
|
25
|
+
def group(id)
|
26
|
+
get("/groups/#{id}")
|
27
|
+
end
|
28
|
+
|
29
|
+
# Creates a new group.
|
30
|
+
#
|
31
|
+
# @param [String] name The name of a group.
|
32
|
+
# @param [String] path The path of a group.
|
33
|
+
# @return [Gitlab::ObjectifiedHash] Information about created group.
|
34
|
+
def create_group(name, path)
|
35
|
+
body = {:name => name, :path => path}
|
36
|
+
post("/groups", :body => body)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Get a list of group members.
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# Gitlab.group_members(1)
|
43
|
+
# Gitlab.group_members(1, :per_page => 40)
|
44
|
+
#
|
45
|
+
# @param [Integer] id The ID of a group.
|
46
|
+
# @param [Hash] options A customizable set of options.
|
47
|
+
# @option options [Integer] :page The page number.
|
48
|
+
# @option options [Integer] :per_page The number of results per page.
|
49
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
50
|
+
def group_members(id, options={})
|
51
|
+
get("/groups/#{id}/members", :query => options)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Adds a user to group.
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# Gitlab.add_group_member(1, 2, 40)
|
58
|
+
#
|
59
|
+
# @param [Integer] team_id The group id to add a member to.
|
60
|
+
# @param [Integer] user_id The user id of the user to add to the team.
|
61
|
+
# @param [Integer] access_level Project access level.
|
62
|
+
# @return [Gitlab::ObjectifiedHash] Information about added team member.
|
63
|
+
def add_group_member(team_id, user_id, access_level)
|
64
|
+
post("/groups/#{team_id}/members", :body => {:user_id => user_id, :access_level => access_level})
|
65
|
+
end
|
66
|
+
|
67
|
+
# Removes user from user group.
|
68
|
+
#
|
69
|
+
# @example
|
70
|
+
# Gitlab.remove_group_member(1, 2)
|
71
|
+
#
|
72
|
+
# @param [Integer] team_id The group ID.
|
73
|
+
# @param [Integer] user_id The ID of a user.
|
74
|
+
# @return [Gitlab::ObjectifiedHash] Information about removed team member.
|
75
|
+
def remove_group_member(team_id, user_id)
|
76
|
+
delete("/groups/#{team_id}/members/#{user_id}")
|
77
|
+
end
|
78
|
+
|
79
|
+
# Transfers a project to a group
|
80
|
+
#
|
81
|
+
# @param [Integer] id The ID of a group.
|
82
|
+
# @param [Integer] project_id The ID of a project.
|
83
|
+
def transfer_project_to_group(id, project_id)
|
84
|
+
body = {:id => id, :project_id => project_id}
|
85
|
+
post("/groups/#{id}/projects/#{project_id}", :body => body)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/gitlab/client/issues.rb
CHANGED
@@ -2,14 +2,14 @@ class Gitlab::Client
|
|
2
2
|
# Defines methods related to issues.
|
3
3
|
module Issues
|
4
4
|
# Gets a list of user's issues.
|
5
|
-
# Will return a list of project's issues if project ID
|
5
|
+
# Will return a list of project's issues if project ID passed.
|
6
6
|
#
|
7
7
|
# @example
|
8
8
|
# Gitlab.issues
|
9
9
|
# Gitlab.issues(5)
|
10
|
-
# Gitlab.issues(
|
10
|
+
# Gitlab.issues(:per_page => 40)
|
11
11
|
#
|
12
|
-
# @param [Integer
|
12
|
+
# @param [Integer] project The ID of a project.
|
13
13
|
# @param [Hash] options A customizable set of options.
|
14
14
|
# @option options [Integer] :page The page number.
|
15
15
|
# @option options [Integer] :per_page The number of results per page.
|
@@ -25,19 +25,18 @@ class Gitlab::Client
|
|
25
25
|
# Gets a single issue.
|
26
26
|
#
|
27
27
|
# @example
|
28
|
-
# Gitlab.issue(5,
|
29
|
-
# Gitlab.issue('gitlab', 42)
|
28
|
+
# Gitlab.issue(5, 42)
|
30
29
|
#
|
31
|
-
# @param [Integer
|
30
|
+
# @param [Integer] project The ID of a project.
|
32
31
|
# @param [Integer] id The ID of an issue.
|
33
|
-
# @return [
|
32
|
+
# @return [Gitlab::ObjectifiedHash]
|
34
33
|
def issue(project, id)
|
35
34
|
get("/projects/#{project}/issues/#{id}")
|
36
35
|
end
|
37
36
|
|
38
37
|
# Creates a new issue.
|
39
38
|
#
|
40
|
-
# @param [Integer
|
39
|
+
# @param [Integer] project The ID of a project.
|
41
40
|
# @param [String] title The title of an issue.
|
42
41
|
# @param [Hash] options A customizable set of options.
|
43
42
|
# @option options [String] :description The description of an issue.
|
@@ -52,7 +51,7 @@ class Gitlab::Client
|
|
52
51
|
|
53
52
|
# Updates an issue.
|
54
53
|
#
|
55
|
-
# @param [Integer
|
54
|
+
# @param [Integer] project The ID of a project.
|
56
55
|
# @param [Integer] id The ID of an issue.
|
57
56
|
# @param [Hash] options A customizable set of options.
|
58
57
|
# @option options [String] :title The title of an issue.
|
@@ -60,7 +59,7 @@ class Gitlab::Client
|
|
60
59
|
# @option options [Integer] :assignee_id The ID of a user to assign issue.
|
61
60
|
# @option options [Integer] :milestone_id The ID of a milestone to assign issue.
|
62
61
|
# @option options [String] :labels Comma-separated label names for an issue.
|
63
|
-
# @option options [
|
62
|
+
# @option options [String] :state_event The state event of an issue ('close' or 'reopen').
|
64
63
|
# @return [Gitlab::ObjectifiedHash] Information about updated issue.
|
65
64
|
def edit_issue(project, id, options={})
|
66
65
|
put("/projects/#{project}/issues/#{id}", :body => options)
|
@@ -70,26 +69,24 @@ class Gitlab::Client
|
|
70
69
|
#
|
71
70
|
# @example
|
72
71
|
# Gitlab.close_issue(3, 42)
|
73
|
-
# Gitlab.close_issue('gitlab', 42)
|
74
72
|
#
|
75
|
-
# @param [Integer
|
73
|
+
# @param [Integer] project The ID of a project.
|
76
74
|
# @param [Integer] id The ID of an issue.
|
77
75
|
# @return [Gitlab::ObjectifiedHash] Information about closed issue.
|
78
76
|
def close_issue(project, id)
|
79
|
-
put("/projects/#{project}/issues/#{id}", :body => {:
|
77
|
+
put("/projects/#{project}/issues/#{id}", :body => {:state_event => 'close'})
|
80
78
|
end
|
81
79
|
|
82
80
|
# Reopens an issue.
|
83
81
|
#
|
84
82
|
# @example
|
85
83
|
# Gitlab.reopen_issue(3, 42)
|
86
|
-
# Gitlab.reopen_issue('gitlab', 42)
|
87
84
|
#
|
88
|
-
# @param [Integer
|
85
|
+
# @param [Integer] project The ID of a project.
|
89
86
|
# @param [Integer] id The ID of an issue.
|
90
87
|
# @return [Gitlab::ObjectifiedHash] Information about reopened issue.
|
91
88
|
def reopen_issue(project, id)
|
92
|
-
put("/projects/#{project}/issues/#{id}", :body => {:
|
89
|
+
put("/projects/#{project}/issues/#{id}", :body => {:state_event => 'reopen'})
|
93
90
|
end
|
94
91
|
end
|
95
92
|
end
|
@@ -5,9 +5,9 @@ class Gitlab::Client
|
|
5
5
|
#
|
6
6
|
# @example
|
7
7
|
# Gitlab.merge_requests(5)
|
8
|
-
# Gitlab.merge_requests(
|
8
|
+
# Gitlab.merge_requests(:per_page => 40)
|
9
9
|
#
|
10
|
-
# @param [Integer
|
10
|
+
# @param [Integer] project The ID of a project.
|
11
11
|
# @param [Hash] options A customizable set of options.
|
12
12
|
# @option options [Integer] :page The page number.
|
13
13
|
# @option options [Integer] :per_page The number of results per page.
|
@@ -20,13 +20,75 @@ class Gitlab::Client
|
|
20
20
|
#
|
21
21
|
# @example
|
22
22
|
# Gitlab.merge_request(5, 36)
|
23
|
-
# Gitlab.merge_request('gitlab', 42)
|
24
23
|
#
|
25
|
-
# @param [Integer
|
24
|
+
# @param [Integer] project The ID of a project.
|
26
25
|
# @param [Integer] id The ID of a merge request.
|
27
|
-
# @return
|
26
|
+
# @return <Gitlab::ObjectifiedHash]
|
28
27
|
def merge_request(project, id)
|
29
28
|
get("/projects/#{project}/merge_request/#{id}")
|
30
29
|
end
|
30
|
+
|
31
|
+
# Creates a merge request.
|
32
|
+
#
|
33
|
+
# @example
|
34
|
+
# Gitlab.create_merge_request(5, 'New merge request',
|
35
|
+
# :source_branch => 'source_branch', :target_branch => 'target_branch')
|
36
|
+
# Gitlab.create_merge_request(5, 'New merge request',
|
37
|
+
# :source_branch => 'source_branch', :target_branch => 'target_branch', :assignee_id => 42)
|
38
|
+
#
|
39
|
+
# @param [Integer] project The ID of a project.
|
40
|
+
# @param [String] title The title of a merge request.
|
41
|
+
# @param [Hash] options A customizable set of options.
|
42
|
+
# @option options [String] :source_branch (required) The source branch name.
|
43
|
+
# @option options [String] :target_branch (required) The target branch name.
|
44
|
+
# @option options [Integer] :assignee_id (optional) The ID of a user to assign merge request.
|
45
|
+
# @return [Gitlab::ObjectifiedHash] Information about created merge request.
|
46
|
+
def create_merge_request(project, title, options={})
|
47
|
+
check_attributes!(options, [:source_branch, :target_branch])
|
48
|
+
|
49
|
+
body = {:title => title}.merge(options)
|
50
|
+
post("/projects/#{project}/merge_requests", :body => body)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Updates a merge request.
|
54
|
+
#
|
55
|
+
# @example
|
56
|
+
# Gitlab.update_merge_request(5, 42, :title => 'New title')
|
57
|
+
#
|
58
|
+
# @param [Integer] project The ID of a project.
|
59
|
+
# @param [Integer] id The ID of a merge request.
|
60
|
+
# @param [Hash] options A customizable set of options.
|
61
|
+
# @option options [String] :title The title of a merge request.
|
62
|
+
# @option options [String] :source_branch The source branch name.
|
63
|
+
# @option options [String] :target_branch The target branch name.
|
64
|
+
# @option options [Integer] :assignee_id The ID of a user to assign merge request.
|
65
|
+
# @return [Gitlab::ObjectifiedHash] Information about updated merge request.
|
66
|
+
def update_merge_request(project, id, options={})
|
67
|
+
put("/projects/#{project}/merge_request/#{id}", :body => options)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Adds a comment to a merge request.
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# Gitlab.comment_merge_request(5, 1, "Awesome merge!")
|
74
|
+
# Gitlab.comment_merge_request('gitlab', 1, "Awesome merge!")
|
75
|
+
#
|
76
|
+
# @param [Integer] project The ID of a project.
|
77
|
+
# @param [Integer] id The ID of a merge request.
|
78
|
+
# @param [String] note The content of a comment.
|
79
|
+
# @return [Gitlab::ObjectifiedHash] Information about created merge request comment.
|
80
|
+
def create_merge_request_comment(project, id, note)
|
81
|
+
post("/projects/#{project}/merge_request/#{id}/comments", :body => {:note => note})
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def check_attributes!(options, attrs)
|
87
|
+
attrs.each do |attr|
|
88
|
+
unless options.has_key?(attr) || options.has_key?(attr.to_s)
|
89
|
+
raise Gitlab::Error::MissingAttributes.new("Missing '#{attr}' parameter")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
31
93
|
end
|
32
94
|
end
|
@@ -5,9 +5,8 @@ class Gitlab::Client
|
|
5
5
|
#
|
6
6
|
# @example
|
7
7
|
# Gitlab.milestones(5)
|
8
|
-
# Gitlab.milestones('gitlab')
|
9
8
|
#
|
10
|
-
# @param [Integer
|
9
|
+
# @param [Integer] project The ID of a project.
|
11
10
|
# @param [Hash] options A customizable set of options.
|
12
11
|
# @option options [Integer] :page The page number.
|
13
12
|
# @option options [Integer] :per_page The number of results per page.
|
@@ -20,18 +19,17 @@ class Gitlab::Client
|
|
20
19
|
#
|
21
20
|
# @example
|
22
21
|
# Gitlab.milestone(5, 36)
|
23
|
-
# Gitlab.milestone('gitlab', 42)
|
24
22
|
#
|
25
|
-
# @param [Integer, String] project The ID
|
23
|
+
# @param [Integer, String] project The ID of a project.
|
26
24
|
# @param [Integer] id The ID of a milestone.
|
27
|
-
# @return [
|
25
|
+
# @return [Gitlab::ObjectifiedHash]
|
28
26
|
def milestone(project, id)
|
29
27
|
get("/projects/#{project}/milestones/#{id}")
|
30
28
|
end
|
31
29
|
|
32
30
|
# Creates a new milestone.
|
33
31
|
#
|
34
|
-
# @param [Integer
|
32
|
+
# @param [Integer] project The ID of a project.
|
35
33
|
# @param [String] title The title of a milestone.
|
36
34
|
# @param [Hash] options A customizable set of options.
|
37
35
|
# @option options [String] :description The description of a milestone.
|
@@ -44,13 +42,13 @@ class Gitlab::Client
|
|
44
42
|
|
45
43
|
# Updates a milestone.
|
46
44
|
#
|
47
|
-
# @param [Integer
|
45
|
+
# @param [Integer] project The ID of a project.
|
48
46
|
# @param [Integer] id The ID of a milestone.
|
49
47
|
# @param [Hash] options A customizable set of options.
|
50
48
|
# @option options [String] :title The title of a milestone.
|
51
49
|
# @option options [String] :description The description of a milestone.
|
52
50
|
# @option options [String] :due_date The due date of a milestone.
|
53
|
-
# @option options [
|
51
|
+
# @option options [String] :state_event The state of a milestone ('close' or 'activate').
|
54
52
|
# @return [Gitlab::ObjectifiedHash] Information about updated milestone.
|
55
53
|
def edit_milestone(project, id, options={})
|
56
54
|
put("/projects/#{project}/milestones/#{id}", :body => options)
|
@@ -0,0 +1,106 @@
|
|
1
|
+
class Gitlab::Client
|
2
|
+
# Defines methods related to notes.
|
3
|
+
module Notes
|
4
|
+
# Gets a list of projects notes.
|
5
|
+
#
|
6
|
+
# @example
|
7
|
+
# Gitlab.notes(5)
|
8
|
+
#
|
9
|
+
# @param [Integer] project The ID of a project.
|
10
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
11
|
+
def notes(project)
|
12
|
+
get("/projects/#{project}/notes")
|
13
|
+
end
|
14
|
+
|
15
|
+
# Gets a list of notes for a issue.
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# Gitlab.issue_notes(5, 10)
|
19
|
+
#
|
20
|
+
# @param [Integer] project The ID of a project.
|
21
|
+
# @param [Integer] issue The ID of an issue.
|
22
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
23
|
+
def issue_notes(project, issue)
|
24
|
+
get("/projects/#{project}/issues/#{issue}/notes")
|
25
|
+
end
|
26
|
+
|
27
|
+
# Gets a list of notes for a snippet.
|
28
|
+
#
|
29
|
+
# @example
|
30
|
+
# Gitlab.snippet_notes(5, 1)
|
31
|
+
#
|
32
|
+
# @param [Integer] project The ID of a project.
|
33
|
+
# @param [Integer] snippet The ID of a snippet.
|
34
|
+
# @return [Array<Gitlab::ObjectifiedHash>]
|
35
|
+
def snippet_notes(project, snippet)
|
36
|
+
get("/projects/#{project}/snippets/#{snippet}/notes")
|
37
|
+
end
|
38
|
+
|
39
|
+
# Gets a single wall note.
|
40
|
+
#
|
41
|
+
# @example
|
42
|
+
# Gitlab.note(5, 15)
|
43
|
+
#
|
44
|
+
# @param [Integer] project The ID of a project.
|
45
|
+
# @param [Integer] id The ID of a note.
|
46
|
+
# @return [Gitlab::ObjectifiedHash]
|
47
|
+
def note(project, id)
|
48
|
+
get("/projects/#{project}/notes/#{id}")
|
49
|
+
end
|
50
|
+
|
51
|
+
# Gets a single issue note.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# Gitlab.issue_note(5, 10, 1)
|
55
|
+
#
|
56
|
+
# @param [Integer] project The ID of a project.
|
57
|
+
# @param [Integer] issue The ID of an issue.
|
58
|
+
# @param [Integer] id The ID of a note.
|
59
|
+
# @return [Gitlab::ObjectifiedHash]
|
60
|
+
def issue_note(project, issue, id)
|
61
|
+
get("/projects/#{project}/issues/#{issue}/notes/#{id}")
|
62
|
+
end
|
63
|
+
|
64
|
+
# Gets a single snippet note.
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# Gitlab.snippet_note(5, 11, 3)
|
68
|
+
#
|
69
|
+
# @param [Integer] project The ID of a project.
|
70
|
+
# @param [Integer] snippet The ID of a snippet.
|
71
|
+
# @param [Integer] id The ID of an note.
|
72
|
+
# @return [Gitlab::ObjectifiedHash]
|
73
|
+
def snippet_note(project, snippet, id)
|
74
|
+
get("/projects/#{project}/snippets/#{snippet}/notes/#{id}")
|
75
|
+
end
|
76
|
+
|
77
|
+
# Creates a new wall note.
|
78
|
+
#
|
79
|
+
# @param [Integer] project The ID of a project.
|
80
|
+
# @param [String] body The body of a note.
|
81
|
+
# @return [Gitlab::ObjectifiedHash] Information about created note.
|
82
|
+
def create_note(project, body)
|
83
|
+
post("/projects/#{project}/notes", :body => {:body => body})
|
84
|
+
end
|
85
|
+
|
86
|
+
# Creates a new issue note.
|
87
|
+
#
|
88
|
+
# @param [Integer] project The ID of a project.
|
89
|
+
# @param [Integer] issue The ID of an issue.
|
90
|
+
# @param [String] body The body of a note.
|
91
|
+
# @return [Gitlab::ObjectifiedHash] Information about created note.
|
92
|
+
def create_issue_note(project, issue, body)
|
93
|
+
post("/projects/#{project}/issues/#{issue}/notes", :body => {:body => body})
|
94
|
+
end
|
95
|
+
|
96
|
+
# Creates a new snippet note.
|
97
|
+
#
|
98
|
+
# @param [Integer] project The ID of a project.
|
99
|
+
# @param [Integer] snippet The ID of a snippet.
|
100
|
+
# @param [String] body The body of a note.
|
101
|
+
# @return [Gitlab::ObjectifiedHash] Information about created note.
|
102
|
+
def create_snippet_note(project, snippet, body)
|
103
|
+
post("/projects/#{project}/snippets/#{snippet}/notes", :body => {:body => body})
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|