Expose project_id on /api/v4/pages/domains

This commit is contained in:
Luc Didry 2018-01-03 17:32:34 +01:00
parent e5a9b9a14d
commit 78cdac8401
5 changed files with 10 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
title: Expose project_id on /api/v4/pages/domains
merge_request: 16200
author: Luc Didry
type: changed

View file

@ -21,6 +21,7 @@ curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/a
{
"domain": "ssl.domain.example",
"url": "https://ssl.domain.example",
"project_id": 1337,
"certificate": {
"expired": false,
"expiration": "2020-04-12T14:32:00.000Z"

View file

@ -1133,6 +1133,7 @@ module API
class PagesDomainBasic < Grape::Entity
expose :domain
expose :url
expose :project_id
expose :certificate,
as: :certificate_expiration,
if: ->(pages_domain, _) { pages_domain.certificate? },

View file

@ -3,6 +3,7 @@
"properties": {
"domain": { "type": "string" },
"url": { "type": "uri" },
"project_id": { "type": "integer" },
"certificate_expiration": {
"type": "object",
"properties": {
@ -13,6 +14,6 @@
"additionalProperties": false
}
},
"required": ["domain", "url"],
"required": ["domain", "url", "project_id"],
"additionalProperties": false
}

View file

@ -46,6 +46,7 @@ describe API::PagesDomains do
expect(json_response).to be_an Array
expect(json_response.size).to eq(3)
expect(json_response.last).to have_key('domain')
expect(json_response.last).to have_key('project_id')
expect(json_response.last).to have_key('certificate_expiration')
expect(json_response.last['certificate_expiration']['expired']).to be true
expect(json_response.first).not_to have_key('certificate_expiration')