Sha256: 92ec2bcb15f01fb96ac2ad00847d56c0c0e84aa2888245ec3ee008fdc424bf22

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require 'pact_broker/api/resources/base_resource'
require 'json'

module PactBroker::Api

  module Resources

    class Index < BaseResource

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

      def allowed_methods
        ["GET"]
      end

      # TODO change to use request.base_url to avoid params getting included!!!
      def to_json
        {
          _links: {
            'index' => [
              {
                href: request.uri.to_s,
                title: 'The index page',
                templated: false
              }
            ],
            'latest-pacts' => [
              {
                href: request.uri.to_s + 'pacts/latest',
                title: 'Retrieve latest pacts',
                templated: false
              }
            ],
            'pacticpants' => [
              {
                href: request.uri.to_s + 'pacticipants',
                title: 'Retrieve pacticipants',
                templated: false
              }
            ]
          }
        }.to_json
      end

    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pact_broker-1.0.0 lib/pact_broker/api/resources/index.rb
pact_broker-1.0.0.alpha3 lib/pact_broker/api/resources/index.rb
pact_broker-1.0.0.alpha2 lib/pact_broker/api/resources/index.rb
pact_broker-1.0.0.alpha1 lib/pact_broker/api/resources/index.rb
pact_broker-0.0.10 lib/pact_broker/api/resources/index.rb
pact_broker-0.0.9 lib/pact_broker/api/resources/index.rb