Sha256: c7e46d8e1dd713cea9366c01dd1bb0101cabfb3e34357faa8d7f66161bae43bb

Contents?: true

Size: 914 Bytes

Versions: 12

Compression:

Stored size: 914 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"]
        end

        def to_json
          PactBroker::Api::Decorators::DashboardDecorator.new(index_items).to_json(user_options: decorator_context)
        end

        def to_text
          PactBroker::Api::Decorators::DashboardTextDecorator.new(index_items).to_text(user_options: decorator_context)
        end

        private

        def index_items
          index_service.find_index_items(tags: true)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.23.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.22.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.21.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.20.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.19.2 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.19.1 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.19.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.18.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.17.1 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.17.0 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.16.1 lib/pact_broker/api/resources/dashboard.rb
pact_broker-2.16.0 lib/pact_broker/api/resources/dashboard.rb