dor-services-client 1.5.0 → 1.5.1
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 +4 -4
- data/README.md +3 -0
- data/lib/dor/services/client/sdr.rb +31 -12
- data/lib/dor/services/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 11f4dfdf374726956bc74b43f5963af395401a18caf799bf4d03d4e5df8c9c2d
|
|
4
|
+
data.tar.gz: 5f300197aaff93c4fecf8ba8567246abd36b89af672eb9498fdbebe5f7073fd2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d4c11288cdf203e172279a17b60243b8c6f52043db891002d79b3bfc3acd59e329e5f9a85eb375ca46c9155a902fee407b2682306faa2e3f2c3ab9ac27057ed
|
|
7
|
+
data.tar.gz: de6d4b80acb9e253847ed553f7a0d816e4c65f223996246ab1e7bd8ec85fbe1c05625148f08367afe423c4f206f6c60238643bd541a60a3811fd662109b051fd
|
data/README.md
CHANGED
|
@@ -67,8 +67,11 @@ object_client.files.retrieve(filename: filename_string)
|
|
|
67
67
|
object_client.files.preserved_content(filename: filename_string, version: version_string)
|
|
68
68
|
object_client.files.list
|
|
69
69
|
object_client.release_tags.create(release: release, what: what, to: to, who: who)
|
|
70
|
+
object_client.sdr.content_diff(current_content: existing_content)
|
|
70
71
|
object_client.sdr.current_version
|
|
72
|
+
object_client.sdr.metadata(datastream: dsid)
|
|
71
73
|
object_client.sdr.signature_catalog
|
|
74
|
+
|
|
72
75
|
object_client.workflow.create(wf_name: workflow_name_string)
|
|
73
76
|
object_client.workspace.create(source: object_path_string)
|
|
74
77
|
|
|
@@ -31,10 +31,9 @@ module Dor
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def signature_catalog
|
|
34
|
-
resp =
|
|
35
|
-
req.url "#{base_path}/manifest/signatureCatalog.xml"
|
|
36
|
-
end
|
|
34
|
+
resp = signature_catalog_response
|
|
37
35
|
|
|
36
|
+
return Moab::SignatureCatalog.new(digital_object_id: object_identifier, version_id: 0) if resp.status == 404
|
|
38
37
|
raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body}) for #{object_identifier}" unless resp.success?
|
|
39
38
|
|
|
40
39
|
Moab::SignatureCatalog.parse resp.body
|
|
@@ -49,16 +48,9 @@ module Dor
|
|
|
49
48
|
def content_diff(current_content:, subset: 'all', version: nil)
|
|
50
49
|
raise ArgumentError, "Invalid subset value: #{subset}" unless %w[all shelve preserve publish].include?(subset)
|
|
51
50
|
|
|
52
|
-
|
|
53
|
-
query_string[:version] = version.to_s unless version.nil?
|
|
54
|
-
query_string = URI.encode_www_form(query_string)
|
|
51
|
+
resp = content_diff_response(current_content: current_content, subset: subset, version: version)
|
|
55
52
|
|
|
56
|
-
resp
|
|
57
|
-
req.url "#{base_path}/cm-inv-diff?#{query_string}"
|
|
58
|
-
req.headers['Content-Type'] = 'application/xml'
|
|
59
|
-
req.body = current_content
|
|
60
|
-
end
|
|
61
|
-
Moab::FileInventoryDifference.parse(resp.body)
|
|
53
|
+
Moab::FileInventoryDifference.parse(resp)
|
|
62
54
|
end
|
|
63
55
|
|
|
64
56
|
# @param [String] datastream The identifier of the metadata datastream
|
|
@@ -77,6 +69,12 @@ module Dor
|
|
|
77
69
|
|
|
78
70
|
attr_reader :object_identifier
|
|
79
71
|
|
|
72
|
+
def signature_catalog_response
|
|
73
|
+
connection.get do |req|
|
|
74
|
+
req.url "#{base_path}/manifest/signatureCatalog.xml"
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
80
78
|
# make the request to the server for the currentVersion xml
|
|
81
79
|
# @raises [UnexpectedResponse] on an unsuccessful response from the server
|
|
82
80
|
# @returns [String] the raw xml from the server
|
|
@@ -93,6 +91,27 @@ module Dor
|
|
|
93
91
|
"#{base_path}/current_version"
|
|
94
92
|
end
|
|
95
93
|
|
|
94
|
+
# make the request to the server for the content diff
|
|
95
|
+
# @raises [UnexpectedResponse] on an unsuccessful response from the server
|
|
96
|
+
# @returns [String] the raw xml from the server
|
|
97
|
+
def content_diff_response(current_content:, subset:, version:)
|
|
98
|
+
resp = connection.post do |req|
|
|
99
|
+
req.url content_diff_path(subset: subset, version: version)
|
|
100
|
+
req.headers['Content-Type'] = 'application/xml'
|
|
101
|
+
req.body = current_content
|
|
102
|
+
end
|
|
103
|
+
raise UnexpectedResponse, "#{resp.reason_phrase}: #{resp.status} (#{resp.body}) for #{object_identifier}" unless resp.success?
|
|
104
|
+
|
|
105
|
+
resp.body
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def content_diff_path(subset:, version:)
|
|
109
|
+
query_string = { subset: subset }
|
|
110
|
+
query_string[:version] = version.to_s unless version.nil?
|
|
111
|
+
query_string = URI.encode_www_form(query_string)
|
|
112
|
+
"#{base_path}/cm-inv-diff?#{query_string}"
|
|
113
|
+
end
|
|
114
|
+
|
|
96
115
|
def base_path
|
|
97
116
|
"#{api_version}/sdr/objects/#{object_identifier}"
|
|
98
117
|
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: 1.5.
|
|
4
|
+
version: 1.5.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: 2019-
|
|
12
|
+
date: 2019-03-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|