Sha256: 15be89c1b2e3c89b8db4be098a004acf6ff5c7e923df8befcfdb62972432dc04

Contents?: true

Size: 821 Bytes

Versions: 1

Compression:

Stored size: 821 Bytes

Contents

require 'pact_broker/api/resources/base_resource'
require 'pact_broker/configuration'
require 'pact_broker/api/decorators/versions_decorator'

module PactBroker
  module Api
    module Resources

      class Versions < BaseResource

        def content_types_provided
          [["application/json", :to_json]]
        end

        def allowed_methods
          ["GET"]
        end

        def resource_exists?
          pacticipant_service.find_pacticipant_by_name(pacticipant_name)
        end

        def to_json
          PactBroker::Api::Decorators::VersionsDecorator.new(versions).to_json(user_options: decorator_context(identifier_from_path))
        end

        def versions
          pacticipant_service.find_all_pacticipant_versions_in_reverse_order pacticipant_name
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-1.18.0 lib/pact_broker/api/resources/versions.rb