dor-services-client 6.19.0 → 6.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a73aeed32be958c06af9dc6af194ea446ac44f995381070596135c188ee22ec
4
- data.tar.gz: '0304285baee05cd74ff40190b943ea79ae4c1a38b588b539fab95434e62a41b7'
3
+ metadata.gz: ad8761fb1fdda020b431618bb4041aa6173c47c5343df2dcb011d7979aac133d
4
+ data.tar.gz: ddc02875de984ef2360c4dc0e518bb16a51872b0c4bf2ae8633fd234dbaef3af
5
5
  SHA512:
6
- metadata.gz: b109cce621828454564bc7bbc1298099be39abed86b3b2aa3734090fffe86f500f2161e0def2aedec5266242f848d24b634ea6bd8236e56aedbb68d080bd9b73
7
- data.tar.gz: 82696ecdaa9fd83561916f28de1345448d5e96931cd27b7b712497adb9ed408868441ba65f1b05c06367d43af6107be94e771b7558bd859e4be3d8622ecd4aae
6
+ metadata.gz: 81412aa87166c537644518ad3433edb66346fbb4af6d365b170ece6d34d9897dba396138614133381fafe14e88889a816772225313785a7967b55f28288cdcaa
7
+ data.tar.gz: fca39f1240f485d842a7e0070c53197fdbec3007e76b3dfbb6ee5cfd60b72138cb6b680392c4c3a8b011364420017ba6818ea709eb26f12d8a72fe33d35db882
data/.rubocop_todo.yml CHANGED
@@ -14,7 +14,7 @@ Metrics/AbcSize:
14
14
  # Offense count: 1
15
15
  # Configuration parameters: CountComments.
16
16
  Metrics/ClassLength:
17
- Max: 113
17
+ Max: 115
18
18
 
19
19
  # Offense count: 1
20
20
  # Configuration parameters: CountComments, ExcludedMethods.
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
 
25
25
  spec.add_dependency 'activesupport', '>= 4.2', '< 7'
26
- spec.add_dependency 'cocina-models', '~> 0.47.0' # leave pinned to patch level until cocina-models hits 1.0
26
+ spec.add_dependency 'cocina-models', '~> 0.50.0' # leave pinned to patch level until cocina-models hits 1.0
27
27
  spec.add_dependency 'deprecation', '>= 0'
28
28
  spec.add_dependency 'faraday', '>= 0.15', '< 2'
29
29
  spec.add_dependency 'moab-versioning', '~> 4.0'
@@ -15,17 +15,20 @@ module Dor
15
15
 
16
16
  # Updates using the legacy SDR/Fedora3 metadata
17
17
  # @param [Hash<Symbol,Hash>] opts the options for legacy update
18
- # @option opts [Hash] :descriptive Data for descriptive metadata
19
- # @option opts [Hash] :rights Data for access rights metadata
18
+ # @option opts [Hash] :administrative Data for administrative metadata
20
19
  # @option opts [Hash] :content Data for structural metadata
20
+ # @option opts [Hash] :descriptive Data for descriptive metadata
21
+ # @option opts [Hash] :geo Data for geographic metadata
21
22
  # @option opts [Hash] :identity Data for identity metadata
22
- # @option opts [Hash] :technical Data for technical metadata
23
23
  # @option opts [Hash] :provenance Data for provenance metadata
24
- # @option opts [Hash] :geo Data for geographic metadata
24
+ # @option opts [Hash] :relationships Data for RELS-EXT metadata
25
+ # @option opts [Hash] :rights Data for access rights metadata
26
+ # @option opts [Hash] :technical Data for technical metadata
27
+ # @option opts [Hash] :version Data for version metadata
25
28
  # @example:
26
29
  # legacy_update(descriptive: { updated: '2001-12-20', content: '<descMetadata />' })
27
30
  def legacy_update(opts)
28
- opts = opts.slice(:descriptive, :rights, :identity, :content, :technical, :provenance, :geo)
31
+ opts = opts.slice(:administrative, :content, :descriptive, :geo, :identity, :provenance, :relationships, :rights, :technical, :version)
29
32
  resp = connection.patch do |req|
30
33
  req.url "#{base_path}/legacy"
31
34
  req.headers['Content-Type'] = 'application/json'
@@ -52,13 +52,25 @@ module Dor
52
52
  # @raise [UnexpectedResponse] when the response is not successful.
53
53
  # @return [Cocina::Models::DRO,Cocina::Models::Collection,Cocina::Models::AdminPolicy] the returned model
54
54
  def find
55
+ find_with_metadata.first
56
+ end
57
+
58
+ # Retrieves the Cocina model and response metadata
59
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
60
+ # @raise [UnexpectedResponse] when the response is not successful.
61
+ # @return [Array<Cocina::Models::DRO,Cocina::Models::Collection,Cocina::Models::AdminPolicy,Hash>] a tuple where
62
+ # the first is the model and the second is a hash of metadata
63
+ def find_with_metadata
55
64
  resp = connection.get do |req|
56
65
  req.url object_path
57
66
  end
67
+ raise_exception_based_on_response!(resp) unless resp.success?
58
68
 
59
- return Cocina::Models.build(JSON.parse(resp.body)) if resp.success?
69
+ model = Cocina::Models.build(JSON.parse(resp.body))
60
70
 
61
- raise_exception_based_on_response!(resp)
71
+ # Don't use #slice here as Faraday will downcase the keys.
72
+ metadata = { 'Last-Modified' => resp.headers['Last-Modified'] }
73
+ [model, metadata]
62
74
  end
63
75
 
64
76
  # Updates the object
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '6.19.0'
6
+ VERSION = '6.22.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: 6.19.0
4
+ version: 6.22.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: 2021-02-08 00:00:00.000000000 Z
12
+ date: 2021-03-04 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.47.0
40
+ version: 0.50.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.47.0
47
+ version: 0.50.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: deprecation
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  - !ruby/object:Gem::Version
268
268
  version: '0'
269
269
  requirements: []
270
- rubygems_version: 3.0.3
270
+ rubygems_version: 3.1.2
271
271
  signing_key:
272
272
  specification_version: 4
273
273
  summary: A client for dor-services-app