gitlab 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +3 -1
  4. data/LICENSE.txt +1 -1
  5. data/README.md +9 -1
  6. data/lib/gitlab.rb +7 -7
  7. data/lib/gitlab/api.rb +1 -1
  8. data/lib/gitlab/client.rb +9 -7
  9. data/lib/gitlab/client/groups.rb +88 -0
  10. data/lib/gitlab/client/issues.rb +13 -16
  11. data/lib/gitlab/client/merge_requests.rb +67 -5
  12. data/lib/gitlab/client/milestones.rb +6 -8
  13. data/lib/gitlab/client/notes.rb +106 -0
  14. data/lib/gitlab/client/projects.rb +98 -17
  15. data/lib/gitlab/client/repositories.rb +4 -6
  16. data/lib/gitlab/client/snippets.rb +22 -15
  17. data/lib/gitlab/configuration.rb +2 -1
  18. data/lib/gitlab/error.rb +9 -0
  19. data/lib/gitlab/request.rb +25 -20
  20. data/lib/gitlab/version.rb +1 -1
  21. data/spec/fixtures/comment_merge_request.json +1 -0
  22. data/spec/fixtures/create_merge_request.json +1 -0
  23. data/spec/fixtures/error_already_exists.json +1 -0
  24. data/spec/fixtures/group.json +60 -0
  25. data/spec/fixtures/group_create.json +1 -0
  26. data/spec/fixtures/group_member.json +1 -0
  27. data/spec/fixtures/group_member_delete.json +1 -0
  28. data/spec/fixtures/group_members.json +1 -0
  29. data/spec/fixtures/groups.json +2 -0
  30. data/spec/fixtures/note.json +1 -0
  31. data/spec/fixtures/notes.json +1 -0
  32. data/spec/fixtures/project.json +1 -1
  33. data/spec/fixtures/project_delete_key.json +8 -0
  34. data/spec/fixtures/project_for_user.json +1 -0
  35. data/spec/fixtures/project_fork_link.json +1 -0
  36. data/spec/fixtures/project_key.json +6 -0
  37. data/spec/fixtures/project_keys.json +6 -0
  38. data/spec/fixtures/update_merge_request.json +1 -0
  39. data/spec/gitlab/client/groups_spec.rb +111 -0
  40. data/spec/gitlab/client/issues_spec.rb +2 -2
  41. data/spec/gitlab/client/merge_requests_spec.rb +57 -0
  42. data/spec/gitlab/client/notes_spec.rb +156 -0
  43. data/spec/gitlab/client/projects_spec.rb +97 -2
  44. data/spec/gitlab/client/users_spec.rb +20 -9
  45. data/spec/gitlab_spec.rb +7 -0
  46. data/spec/spec_helper.rb +2 -2
  47. metadata +55 -31
@@ -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
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea
@@ -1,2 +1,4 @@
1
1
  language: ruby
2
- rvm: 1.9.3
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Nihad Abbasov / NARKOZ
1
+ Copyright (c) 2012-2013 Nihad Abbasov <mail@narkoz.me>
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Gitlab
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/NARKOZ/gitlab.png)](http://travis-ci.org/NARKOZ/gitlab)
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).
@@ -1,10 +1,10 @@
1
- require File.expand_path('../gitlab/version', __FILE__)
2
- require File.expand_path('../gitlab/objectified_hash', __FILE__)
3
- require File.expand_path('../gitlab/configuration', __FILE__)
4
- require File.expand_path('../gitlab/error', __FILE__)
5
- require File.expand_path('../gitlab/request', __FILE__)
6
- require File.expand_path('../gitlab/api', __FILE__)
7
- require File.expand_path('../gitlab/client', __FILE__)
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
@@ -11,7 +11,7 @@ module Gitlab
11
11
  Configuration::VALID_OPTIONS_KEYS.each do |key|
12
12
  send("#{key}=", options[key])
13
13
  end
14
- set_request_defaults @endpoint, @private_token
14
+ set_request_defaults @endpoint, @private_token, @sudo
15
15
  end
16
16
  end
17
17
  end
@@ -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 Gitlab::Client::Users
7
- include Gitlab::Client::Issues
8
- include Gitlab::Client::Milestones
9
- include Gitlab::Client::Snippets
10
- include Gitlab::Client::Projects
11
- include Gitlab::Client::Repositories
12
- include Gitlab::Client::MergeRequests
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
@@ -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 or code name passed.
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('gitlab', :per_page => 40)
10
+ # Gitlab.issues(:per_page => 40)
11
11
  #
12
- # @param [Integer, String] project The ID or code name of a project.
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, 36)
29
- # Gitlab.issue('gitlab', 42)
28
+ # Gitlab.issue(5, 42)
30
29
  #
31
- # @param [Integer, String] project The ID or code name of a project.
30
+ # @param [Integer] project The ID of a project.
32
31
  # @param [Integer] id The ID of an issue.
33
- # @return [Array<Gitlab::ObjectifiedHash>]
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, String] project The ID or code name of a project.
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, String] project The ID or code name of a project.
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 [Boolean] :closed The state of an issue (0 = false, 1 = true).
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, String] project The ID or code name of a project.
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 => {:closed => 1})
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, String] project The ID or code name of a project.
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 => {:closed => 0})
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('gitlab', :per_page => 40)
8
+ # Gitlab.merge_requests(:per_page => 40)
9
9
  #
10
- # @param [Integer, String] project The ID or code name of a project.
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, String] project The ID or code name of a project.
24
+ # @param [Integer] project The ID of a project.
26
25
  # @param [Integer] id The ID of a merge request.
27
- # @return [Array<Gitlab::ObjectifiedHash>]
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, String] project The ID or code name of a project.
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 or code name of a project.
23
+ # @param [Integer, String] project The ID of a project.
26
24
  # @param [Integer] id The ID of a milestone.
27
- # @return [Array<Gitlab::ObjectifiedHash>]
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, String] project The ID or code name of a project.
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, String] project The ID or code name of a project.
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 [Boolean] :closed The state of a milestone (0 = false, 1 = true).
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