dor-services-client 7.6.0 → 7.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e2d9e5cd1569dfa3cb099d27fb999c5fda7434db1fa07de5db64ff728bc00ec
4
- data.tar.gz: 221f79c403afb4daba61e4d21f8d9d8f2c59ac2ee192bd0c9739922cb9060d47
3
+ metadata.gz: 07df0c2ce071a596c4825052e94a429cda7666fcd1d68e0c12c1476f27843123
4
+ data.tar.gz: 627aa21d6fe0c5b9599682f4bd182f92a3d56266e488c48a1d23f4f140aaac75
5
5
  SHA512:
6
- metadata.gz: 1689a1120fd0c7454b1905d9b64b4abee90f7cf61b7c03df4b13227ea93eb1ed30a8c07bab9202b07f7f4fc0bd1e73e280e096e8e42b7246e2973cd73b7c07f3
7
- data.tar.gz: aba6793400aad63490bdee7a1e25d238ddcf5d4b4ae7c2e652f3f62abe05c78e9c28760a4daae3e88e0bdde782dbb5d9a90828c478231875763882ee7bfe77c3
6
+ metadata.gz: a18c81fce2987d56bb558d5ee0ddb74c561ea873e305aa5ce0982b91575c190b5cbb04aaf1dd1f1a2af9f7ff63878040ad7d8e5f535fde5610bbd3ba8b9d02b1
7
+ data.tar.gz: 252fc0275a91bf1c254936a1b09ca9b49b10d3c1120b3d7d1b2771efd8398aec4ede5fa3d71de6f2c2c384ba3cd21e7b3fffd696e561de34eb37e4c153d6e690
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.required_ruby_version = '>= 2.7', '< 4' # dor-services-app needs 2.7 due to fedora3
26
26
 
27
27
  spec.add_dependency 'activesupport', '>= 4.2', '< 8'
28
- spec.add_dependency 'cocina-models', '~> 0.62.0' # leave pinned to patch level until cocina-models hits 1.0
28
+ spec.add_dependency 'cocina-models', '~> 0.64.0' # leave pinned to patch level until cocina-models hits 1.0
29
29
  spec.add_dependency 'deprecation', '>= 0'
30
30
  spec.add_dependency 'faraday', '>= 0.15', '< 2'
31
31
  spec.add_dependency 'zeitwerk', '~> 2.1'
@@ -50,8 +50,8 @@ module Dor
50
50
  # Retrieves the Cocina model and response metadata
51
51
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
52
52
  # @raise [UnexpectedResponse] when the response is not successful.
53
- # @return [Array<Cocina::Models::DRO,Cocina::Models::Collection,Cocina::Models::AdminPolicy,Hash>] a tuple where
54
- # the first is the model and the second is a hash of metadata
53
+ # @return [Array<Cocina::Models::DRO,Cocina::Models::Collection,Cocina::Models::AdminPolicy,ObjectMetadata>] a tuple where
54
+ # the first is the model and the second is a ObjectMetadata object
55
55
  def find_with_metadata
56
56
  resp = connection.get do |req|
57
57
  req.url object_path
@@ -61,7 +61,7 @@ module Dor
61
61
  model = Cocina::Models.build(JSON.parse(resp.body))
62
62
 
63
63
  # Don't use #slice here as Faraday will downcase the keys.
64
- metadata = { 'Last-Modified' => resp.headers['Last-Modified'] }
64
+ metadata = ObjectMetadata.new(updated_at: resp.headers['Last-Modified'], created_at: resp.headers['X-Created-At'])
65
65
  [model, metadata]
66
66
  end
67
67
 
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'deprecation'
4
+
5
+ module Dor
6
+ module Services
7
+ class Client
8
+ # An object representing metadata about the cocina object returned by the object show method
9
+ class ObjectMetadata
10
+ extend Deprecation
11
+
12
+ attr_reader :created_at, :updated_at
13
+
14
+ def initialize(created_at:, updated_at:)
15
+ @created_at = created_at
16
+ @updated_at = updated_at
17
+ end
18
+
19
+ def [](key)
20
+ case key
21
+ when 'Last-Modified'
22
+ updated_at
23
+ when 'X-Created-At'
24
+ created_at
25
+ else
26
+ raise KeyError, 'Unknown key'
27
+ end
28
+ end
29
+ deprecation_deprecate(:[] => 'Hash accessor is no longer used, use object accessor instead')
30
+ end
31
+ end
32
+ end
33
+ end
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '7.6.0'
6
+ VERSION = '7.9.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.6.0
4
+ version: 7.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-01-19 00:00:00.000000000 Z
12
+ date: 2022-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -37,14 +37,14 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.62.0
40
+ version: 0.64.0
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.62.0
47
+ version: 0.64.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: deprecation
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -241,6 +241,7 @@ files:
241
241
  - lib/dor/services/client/metadata.rb
242
242
  - lib/dor/services/client/mutate.rb
243
243
  - lib/dor/services/client/object.rb
244
+ - lib/dor/services/client/object_metadata.rb
244
245
  - lib/dor/services/client/object_version.rb
245
246
  - lib/dor/services/client/objects.rb
246
247
  - lib/dor/services/client/response_error_formatter.rb