summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/api/entities.rb25
-rw-r--r--spec/requests/api/issues_spec.rb1
-rw-r--r--spec/requests/api/merge_requests_spec.rb1
-rw-r--r--spec/requests/api/milestones_spec.rb1
4 files changed, 16 insertions, 12 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index b4771eecc7f..429083d75be 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -91,15 +91,16 @@ module API
expose :expires_at, :updated_at, :created_at
end
- class Milestone < Grape::Entity
- expose :id
- expose (:project_id) {|milestone| milestone.project.id}
+ class ProjectEntity < Grape::Entity
+ expose :id, :iid
+ expose (:project_id) { |entity| entity.project.id }
+ end
+
+ class Milestone < ProjectEntity
expose :title, :description, :due_date, :state, :updated_at, :created_at
end
- class Issue < Grape::Entity
- expose :id
- expose (:project_id) {|issue| issue.project.id}
+ class Issue < ProjectEntity
expose :title, :description
expose :label_list, as: :labels
expose :milestone, using: Entities::Milestone
@@ -107,14 +108,14 @@ module API
expose :state, :updated_at, :created_at
end
- class SSHKey < Grape::Entity
- expose :id, :title, :key, :created_at
+ class MergeRequest < ProjectEntity
+ expose :target_branch, :source_branch, :title, :state, :upvotes, :downvotes
+ expose :author, :assignee, using: Entities::UserBasic
+ expose :source_project_id, :target_project_id
end
- class MergeRequest < Grape::Entity
- expose :id, :target_branch, :source_branch, :title, :state, :upvotes, :downvotes
- expose :target_project_id, as: :project_id
- expose :author, :assignee, using: Entities::UserBasic
+ class SSHKey < Grape::Entity
+ expose :id, :title, :key, :created_at
end
class Note < Grape::Entity
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb
index a97d6a282a9..e9422cd2643 100644
--- a/spec/requests/api/issues_spec.rb
+++ b/spec/requests/api/issues_spec.rb
@@ -42,6 +42,7 @@ describe API::API do
get api("/projects/#{project.id}/issues/#{issue.id}", user)
response.status.should == 200
json_response['title'].should == issue.title
+ json_response['iid'].should == issue.iid
end
it "should return 404 if issue id not found" do
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb
index 2f11f562aa1..f31b4da90cd 100644
--- a/spec/requests/api/merge_requests_spec.rb
+++ b/spec/requests/api/merge_requests_spec.rb
@@ -34,6 +34,7 @@ describe API::API do
get api("/projects/#{project.id}/merge_request/#{merge_request.id}", user)
response.status.should == 200
json_response['title'].should == merge_request.title
+ json_response['iid'].should == merge_request.iid
end
it "should return a 404 error if merge_request_id not found" do
diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb
index 246fe262ce8..e79ce083a46 100644
--- a/spec/requests/api/milestones_spec.rb
+++ b/spec/requests/api/milestones_spec.rb
@@ -30,6 +30,7 @@ describe API::API do
get api("/projects/#{project.id}/milestones/#{milestone.id}", user)
response.status.should == 200
json_response['title'].should == milestone.title
+ json_response['iid'].should == milestone.iid
end
it "should return 401 error if user not authenticated" do