dor-services-client 10.0.0 → 11.0.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: 92add95b112e8d9c6cdce2ba2e91e08d4a49cb4d3329868c34441fe272fcc9c2
4
- data.tar.gz: 18e2a92e7a11955f46ce18f832a0942dbbac87e300d3910e9cbddbb8ee7681fa
3
+ metadata.gz: fe7dfec36a8319421bee77745fe97ce0b82d42ae37496dfa0b53da9924520855
4
+ data.tar.gz: c52d59d1f89e919d634403fad5008034ffff6a49bc7cc36de512bac0075fb4b2
5
5
  SHA512:
6
- metadata.gz: aab5c196702ecdf1fca112cc9e65ab4e0136a9f4d79a0f96e8b31a7d4b71cf3d2daa978cf59234190fba35d0674f31449f6a8c4ac5a2fac9c9fd38e933a4102e
7
- data.tar.gz: 8882218dba3fa8266a19ea4c299569fd62c1b41b32119bf897b65d4333687df943c407e84bb3f48d213317caa40b8245ea4810eaf6e69f32b836bc6e262cc2aa
6
+ metadata.gz: f9698a746b759eff42f1b12ab31413c5c28527f1080649b8a8d9e62d56200871ae7907308d32161efaae83aa0507e95367e1d1566f401046246f200978e9253a
7
+ data.tar.gz: d76e0a78928835868bcc058369ea0f38933290110d42517d7b7440ccaa27eb3f45f41432de90e4b7e19031faeea2332f3236f1293edd462fc1feefc05aea6111
data/.rubocop.yml CHANGED
@@ -134,3 +134,22 @@ RSpec/FactoryBot/SyntaxMethods: # new in 2.7
134
134
  Enabled: true
135
135
  RSpec/Rails/AvoidSetupHook: # new in 2.4
136
136
  Enabled: true
137
+
138
+ Lint/RefinementImportMethods: # new in 1.27
139
+ Enabled: true
140
+ Security/CompoundHash: # new in 1.28
141
+ Enabled: true
142
+ Style/FetchEnvVar: # new in 1.28
143
+ Enabled: true
144
+ Style/NestedFileDirname: # new in 1.26
145
+ Enabled: true
146
+ Style/ObjectThen: # new in 1.28
147
+ Enabled: true
148
+ Style/RedundantInitialize: # new in 1.27
149
+ Enabled: true
150
+ RSpec/BeEq: # new in 2.9.0
151
+ Enabled: true
152
+ RSpec/BeNil: # new in 2.9.0
153
+ Enabled: true
154
+ RSpec/VerifiedDoubleReference: # new in 2.10.0
155
+ Enabled: true
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
- gem 'activesupport', ENV['RAILS_VERSION'] if ENV['RAILS_VERSION']
7
+ gem 'activesupport', ENV.fetch('RAILS_VERSION', nil) if ENV['RAILS_VERSION']
8
8
 
9
9
  # Specify your gem's dependencies in dor-services-client.gemspec
10
10
  gemspec
data/README.md CHANGED
@@ -123,9 +123,11 @@ object_client.notify_goobi
123
123
  # Manage versions
124
124
  object_client.version.inventory
125
125
  object_client.version.current
126
- object_client.version.openable?(**params)
127
- object_client.version.open(**params)
128
- object_client.version.close(description: 'Changed title', significance: 'minor')
126
+ object_client.version.openable?
127
+ # see dor-services-app openapi.yml for optional params
128
+ object_client.version.open(description: 'Changed title', significance: 'minor')
129
+ # see dor-services-app openapi.yml for optional params
130
+ object_client.version.close
129
131
 
130
132
  # Get the Dublin Core XML representation
131
133
  object_client.metadata.dublin_core
@@ -136,14 +138,6 @@ object_client.metadata.descriptive
136
138
  # Get the public XML representation
137
139
  object_client.metadata.public_xml
138
140
 
139
- # Update legacy XML representation
140
- object_client.metadata.legacy_update(
141
- descriptive: {
142
- updated: Time.now,
143
- content: '<descMetadata/>'
144
- }
145
- )
146
-
147
141
  # Return the Cocina metadata
148
142
  object_client.find
149
143
 
