dor-services-client 6.2.0 → 6.6.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: 9bfa9e7819d9794826fb95861eb36bcaa9f426280dd96267b2739f4693606c1f
4
- data.tar.gz: df0c3d033e30d17ecafed72c66406dc33ae6f8f682434e43feb8a47f9b97358f
3
+ metadata.gz: c057651f9c343a1a592e2951a815b0d5c0cdec7fa43b2925982b0584aaddf261
4
+ data.tar.gz: 2041a09516b4b2adba053994943e6e07d154740ad4684b790ca5cf8e0b84e1d0
5
5
  SHA512:
6
- metadata.gz: 4edbf5f3ee992ed4accae4225e16d294c9b5aeb8d9c7507164afd2242933040cbf4067b79388c254dfab6263a224d8d6b85655a07a5cf22f4236f41318d5297a
7
- data.tar.gz: d52a6f01e86def397871069447cda06886fd1fc5e94f9af98c651d6d8b7e88e8b170530e89bbf35b89d764aa0ad82a743eb9a1434723db45af920df7a7a4d34e
6
+ metadata.gz: 5432deb7b0e0458aceef04294f306981ac171e36b7f397f184b38ecb61009c15ba1b6fe802dbfc13174303a93695f663062915110fa04e96091d5b22c1b55a38
7
+ data.tar.gz: b30ea0ed92da62ac197ea4ede8149a1a95f79ec937cfb90c08a7b14e24fa2b3ed085fb2ddfc4f2553724b736b745c3eddb6b7200dfc025718b87fe9dc2658865
@@ -1,4 +1,12 @@
1
1
  ## Why was this change made?
2
2
 
3
3
 
4
- ## Was the documentation (README, API, wiki, consul, etc.) updated?
4
+
5
+ ## How was this change tested?
6
+
7
+
8
+
9
+ ## Which documentation and/or configurations were updated?
10
+
11
+
12
+
@@ -32,5 +32,5 @@ Style/Documentation:
32
32
  # Cop supports --auto-correct.
33
33
  # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
34
34
  # URISchemes: http, https
35
- Layout/LineLength:
35
+ Metrics/LineLength:
36
36
  Max: 164
data/README.md CHANGED
@@ -169,6 +169,9 @@ object_client.workspace.reset
169
169
 
170
170
  # Update embargo
171
171
  object_client.embargo.update(embargo_date: date_string, requesting_user: username_string)
