dor-services-client 4.3.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/dor/services/client/events.rb +40 -0
- data/lib/dor/services/client/metadata.rb +2 -1
- data/lib/dor/services/client/object.rb +4 -0
- data/lib/dor/services/client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5556939287e5a39750be249f7b5ce28ec900db9ba4a23f05eafd8756de12a76e
|
4
|
+
data.tar.gz: 9a7e832e1fc627b07e45694539f1b99e1eea17952511be10ed06717c12aa0765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4275122ffdc7a3ff0d93cfea54eb124e17998e9731bd9ab94843fdc9b4a635b6d86d29b71bf857218f577a744b4e730a55f775e78d17b0b6391ba077128b0081
|
7
|
+
data.tar.gz: a1f01b4bc11b2756261a2e9bd79118856202057d93e6c05f4d4b980e4230bd3bc37ffbc90a1f08e701b1a6c14d9218881930633053c1e5c129acad5eee2f467b
|
data/README.md
CHANGED
@@ -126,6 +126,9 @@ object_client.files.retrieve(filename: filename_string)
|
|
126
126
|
object_client.files.list
|
127
127
|
object_client.release_tags.create(release: release, what: what, to: to, who: who)
|
128
128
|
|
129
|
+
# Get the events for the object
|
130
|
+
object_client.events.list
|
131
|
+
|
129
132
|
# Create, remove, and reset workspaces
|
130
133
|
object_client.workspace.create(source: object_path_string)
|
131
134
|
object_client.workspace.cleanup
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/json' # required for serializing time as iso8601
|
4
|
+
|
5
|
+
module Dor
|
6
|
+
module Services
|
7
|
+
class Client
|
8
|
+
# API calls that are about retrieving metadata
|
9
|
+
class Events < VersionedService
|
10
|
+
Event = Struct.new(:event_type, :data)
|
11
|
+
|
12
|
+
# @param object_identifier [String] the pid for the object
|
13
|
+
def initialize(connection:, version:, object_identifier:)
|
14
|
+
super(connection: connection, version: version)
|
15
|
+
@object_identifier = object_identifier
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [Array<Events>] The events for an object
|
19
|
+
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
20
|
+
def list
|
21
|
+
resp = connection.get do |req|
|
22
|
+
req.url "#{api_version}/objects/#{object_identifier}/events"
|
23
|
+
end
|
24
|
+
return response_to_models(resp) if resp.success?
|
25
|
+
return if resp.status == 404
|
26
|
+
|
27
|
+
raise UnexpectedResponse, ResponseErrorFormatter.format(response: resp, object_identifier: object_identifier)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
attr_reader :object_identifier
|
33
|
+
|
34
|
+
def response_to_models(resp)
|
35
|
+
JSON.parse(resp.body).map { |data| Event.new(event_type: data['event_type'], data: data['data']) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -19,10 +19,11 @@ module Dor
|
|
19
19
|
# @option opts [Hash] :rights Data for access rights metadata
|
20
20
|
# @option opts [Hash] :content Data for structural metadata
|
21
21
|
# @option opts [Hash] :technical Data for technical metadata
|
22
|
+
# @option opts [Hash] :provenance Data for provenance metadata
|
22
23
|
# @example:
|
23
24
|
# legacy_update(descriptive: { updated: '2001-12-20', content: '<descMetadata />' })
|
24
25
|
def legacy_update(opts)
|
25
|
-
opts = opts.slice(:descriptive, :rights, :content, :technical)
|
26
|
+
opts = opts.slice(:descriptive, :rights, :content, :technical, :provenance)
|
26
27
|
resp = connection.patch do |req|
|
27
28
|
req.url "#{base_path}/legacy"
|
28
29
|
req.headers['Content-Type'] = 'application/json'
|
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: 4.
|
4
|
+
version: 4.4.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: 2020-01-
|
12
|
+
date: 2020-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -212,6 +212,7 @@ files:
|
|
212
212
|
- lib/dor/services/client/collections.rb
|
213
213
|
- lib/dor/services/client/embargo.rb
|
214
214
|
- lib/dor/services/client/error_faraday_middleware.rb
|
215
|
+
- lib/dor/services/client/events.rb
|
215
216
|
- lib/dor/services/client/files.rb
|
216
217
|
- lib/dor/services/client/marcxml.rb
|
217
218
|
- lib/dor/services/client/metadata.rb
|