dor-services-client 4.3.0 → 4.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea5ea717e4665296b50157a4e94dbd7e75071ed04e09d4e5aa10b4846f8d9faa
4
- data.tar.gz: 8684e0c7b9585bfe8b5e9a2c1a6a27ebc1c8ceba1a441b9d5c3991531637ca41
3
+ metadata.gz: 5556939287e5a39750be249f7b5ce28ec900db9ba4a23f05eafd8756de12a76e
4
+ data.tar.gz: 9a7e832e1fc627b07e45694539f1b99e1eea17952511be10ed06717c12aa0765
5
5
  SHA512:
6
- metadata.gz: 6248f504d3c8013e5983447c6e93678701da26ebf458899ab0b3a7027788395f215f4fc5a8f7e2b8501f0fd6400d20a762f7e5fd32b4fa97d04dac8885870400
7
- data.tar.gz: d73dd8829103a0ae859f332b99773ef187cd89fbabfb0e87380f6c08ad2e4358927071b91678133407514321527c710a33b930e411533d07562474c0e9ed2a03
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'
@@ -19,6 +19,10 @@ module Dor
19
19
  @metadata ||= Metadata.new(parent_params)
20
20
  end
21
21
 
22
+ def events
23
+ @events ||= Events.new(parent_params)
24
+ end
25
+
22
26
  def files
23
27
  @files ||= Files.new(parent_params)
24
28
  end
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '4.3.0'
6
+ VERSION = '4.4.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: 4.3.0
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-28 00:00:00.000000000 Z
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