Sha256: b5237e102d31f0eec4bc232d80b019ebf02c2a52e5700f99d75742f1ed7f0bad

Contents?: true

Size: 661 Bytes

Versions: 33

Compression:

Stored size: 661 Bytes

Contents

require "webmachine"
require "pact_broker/api/resources/authentication"

module PactBroker
  module Diagnostic
    module Resources
      class BaseResource < Webmachine::Resource

        include PactBroker::Api::Resources::Authentication

        def is_authorized?(authorization_header)
          authenticated?(self, authorization_header)
        end

        def forbidden?
          return false if PactBroker.configuration.authorize.nil?
          !PactBroker.configuration.authorize.call(self, {})
        end

        def base_url
          request.env["pactbroker.base_url"] || request.base_uri.to_s.chomp("/")
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
pact_broker-2.106.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.105.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.104.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.103.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.102.2 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.102.1 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.102.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.101.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.100.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.99.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.98.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.97.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.96.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.95.1 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.95.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.94.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.93.4 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.93.3 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.93.2 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.93.1 lib/pact_broker/diagnostic/resources/base_resource.rb