Merge branch 'master' into fixes/api

Conflicts:
	spec/requests/api/projects_spec.rb
This commit is contained in:
Sebastian Ziebell 2013-02-20 12:43:32 +01:00
commit eefb27f5ae
134 changed files with 1116 additions and 859 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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