@@ -16,84 +16,88 @@ def allowed_methods
16
16
end
17
17
18
18
def to_json
19
+ { _links : links } . to_json
20
+ end
21
+
22
+ def links
19
23
{
20
- _links : {
21
- 'self' =>
22
- {
23
- href : base_url ,
24
- title : 'Index' ,
25
- templated : false
26
- } ,
27
- 'pb:publish-pact' => {
28
- href : base_url + '/pacts/provider/{provider}/consumer/{consumer}/version/{consumerApplicationVersion} ',
29
- title : 'Publish a pact' ,
30
- templated : true
31
- } ,
32
- 'pb:latest-pact-versions' =>
33
- {
34
- href : base_url + '/pacts/latest ',
35
- title : 'Latest pact versions' ,
36
- templated : false
37
- } ,
38
- 'pb:pacticipants' =>
39
- {
40
- href : base_url + '/pacticipants ',
41
- title : 'Pacticipants' ,
42
- templated : false
43
- } ,
44
- 'pb:latest-provider-pacts' =>
45
- {
46
- href : base_url + '/ pacts/ provider/{provider}/latest ',
47
- title : 'Latest pacts by provider' ,
48
- templated : true
49
- } ,
50
- 'pb:latest-provider-pacts-with-tag' =>
51
- {
52
- href : base_url + '/ pacts/ provider/{provider}/latest/{ tag} ',
53
- title : 'Latest pacts for provider with the specified tag' ,
54
- templated : true
55
- } ,
56
- 'pb:provider-pacts-with-tag' =>
57
- {
58
- href : base_url + '/pacts/ provider/{provider}/ tag/{tag} ',
59
- title : 'All pact versions for the provider with the specified consumer version tag' ,
60
- templated : true
61
- } ,
62
- 'pb:provider-pacts' =>
63
- {
64
- href : base_url + '/pacts/ provider/{provider} ',
65
- title : 'All pact versions for the specified provider' ,
66
- templated : true
67
- } ,
68
- 'pb:wip-provider-pacts' =>
69
- {
70
- href : base_url + '/pacts/ provider/{provider}/wip ',
71
- title : 'WIP pact versions for the specified provider' ,
72
- templated : true
73
- } ,
74
- 'pb: latest-version' => {
75
- href : base_url + '/pacticipants/{ pacticipant}/latest- version',
76
- title : 'Latest pacticipant version' ,
77
- templated : true
78
- } ,
79
- 'pb: latest-tagged- version' => {
80
- href : base_url + '/pacticipants/{ pacticipant}/latest- version/{ tag} ',
81
- title : 'Latest pacticipant version with the specified tag' ,
82
- templated : true
83
- } ,
84
- 'pb:webhooks' => {
85
- href : base_url + '/webhooks ',
86
- title : 'Webhooks' ,
87
- templated : false
88
- } ,
89
- 'curies' =>
90
- [ {
91
- name : 'pb ',
92
- href : base_url + '/doc/{rel}?context=index' ,
93
- templated : true
94
- } ]
95
- }
96
- } . to_json
24
+ 'self' =>
25
+ {
26
+ href : base_url ,
27
+ title : 'Index' ,
28
+ templated : false
29
+ } ,
30
+ 'pb:publish-pact' => {
31
+ href : base_url + '/pacts/provider/{provider}/consumer/{consumer}/version/{consumerApplicationVersion}' ,
32
+ title : 'Publish a pact ',
33
+ templated : true
34
+ } ,
35
+ 'pb:latest-pact-versions' =>
36
+ {
37
+ href : base_url + '/pacts/latest' ,
38
+ title : 'Latest pact versions ',
39
+ templated : false
40
+ } ,
41
+ 'pb:pacticipants' =>
42
+ {
43
+ href : base_url + '/pacticipants' ,
44
+ title : 'Pacticipants ',
45
+ templated : false
46
+ } ,
47
+ 'pb:latest-provider-pacts' =>
48
+ {
49
+ href : base_url + '/pacts/provider/{provider}/latest' ,
50
+ title : 'Latest pacts by provider',
51
+ templated : true
52
+ } ,
53
+ 'pb:latest-provider-pacts-with-tag' =>
54
+ {
55
+ href : base_url + '/pacts/provider/{provider}/latest/{tag}' ,
56
+ title : 'Latest pacts for provider with the specified tag',
57
+ templated : true
58
+ } ,
59
+ 'pb:provider-pacts-with-tag' =>
60
+ {
61
+ href : base_url + '/pacts/provider/{provider}/tag/{tag}' ,
62
+ title : 'All pact versions for the provider with the specified consumer version tag',
63
+ templated : true
64
+ } ,
65
+ 'pb:provider-pacts' =>
66
+ {
67
+ href : base_url + '/pacts/provider/{provider}' ,
68
+ title : 'All pact versions for the specified provider',
69
+ templated : true
70
+ } ,
71
+ 'pb:wip-provider-pacts' =>
72
+ {
73
+ href : base_url + '/pacts/provider/{provider}/wip' ,
74
+ title : 'WIP pact versions for the specified provider',
75
+ templated : true
76
+ } ,
77
+ 'pb:latest-version' => {
78
+ href : base_url + '/pacticipants/{pacticipant}/ latest-version',
79
+ title : 'Latest pacticipant version',
80
+ templated : true
81
+ } ,
82
+ 'pb:latest-tagged-version' => {
83
+ href : base_url + '/pacticipants/{pacticipant}/ latest-version/{tag}' ,
84
+ title : 'Latest pacticipant version with the specified tag',
85
+ templated : true
86
+ } ,
87
+ 'pb:webhooks' => {
88
+ href : base_url + '/webhooks' ,
89
+ title : 'Webhooks ',
90
+ templated : false
91
+ } ,
92
+ 'curies' =>
93
+ [ {
94
+ name : 'pb' ,
95
+ href : base_url + '/doc/{rel}?context=index ',
96
+ templated : true
97
+ } ]
98
+ } . tap do | it |
99
+ it . delete ( 'pb:wip-provider-pacts' ) if ENV [ 'RACK_ENV' ] == 'production'
100
+ end
97
101
end
98
102
end
99
103
end
0 commit comments