dor-services-client 7.8.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: 2fa0266d0f179a5c10f0bf1480385d0bb03e6b28e40c9dcfc26fcb15c3aba67a
4
- data.tar.gz: fe3852fafe577076c80a54bf0ca774e04bd3fb6208c7594c855178b482a8a729
3
+ metadata.gz: 07df0c2ce071a596c4825052e94a429cda7666fcd1d68e0c12c1476f27843123
4
+ data.tar.gz: 627aa21d6fe0c5b9599682f4bd182f92a3d56266e488c48a1d23f4f140aaac75
5
5
  SHA512:
6
- metadata.gz: 06035fa867dd6954355d1d1ccbb1fedc0f5725009acd9a3d656e1438c27df4da553aef83dbc1b9ec3e583c2d45c206ed1b0e1b69a6d5b57127b9bcfca9eddb2d
7
- data.tar.gz: 59e3df995e235d971bbb01c7b7b1350eee3bee39ddb35581a3e5e2e4ab5bc065d6efbf31dd408aa64ba70a189018dd53223239a0c6464aef0d30dc3976d5467a
6
+ metadata.gz: a18c81fce2987d56bb558d5ee0ddb74c561ea873e305aa5ce0982b91575c190b5cbb04aaf1dd1f1a2af9f7ff63878040ad7d8e5f535fde5610bbd3ba8b9d02b1
7
+ data.tar.gz: 252fc0275a91bf1c254936a1b09ca9b49b10d3c1120b3d7d1b2771efd8398aec4ede5fa3d71de6f2c2c384ba3cd21e7b3fffd696e561de34eb37e4c153d6e690
@@ -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.8.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.8.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-26 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
@@ -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
@@ -271,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
272
  - !ruby/object:Gem::Version
272
273
  version: '0'
273
274
  requirements: []
274
- rubygems_version: 3.1.4
275
+ rubygems_version: 3.2.32
275
276
  signing_key:
276
277
  specification_version: 4
277
278
  summary: A client for dor-services-app