Sha256: b37b97ce5d89809d90149166897f2ddc62bb5886eaa1dca52487d4f2b4b96bb6

Contents?: true

Size: 735 Bytes

Versions: 12

Compression:

Stored size: 735 Bytes

Contents

# frozen_string_literal: true

module Dor
  module Services
    class Client
      # @abstract API calls to a versioned endpoint
      class VersionedService
        def initialize(connection:, version:)
          @connection = connection
          @api_version = version
        end

        # Common interface for handling asynchronous results
        def async_result(url:)
          AsyncResult.new(url: url)
        end

        private

        attr_reader :connection, :api_version

        def raise_exception_based_on_response!(response)
          raise (response.status == 404 ? NotFoundResponse : UnexpectedResponse),
                ResponseErrorFormatter.format(response: response)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dor-services-client-4.12.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.11.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.10.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.9.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.8.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.7.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.6.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.5.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.4.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.3.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.2.0 lib/dor/services/client/versioned_service.rb
dor-services-client-4.1.0 lib/dor/services/client/versioned_service.rb