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 +4 -4
- data/.rubocop.yml +4 -0
- data/README.md +1 -0
- data/dor-services-client.gemspec +1 -2
- data/lib/dor/services/client/marcxml.rb +0 -2
- data/lib/dor/services/client/object.rb +12 -0
- data/lib/dor/services/client/objects.rb +7 -4
- data/lib/dor/services/client/version.rb +1 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f323448e52df870c23823d8c30a556fdd3ab2fbba7ef69c9d438ac6bc541109e
|
4
|
+
data.tar.gz: 5c5aec3aca02df4c3af40865d8f479a8d38487bc8ae03e66f83bbccee224875c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0667a7d719b7078a66a2ab6907fd939a9a35530d766134a5c93425b347a16a2b580fc4f529f8d52567bf7cf08790e32bda0d2041df948801c95b006f4cfdaaf5
|
7
|
+
data.tar.gz: 615e0d7542a2082d3c9a4460414d96ecfc74c0f343cb96f1b545530f885316ae8917f69748476b7b4b9d136fa0effee127e24fb66dda9dd819cb4038c12d3f09
|
data/.rubocop.yml
CHANGED
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
|
data/dor-services-client.gemspec
CHANGED
@@ -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.
|
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'
|
@@ -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?
|
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.
|
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-
|
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.
|
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.
|
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
|