dor-services-client 7.0.0 → 7.3.1

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: 5bb8a9ddf0dc77dd42ad241f0ff58a247abfbea76b679d4f82da04cff10ffdda
4
- data.tar.gz: c857219027ca4cc668f19931dea4da44b0e91d0efa757bc6e2220e285538360e
3
+ metadata.gz: f323448e52df870c23823d8c30a556fdd3ab2fbba7ef69c9d438ac6bc541109e
4
+ data.tar.gz: 5c5aec3aca02df4c3af40865d8f479a8d38487bc8ae03e66f83bbccee224875c
5
5
  SHA512:
6
- metadata.gz: a676bcbbcfe6b425e3f2a6789d253e6d44d91bdedc61220e937ed3f30214caaee2bb943462756449f8ca415ba1d8494822a00d07a081101c8e8aed924d320c80
7
- data.tar.gz: b5fdfd955d1ad5a1f9e39217f765e92af23775bf087543d02aedfae3ebfab4ea23a23ec3a18cd15aa058dcf175be013507b29b87d8b643011e74b374d76a4f44
6
+ metadata.gz: 0667a7d719b7078a66a2ab6907fd939a9a35530d766134a5c93425b347a16a2b580fc4f529f8d52567bf7cf08790e32bda0d2041df948801c95b006f4cfdaaf5
7
+ data.tar.gz: 615e0d7542a2082d3c9a4460414d96ecfc74c0f343cb96f1b545530f885316ae8917f69748476b7b4b9d136fa0effee127e24fb66dda9dd819cb4038c12d3f09
data/.rubocop.yml CHANGED
@@ -77,3 +77,7 @@ Style/StringChars: # (new in 1.12)
77
77
  Enabled: true
78
78
  Style/SwapValues: # (new in 1.1)
79
79
  Enabled: true
80
+ Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
81
+ Enabled: true
82
+ Naming/InclusiveLanguage: # (new in 1.18)
83
+ Enabled: true
data/README.md CHANGED
@@ -61,6 +61,7 @@ objects_client = Dor::Services::Client.objects
61
61
 
62
62
  # Register a non-existent object
63
63
  objects_client.register(params: {})
64
+ objects_client.register(params: {}, assign_doi: true)
64
65
 
65
66
  # Interact with virtual objects
66
67
  virtual_objects_client = Dor::Services::Client.virtual_objects
@@ -25,10 +25,9 @@ Gem::Specification.new do |spec|
25
25
  spec.required_ruby_version = '~> 2.6'
26
26
 
27
27
  spec.add_dependency 'activesupport', '>= 4.2', '< 7'
28
- spec.add_dependency 'cocina-models', '~> 0.61.0' # leave pinned to patch level until cocina-models hits 1.0
28
+ spec.add_dependency 'cocina-models', '~> 0.62.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
- spec.add_dependency 'moab-versioning', '~> 4.0'
32
31
  spec.add_dependency 'zeitwerk', '~> 2.1'
33
32
 
34
33
  spec.add_development_dependency 'bundler'
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'nokogiri'
4
-
5
3
  module Dor
6
4
  module Services
7
5
  class Client
@@ -104,6 +104,18 @@ module Dor
104
104
  raise_exception_based_on_response!(resp)
105
105
  end
106
106
 
107
+ # Update the DOI metadata at DataCite
108
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
109
+ # @return [boolean] true on success
110
+ def update_doi_metadata
111
+ resp = connection.post do |req|
112
+ req.url "#{object_path}/update_doi_metadata"
113
+ end
114
+ return true if resp.success?
115
+
116
+ raise_exception_based_on_response!(resp)
117
+ end
118
+
107
119
  # Notify the external Goobi system for a new object that was registered in DOR
108
120
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
109
121
  # @raise [UnexpectedResponse] when the response is not successful.
@@ -8,10 +8,11 @@ module Dor
8
8
  # API calls that are about a repository objects
9
9
  class Objects < VersionedService
10
10
  # Creates a new object in DOR
11
- # @param [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO]
11
+ # @param params [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO]
12
+ # @param assign_doi [Boolean]
12
13
  # @return [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO] the returned model
13
- def register(params:)
14
- json_str = register_response(params: params)
14
+ def register(params:, assign_doi: false)
15
+ json_str = register_response(params: params, assign_doi: assign_doi)
15
16
  json = JSON.parse(json_str)
16
17
 
17
18
  Cocina::Models.build(json)
@@ -21,14 +22,16 @@ module Dor
21
22
 
22
23
  # make the registration request to the server
23
24
  # @param params [Hash] optional params (see dor-services-app)
25
+ # @param assign_doi [Boolean]
24
26
  # @raise [UnexpectedResponse] on an unsuccessful response from the server
25
27
  # @return [String] the raw JSON from the server
26
- def register_response(params:)
28
+ def register_response(params:, assign_doi:)
27
29
  resp = connection.post do |req|
28
30
  req.url "#{api_version}/objects"
29
31
  req.headers['Content-Type'] = 'application/json'
30
32
  # asking the service to return JSON (else it'll be plain text)
31
33
  req.headers['Accept'] = 'application/json'
34
+ req.params[:assign_doi] = true if assign_doi
32
35
  req.body = params.to_json
33
36
  end
34
37
  return resp.body if resp.success?
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '7.0.0'
6
+ VERSION = '7.3.1'
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.0.0
4
+ version: 7.3.1
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-07-06 00:00:00.000000000 Z
12
+ date: 2021-10-19 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.61.0
40
+ version: 0.62.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.61.0
47
+ version: 0.62.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: deprecation
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -79,20 +79,6 @@ dependencies:
79
79
  - - "<"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '2'
82
- - !ruby/object:Gem::Dependency
83
- name: moab-versioning
84
- requirement: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '4.0'
89
- type: :runtime
90
- prerelease: false
91
- version_requirements: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '4.0'
96
82
  - !ruby/object:Gem::Dependency
97
83
  name: zeitwerk
98
84
  requirement: !ruby/object:Gem::Requirement