Sha256: 9610c65b1c6600499677671d55f9f0e7a294d3a5cedf887c0af21bcc88981626

Contents?: true

Size: 965 Bytes

Versions: 9

Compression:

Stored size: 965 Bytes

Contents

require 'pact_broker/api/resources/base_resource'
require 'pact_broker/api/decorators/dashboard_decorator'
require 'pact_broker/api/decorators/dashboard_text_decorator'

module PactBroker
  module Api
    module Resources
      class Dashboard < BaseResource
        def content_types_provided
          [
            ["application/hal+json", :to_json],
            ["text/plain", :to_text],
          ]
        end

        def allowed_methods
          ["GET", "OPTIONS"]
        end

        def to_json
          decorator_class(:dashboard_decorator).new(index_items).to_json(decorator_options)
        end

        def to_text
          decorator_class(:dashboard_text_decorator).new(index_items).to_text(decorator_options)
        end

        def policy_name
          :'dashboard::dashboard'
        end

        private

        def index_items
          index_service.find_index_items_for_api(identifier_from_path)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.79.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.78.1 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.78.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.77.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.76.2 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.76.1 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.76.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.75.0 lib/pact_broker/api/resources/dashboard.rb