@@ -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.75.0' # leave pinned to patch level until cocina-models hits 1.0
28
+ spec.add_dependency 'cocina-models', '~> 0.78.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', '~> 2.0'
31
31
  spec.add_dependency 'faraday-retry'
@@ -15,10 +15,10 @@ module Dor
15
15
 
16
16
  # Start accession on an object (start specified workflow, assemblyWF by default, and version if needed)
17
17
  # @param params [Hash<Symbol,String>] optional parameter hash
18
- # @option params [String] :significance set significance (major/minor/patch) of version change
19
- # @option params [String] :description set description of version change
20
- # @option params [String] :opening_user_name add opening username to the events datastream
21
- # @option params [String] :workflow the workflow to start (defaults to 'assemblyWF')
18
+ # @option params [String] :significance set significance (major/minor/patch) of version change - required
19
+ # @option params [String] :description set description of version change - required
20
+ # @option params [String] :opening_user_name add opening username to the event - optional
21
+ # @option params [String] :workflow the workflow to start - defaults to 'assemblyWF'
22
22
  # @return [Boolean] true on success
23
23
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
24
24
  # @raise [UnexpectedResponse] when the response is not successful.
@@ -13,32 +13,6 @@ module Dor
13
13
  @object_identifier = object_identifier
14
14
  end
15
15
 
16
- # Updates using the legacy SDR/Fedora3 metadata
17
- # @param [Hash<Symbol,Hash>] opts the options for legacy update
18
- # @option opts [Hash] :administrative Data for administrative metadata
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
22
- # @option opts [Hash] :identity Data for identity metadata
23
- # @option opts [Hash] :provenance Data for provenance 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
28
- # @example:
29
- # legacy_update(descriptive: { updated: '2001-12-20', content: '<descMetadata />' })
30
- def legacy_update(opts)
31
- opts = opts.slice(:administrative, :content, :descriptive, :geo, :identity, :provenance, :relationships, :rights, :technical, :version)
32
- resp = connection.patch do |req|
33
- req.url "#{base_path}/legacy"
34
- req.headers['Content-Type'] = 'application/json'
35
- req.body = opts.to_json
36
- end
37
- return if resp.success?
38
-
39
- raise_exception_based_on_response!(resp, object_identifier)
40
- end
41
-
42
16
  # @return [String, NilClass] The Dublin Core XML representation of the object or nil if response is 404
43
17
  # @raise [UnexpectedResponse] on an unsuccessful response from the server
44
18
  def dublin_core
@@ -101,33 +75,6 @@ module Dor
101
75
  raise_exception_based_on_response!(resp, object_identifier)
102
76
  end
103
77
 
104
- # rubocop:disable Lint/StructNewOverride
105
- Datastream = Struct.new(:label, :dsid, :pid, :size, :mimeType, :versionId, keyword_init: true)
106
- # rubocop:enable Lint/StructNewOverride
107
-
108
- # @return [Array] the list of datastreams for the item
109
- # @raise [UnexpectedResponse] on an unsuccessful response from the server
110
- def datastreams
111
- resp = connection.get do |req|
112
- req.url "#{base_path}/datastreams"
113
- end
114
- raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
115
-
116
- JSON.parse(resp.body).map { |params| Datastream.new(**params.symbolize_keys!) }
117
- end
118
-
119
- # @param [String] dsid the identifier for the datastream
120
- # @return [String] the contents of the specified datastream
121
- # @raise [UnexpectedResponse] on an unsuccessful response from the server
122
- def datastream(dsid)
123
- resp = connection.get do |req|
124
- req.url "#{base_path}/datastreams/#{dsid}"
125
- end
126
- raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
127
-
128
- resp.body
129
- end
130
-
131
78
  private
132
79
 
133
80
  attr_reader :object_identifier
@@ -55,27 +55,6 @@ module Dor
55
55
  build_cocina_from_response(resp)
56
56
  end
57
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,ObjectMetadata>] a tuple where
62
- # the first is the model and the second is a ObjectMetadata object
63
- def find_with_metadata
64
- resp = connection.get do |req|
65
- req.url object_path
66
- end
67
- raise_exception_based_on_response!(resp) unless resp.success?
68
-
69
- model = Cocina::Models.build(JSON.parse(resp.body))
70
-
71
- # Don't use #slice here as Faraday will downcase the keys.
72
- metadata = ObjectMetadata.new(updated_at: resp.headers['Last-Modified'],
73
- created_at: resp.headers['X-Created-At'],
74
- etag: resp.headers['ETag'])
75
- [model, metadata]
76
- end
77
- deprecation_deprecate find_with_metadata: 'Use find instead with provides models with metadata.'
78
-
79
58
  # Get a list of the collections. (Similar to Valkyrie's find_inverse_references_by)
