summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-20 12:43:32 +0100
committerSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-20 12:43:32 +0100
commiteefb27f5ae0edf0c005eb8ce6da56cbd17c9aa8a (patch)
tree9dc7d17953ee7851e1934903b45faf5f18d860a2 /lib/api
parent1b97a2eee8b89320de891e3ae8496adfa7f3a84b (diff)
parentb7ac654b88aa9b03f431d93c25e397ff2bc66a7a (diff)
downloadgitlab-ce-eefb27f5ae0edf0c005eb8ce6da56cbd17c9aa8a.tar.gz
Merge branch 'master' into fixes/api
Conflicts: spec/requests/api/projects_spec.rb
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb11
-rw-r--r--lib/api/internal.rb4
-rw-r--r--lib/api/issues.rb4
-rw-r--r--lib/api/merge_requests.rb4
-rw-r--r--lib/api/milestones.rb4
-rw-r--r--lib/api/projects.rb1
6 files changed, 15 insertions, 13 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index c1873d87b55..1cae1d337fe 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -20,7 +20,7 @@ module Gitlab
class Project < Grape::Entity
expose :id, :name, :description, :default_branch
expose :owner, using: Entities::UserBasic
- expose :private_flag, as: :private
+ expose :public
expose :path, :path_with_namespace
expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at
expose :namespace
@@ -35,12 +35,11 @@ module Gitlab
class Group < Grape::Entity
expose :id, :name, :path, :owner_id
end
-
+
class GroupDetail < Group
expose :projects, using: Entities::Project
end
-
class RepoObject < Grape::Entity
expose :name, :commit
expose :protected do |repo, options|
@@ -63,7 +62,7 @@ module Gitlab
class Milestone < Grape::Entity
expose :id
expose (:project_id) {|milestone| milestone.project.id}
- expose :title, :description, :due_date, :closed, :updated_at, :created_at
+ expose :title, :description, :due_date, :state, :updated_at, :created_at
end
class Issue < Grape::Entity
@@ -73,7 +72,7 @@ module Gitlab
expose :label_list, as: :labels
expose :milestone, using: Entities::Milestone
expose :assignee, :author, using: Entities::UserBasic
- expose :closed, :updated_at, :created_at
+ expose :state, :updated_at, :created_at
end
class SSHKey < Grape::Entity
@@ -81,7 +80,7 @@ module Gitlab
end
class MergeRequest < Grape::Entity
- expose :id, :target_branch, :source_branch, :project_id, :title, :closed, :merged
+ expose :id, :target_branch, :source_branch, :project_id, :title, :state
expose :author, :assignee, using: Entities::UserBasic
end
diff --git a/lib/api/internal.rb b/lib/api/internal.rb
index 3e5e3a478ba..5d74a761c05 100644
--- a/lib/api/internal.rb
+++ b/lib/api/internal.rb
@@ -40,7 +40,9 @@ module Gitlab
get "/check" do
{
- api_version: '3'
+ api_version: Gitlab::API.version,
+ gitlab_version: Gitlab::VERSION,
+ gitlab_rev: Gitlab::REVISION,
}
end
end
diff --git a/lib/api/issues.rb b/lib/api/issues.rb
index 4d832fbe593..70bbf47e72c 100644
--- a/lib/api/issues.rb
+++ b/lib/api/issues.rb
@@ -69,14 +69,14 @@ module Gitlab
# assignee_id (optional) - The ID of a user to assign issue
# milestone_id (optional) - The ID of a milestone to assign issue
# labels (optional) - The labels of an issue
- # closed (optional) - The state of an issue (0 = false, 1 = true)
+ # state (optional) - The state of an issue (close|reopen)
# Example Request:
# PUT /projects/:id/issues/:issue_id
put ":id/issues/:issue_id" do
@issue = user_project.issues.find(params[:issue_id])
authorize! :modify_issue, @issue
- attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id, :closed]
+ attrs = attributes_for_keys [:title, :description, :assignee_id, :milestone_id, :state_event]
attrs[:label_list] = params[:labels] if params[:labels].present?
IssueObserver.current_user = current_user
if @issue.update_attributes attrs
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 0c18ece3824..4b28094f1a4 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -91,12 +91,12 @@ module Gitlab
# target_branch - The target branch
# assignee_id - Assignee user ID
# title - Title of MR
- # closed - Status of MR. true - closed
+ # state_event - Status of MR. (close|reopen|merge)
# Example:
# PUT /projects/:id/merge_request/:merge_request_id
#
put ":id/merge_request/:merge_request_id" do
- attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :closed]
+ attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event]
merge_request = user_project.merge_requests.find(params[:merge_request_id])
authorize! :modify_merge_request, merge_request
diff --git a/lib/api/milestones.rb b/lib/api/milestones.rb
index cdb0e14690d..7f8fe053ba1 100644
--- a/lib/api/milestones.rb
+++ b/lib/api/milestones.rb
@@ -74,14 +74,14 @@ module Gitlab
# title (optional) - The title of a milestone
# description (optional) - The description of a milestone
# due_date (optional) - The due date of a milestone
- # closed (optional) - The status of the milestone
+ # state (optional) - The status of the milestone (close|activate)
# Example Request:
# PUT /projects/:id/milestones/:milestone_id
put ":id/milestones/:milestone_id" do
authorize! :admin_milestone, user_project
@milestone = user_project.milestones.find(params[:milestone_id])
- attrs = attributes_for_keys [:title, :description, :due_date, :closed]
+ attrs = attributes_for_keys [:title, :description, :due_date, :state_event]
if @milestone.update_attributes attrs
present @milestone, with: Entities::Milestone
else
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index cf3e8257a77..d171acc1ce1 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -184,6 +184,7 @@ module Gitlab
# Example Request:
# GET /projects/:id/hooks/:hook_id
get ":id/hooks/:hook_id" do
+ authorize! :admin_project, user_project
@hook = user_project.hooks.find(params[:hook_id])
present @hook, with: Entities::Hook
end