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.93.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.92.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.91.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.90.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.89.1 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.89.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.88.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.87.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.86.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.85.1 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.85.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.84.0 lib/pact_broker/diagnostic/resources/base_resource.rb
pact_broker-2.83.0 lib/pact_broker/diagnostic/resources/base_resource.rb