80
59
  # @raise [UnexpectedResponse] if the request is unsuccessful.
81
60
  # @return [Array<Cocina::Models::DRO>]
@@ -27,15 +27,13 @@ module Dor
27
27
  end
28
28
 
29
29
  # Determines if a new version can be opened for a DOR object.
30
- # @param params [Hash] optional params (see dor-services-app)
31
30
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
32
31
  # @raise [UnexpectedResponse] when the response is not successful.
33
32
  # @return [Boolean] true if a new version can be opened
34
33
  # rubocop:disable Metrics/MethodLength
35
- def openable?(**params)
34
+ def openable?
36
35
  resp = connection.get do |req|
37
36
  req.url "#{base_path}/openable"
38
- req.params = params
39
37
  end
40
38
 
41
39
  raise_exception_based_on_response!(resp) unless resp.success?
@@ -52,7 +50,10 @@ module Dor
52
50
  # rubocop:enable Metrics/MethodLength
53
51
 
54
52
  # Open new version for an object
55
- # @param params [Hash] optional params (see dor-services-app)
53
+ # @param description [String] a description of the object version being opened - required
54
+ # @param significance [String] 'major' 'minor' or 'admin' - required
55
+ # @param opening_user_name [String] sunetid - defaults to nil
56
+ # @param assume_accessioned [Boolean] if true, does not check whether object has been accessioned; defaults to false
56
57
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
57
58
  # @raise [UnexpectedResponse] when the response is not successful.
58
59
  # @return [Cocina::Models::DROWithMetadata|CollectionWithMetadata|AdminPolicyWithMetadata] cocina model with updated version
@@ -69,7 +70,10 @@ module Dor
69
70
  end
70
71
 
71
72
  # Close current version for an object
72
- # @param params [Hash] optional params (see dor-services-app)
73
+ # @param description [String] (optional) - a description of the object version being opened
74
+ # @param significance [String] (optional) - 'major' 'minor' or 'admin'
75
+ # @param user_name [String] (optional) - sunetid
76
+ # @param start_accession [Boolean] (optional) - whether to start accessioning workflow; defaults to true
73
77
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
74
78
  # @raise [UnexpectedResponse] when the response is not successful.
75
79
  # @return [String] a message confirming successful closing
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '10.0.0'
6
+ VERSION = '11.0.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: 10.0.0
4
+ version: 11.0.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-04-21 00:00:00.000000000 Z
12
+ date: 2022-05-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.75.0
40
+ version: 0.78.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.75.0
47
+ version: 0.78.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: deprecation
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -249,7 +249,6 @@ files:
249
249
  - lib/dor/services/client/metadata.rb
250
250
  - lib/dor/services/client/mutate.rb
251
251
  - lib/dor/services/client/object.rb
252
- - lib/dor/services/client/object_metadata.rb
253
252
  - lib/dor/services/client/object_version.rb
254
253
  - lib/dor/services/client/objects.rb
255
254
  - lib/dor/services/client/response_error_formatter.rb
@@ -280,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
279
  - !ruby/object:Gem::Version
281
280
  version: '0'
282
281
  requirements: []
283
- rubygems_version: 3.1.4
282
+ rubygems_version: 3.3.4
284
283
  signing_key:
285
284
  specification_version: 4
286
285
  summary: A client for dor-services-app
@@ -1,34 +0,0 @@
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, :etag
13
-
14
- def initialize(created_at:, updated_at:, etag: nil)
15
- @created_at = created_at
16
- @updated_at = updated_at
17
- @etag = etag
18
- end
19
-
20
- def [](key)
21
- case key
22
- when 'Last-Modified'
23
- updated_at
24
- when 'X-Created-At'
25
- created_at
26
- else
27
- raise KeyError, 'Unknown key'
28
- end
29
- end
30
- deprecation_deprecate(:[] => 'Hash accessor is no longer used, use object accessor instead')
31
- end
32
- end
33
- end
34
- end