172
+
173
+ # Search for administrative tags:
174
+ Dor::Services::Client.administrative_tags.search(q: 'Project')
172
175
  ```
173
176
 
174
177
  ## Asynchronous results
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
 
25
25
  spec.add_dependency 'activesupport', '>= 4.2', '< 7'
26
- spec.add_dependency 'cocina-models', '~> 0.32.0' # leave pinned to patch level until cocina-models hits 1.0
26
+ spec.add_dependency 'cocina-models', '~> 0.33.0' # leave pinned to patch level until cocina-models hits 1.0
27
27
  spec.add_dependency 'deprecation', '>= 0'
28
28
  spec.add_dependency 'faraday', '>= 0.15', '< 2'
29
29
  spec.add_dependency 'moab-versioning', '~> 4.0'
@@ -36,6 +36,9 @@ module Dor
36
36
  # Error that is raised when the remote server returns a 401 Unauthorized
37
37
  class UnauthorizedResponse < UnexpectedResponse; end
38
38
 
39
+ # Error that is raised when the remote server returns a 409 Conflict
40
+ class ConflictResponse < UnexpectedResponse; end
41
+
39
42
  # Error that is raised when the remote server returns some unparsable response
40
43
  class MalformedResponse < Error; end
41
44
 
@@ -56,6 +59,11 @@ module Dor
56
59
  @object = Object.new(connection: connection, version: DEFAULT_VERSION, object_identifier: object_identifier)
57
60
  end
58
61
 
62
+ # @return [Dor::Services::Client::AdministrativeTagSearch] an instance of the `Client::AdministrativeTagSearch` class
63
+ def administrative_tags
64
+ @administrative_tags ||= AdministrativeTagSearch.new(connection: connection, version: DEFAULT_VERSION)
65
+ end
66
+
59
67
  # @return [Dor::Services::Client::Objects] an instance of the `Client::Objects` class
60
68
  def objects
61
69
  @objects ||= Objects.new(connection: connection, version: DEFAULT_VERSION)
@@ -91,7 +99,8 @@ module Dor
91
99
  self
92
100
  end
93
101
 
94
- delegate :background_job_results, :marcxml, :objects, :object, :virtual_objects, to: :instance
102
+ delegate :background_job_results, :marcxml, :objects, :object,
103
+ :virtual_objects, :administrative_tags, to: :instance
95
104
  end
96
105
 
97
106
  attr_writer :url, :token, :connection, :enable_get_retries
@@ -119,10 +128,7 @@ module Dor
119
128
  builder.adapter Faraday.default_adapter
120
129
  builder.headers[:user_agent] = user_agent
121
130
  builder.headers[TOKEN_HEADER] = "Bearer #{token}"
122
- if with_retries
123
- builder.request :retry, max: 4, interval: 1,
124
- backoff_factor: 2, exceptions: ['Faraday::Error', 'Timeout::Error']
125
- end
131
+ builder.request :retry, max: 4, interval: 1, backoff_factor: 2 if with_retries
126
132
  end
127
133
  end
128
134
 
@@ -0,0 +1,25 @@
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 searching AdministrativeTags
9
+ class AdministrativeTagSearch < VersionedService
10
+ # rubocop:disable Naming/UncommunicativeMethodParamName
11
+ def search(q:)
12
+ resp = connection.get do |req|
13
+ req.url "#{api_version}/administrative_tags/search?q=#{q}"
14
+ end
15
+
16
+ # Since argo is using this as a proxy, no need to parse the response.
17
+ return resp.body if resp.success?
18
+
19
+ raise_exception_based_on_response!(resp)
20
+ end
21
+ # rubocop:enable Naming/UncommunicativeMethodParamName
22
+ end
23
+ end
24
+ end
25
+ end
@@ -21,10 +21,11 @@ module Dor
21
21
  # @option opts [Hash] :identity Data for identity metadata
22
22
  # @option opts [Hash] :technical Data for technical metadata
23
23
  # @option opts [Hash] :provenance Data for provenance metadata
24
+ # @option opts [Hash] :geo Data for geographic metadata
24
25
  # @example:
25
26
  # legacy_update(descriptive: { updated: '2001-12-20', content: '<descMetadata />' })
26
27
  def legacy_update(opts)
27
- opts = opts.slice(:descriptive, :rights, :identity, :content, :technical, :provenance)
28
+ opts = opts.slice(:descriptive, :rights, :identity, :content, :technical, :provenance, :geo)
28
29
  resp = connection.patch do |req|
29
30
  req.url "#{base_path}/legacy"
30
31
  req.headers['Content-Type'] = 'application/json'
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '6.2.0'
6
+ VERSION = '6.6.0'
7
7
  end
8
8
  end
9
9
  end
@@ -19,18 +19,22 @@ module Dor
19
19
 
20
20
  attr_reader :connection, :api_version
21
21
 
22
+ # rubocop:disable Metrics/MethodLength
22
23
  def raise_exception_based_on_response!(response, object_identifier = nil)
23
24
  exception_class = case response.status
24
25
  when 404
25
26
  NotFoundResponse
26
27
  when 401
27
28
  UnauthorizedResponse
29
+ when 409
30
+ ConflictResponse
28
31
  else
29
32
  UnexpectedResponse
30
33
  end
31
34
  raise exception_class,
32
35
  ResponseErrorFormatter.format(response: response, object_identifier: object_identifier)
33
36
  end
37
+ # rubocop:enable Metrics/MethodLength
34
38
  end
35
39
  end
36
40
  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: 6.2.0
4
+ version: 6.6.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-05-07 00:00:00.000000000 Z
12
+ date: 2020-06-12 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.32.0
40
+ version: 0.33.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.32.0
47
+ version: 0.33.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: deprecation
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -228,6 +228,7 @@ files:
228
228
  - dor-services-client.gemspec
229
229
  - lib/dor/services/client.rb
230
230
  - lib/dor/services/client/accession.rb
231
+ - lib/dor/services/client/administrative_tag_search.rb
231
232
  - lib/dor/services/client/administrative_tags.rb
232
233
  - lib/dor/services/client/async_result.rb
233
234
  - lib/dor/services/client/background_job_results.rb