lib/pact_broker/api/resources/integrations.rb in pact_broker-2.31.0 vs lib/pact_broker/api/resources/integrations.rb in pact_broker-2.32.0

- old
+ new

@@ -1,25 +1,33 @@ require 'pact_broker/api/resources/base_resource' require 'pact_broker/api/renderers/integrations_dot_renderer' +require 'pact_broker/api/decorators/integrations_decorator' module PactBroker module Api module Resources class Integrations < BaseResource def content_types_provided - [["text/vnd.graphviz", :to_dot]] + [ + ["text/vnd.graphviz", :to_dot], + ["application/hal+json", :to_json] + ] end def allowed_methods ["GET", "OPTIONS", "DELETE"] end def to_dot PactBroker::Api::Renderers::IntegrationsDotRenderer.call(integrations) end + def to_json + PactBroker::Api::Decorators::IntegrationsDecorator.new(integrations).to_json(user_options: decorator_context) + end + def integrations - pact_service.find_latest_pacts + integration_service.find_all end def delete_resource integration_service.delete(consumer_name, provider_name) true