Sha256: fbedf199b1dd2257ef1a3d942caa463879d5cd5255af03027574c96df2fda2d5

Contents?: true

Size: 831 Bytes

Versions: 5

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true

require 'deprecation'

module Dor
  module Services
    class Client
      # An object representing metadata about the cocina object returned by the object show method
      class ObjectMetadata
        extend Deprecation

        attr_reader :created_at, :updated_at, :etag

        def initialize(created_at:, updated_at:, etag: nil)
          @created_at = created_at
          @updated_at = updated_at
          @etag = etag
        end

        def [](key)
          case key
          when 'Last-Modified'
            updated_at
          when 'X-Created-At'
            created_at
          else
            raise KeyError, 'Unknown key'
          end
        end
        deprecation_deprecate(:[] => 'Hash accessor is no longer used, use object accessor instead')
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dor-services-client-10.1.0 lib/dor/services/client/object_metadata.rb
dor-services-client-10.0.0 lib/dor/services/client/object_metadata.rb
dor-services-client-9.1.1 lib/dor/services/client/object_metadata.rb
dor-services-client-9.1.0 lib/dor/services/client/object_metadata.rb
dor-services-client-9.0.0 lib/dor/services/client/object_metadata.rb