File tree 2 files changed +15
-8
lines changed
lib/pact_broker/api/resources
2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change 1
1
require 'pact_broker/api/resources/base_resource'
2
2
require 'pact_broker/configuration'
3
+ require 'pact_broker/api/decorators/extended_pact_decorator'
3
4
4
5
module PactBroker
5
6
module Api
6
7
module Resources
7
-
8
8
class LatestPact < BaseResource
9
-
10
9
def content_types_provided
11
- [ [ "application/hal+json" , :to_json ] ,
10
+ [
11
+ [ "application/hal+json" , :to_json ] ,
12
12
[ "application/json" , :to_json ] ,
13
- [ "text/html" , :to_html ] ]
13
+ [ "text/html" , :to_html ] ,
14
+ [ "application/vnd.pactbrokerextended.v1+json" , :to_extended_json ]
15
+ ]
14
16
end
15
17
16
18
def allowed_methods
@@ -26,6 +28,10 @@ def to_json
26
28
PactBroker ::Api ::Decorators ::PactDecorator . new ( pact ) . to_json ( user_options : { base_url : base_url } )
27
29
end
28
30
31
+ def to_extended_json
32
+ PactBroker ::Api ::Decorators ::ExtendedPactDecorator . new ( pact ) . to_json ( user_options : decorator_context ( metadata : identifier_from_path [ :metadata ] ) )
33
+ end
34
+
29
35
def to_html
30
36
PactBroker . configuration . html_pact_renderer . call (
31
37
pact , {
Original file line number Diff line number Diff line change @@ -25,10 +25,11 @@ class Pact < BaseResource
25
25
include WebhookExecutionMethods
26
26
27
27
def content_types_provided
28
- [ [ "application/hal+json" , :to_json ] ,
29
- [ "application/json" , :to_json ] ,
30
- [ "text/html" , :to_html ] ,
31
- [ "application/vnd.pactbrokerextended.v1+json" , :to_extended_json ]
28
+ [
29
+ [ "application/hal+json" , :to_json ] ,
30
+ [ "application/json" , :to_json ] ,
31
+ [ "text/html" , :to_html ] ,
32
+ [ "application/vnd.pactbrokerextended.v1+json" , :to_extended_json ]
32
33
]
33
34
end
34
35
You can’t perform that action at this time.
0 commit comments