sdr-client 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee6cf6f853cdced4466b332418b612995059f4b4e0ccb815304ddc6284c650bf
4
- data.tar.gz: 61144422d1b60823942da6aa7295afc86afc0844af10187dadd7c1e83a6e18c5
3
+ metadata.gz: '0389c464ad43e038268dc5242aff43d16229135dfead77a90a4ff8bba3e6009f'
4
+ data.tar.gz: 2c1ec7488c915f3a82a4f8c5d822539bec42ce1364163740301aa6ef5bcc771e
5
5
  SHA512:
6
- metadata.gz: 9b45b8adb122a9f69192fffeb39d05f98178aeff268194f779de3c79735af5cce6bfca54a2e5eb8b2adc2c26a2d5c2cefd4bb35dcb0ee5994321ee4e9c20ff57
7
- data.tar.gz: 851da7520cce9fa8005f3c50b92fb21fd2b9ea9d8eac18b86cf0ddd06307609091005708e9d0d6372f7316a11117bc1362de4deb4fe368746ae109c293e7e803
6
+ metadata.gz: c756bb46d362597a15907ce763b6212735745074e8604bfc34ed9f712f719c770103353003c93df7e014e066d74a3473da30c5f0d5186563892a7f4df10ff8b9
7
+ data.tar.gz: b5322b234dce3fcf3a8b3cfa5b40da2f65b4bcc7fcccba6f6cfe4f107e0e2dac688a804056d154c65c54259344b454c6f0de630b680aeb4fc4d9e0daaaff156f
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby-rails: sul-dlss/ruby-rails@3.2.0
3
+ ruby-rails: sul-dlss/ruby-rails@4.0.0
4
4
  workflows:
5
5
  build:
6
6
  jobs:
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sdr-client (2.4.0)
4
+ sdr-client (2.5.0)
5
5
  activesupport
6
6
  cocina-models (~> 0.90.0)
7
7
  config
@@ -12,12 +12,12 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (7.0.4.3)
15
+ activesupport (7.0.5)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 1.6, < 2)
18
18
  minitest (>= 5.1)
19
19
  tzinfo (~> 2.0)
20
- addressable (2.8.1)
20
+ addressable (2.8.4)
21
21
  public_suffix (>= 2.0.2, < 6.0)
22
22
  ast (2.4.2)
23
23
  attr_extras (7.1.0)
@@ -37,9 +37,9 @@ GEM
37
37
  super_diff
38
38
  thor
39
39
  zeitwerk (~> 2.1)
40
- commonmarker (0.23.8)
40
+ commonmarker (0.23.9)
41
41
  concurrent-ruby (1.2.2)
42
- config (4.1.0)
42
+ config (4.2.0)
43
43
  deep_merge (~> 1.2, >= 1.2.1)
44
44
  dry-validation (~> 1.0, >= 1.0.0)
45
45
  crack (0.4.5)
@@ -65,12 +65,12 @@ GEM
65
65
  concurrent-ruby (~> 1.0)
66
66
  dry-core (~> 1.0, < 2)
67
67
  zeitwerk (~> 2.6)
68
- dry-schema (1.13.0)
68
+ dry-schema (1.13.2)
69
69
  concurrent-ruby (~> 1.0)
70
70
  dry-configurable (~> 1.0, >= 1.0.1)
71
71
  dry-core (~> 1.0, < 2)
72
72
  dry-initializer (~> 3.0)
73
- dry-logic (>= 1.5, < 2)
73
+ dry-logic (>= 1.4, < 2)
74
74
  dry-types (>= 1.7, < 2)
75
75
  zeitwerk (~> 2.6)
76
76
  dry-struct (1.6.0)
@@ -94,47 +94,48 @@ GEM
94
94
  activesupport (>= 3.0, < 8.0)
95
95
  equivalent-xml (0.6.0)
96
96
  nokogiri (>= 1.4.3)
97
- faraday (2.7.4)
97
+ faraday (2.7.6)
98
98
  faraday-net_http (>= 2.0, < 3.1)
99
99
  ruby2_keywords (>= 0.0.4)
100
100
  faraday-net_http (3.0.2)
101
101
  hashdiff (1.0.1)
102
- i18n (1.12.0)
102
+ i18n (1.14.1)
103
103
  concurrent-ruby (~> 1.0)
104
104
  ice_nine (0.11.2)
105
105
  json (2.6.3)
106
- jsonpath (1.1.2)
106
+ jsonpath (1.1.3)
107
107
  multi_json
108
108
  launchy (2.5.2)
109
109
  addressable (~> 2.8)
110
110
  minitest (5.18.0)
111
111
  multi_json (1.15.0)
112
- nokogiri (1.14.2-x86_64-darwin)
112
+ nokogiri (1.15.2-x86_64-darwin)
113
113
  racc (~> 1.4)
114
- nokogiri (1.14.2-x86_64-linux)
114
+ nokogiri (1.15.2-x86_64-linux)
115
115
  racc (~> 1.4)
116
116
  openapi3_parser (0.9.2)
117
117
  commonmarker (~> 0.17)
118
118
  openapi_parser (0.15.0)
119
119
  optimist (3.0.1)
120
- parallel (1.22.1)
121
- parser (3.2.1.1)
120
+ parallel (1.23.0)
121
+ parser (3.2.2.3)
122
122
  ast (~> 2.4.1)
123
+ racc
123
124
  patience_diff (1.2.0)
124
125
  optimist (~> 3.0)
125
126
  public_suffix (5.0.1)
126
- racc (1.6.2)
127
+ racc (1.7.0)
127
128
  rainbow (3.1.1)
128
129
  rake (13.0.6)
129
- regexp_parser (2.7.0)
130
+ regexp_parser (2.8.1)
130
131
  rexml (3.2.5)
131
132
  rspec (3.12.0)
132
133
  rspec-core (~> 3.12.0)
133
134
  rspec-expectations (~> 3.12.0)
134
135
  rspec-mocks (~> 3.12.0)
135
- rspec-core (3.12.1)
136
+ rspec-core (3.12.2)
136
137
  rspec-support (~> 3.12.0)
137
- rspec-expectations (3.12.2)
138
+ rspec-expectations (3.12.3)
138
139
  diff-lcs (>= 1.2.0, < 2.0)
139
140
  rspec-support (~> 3.12.0)
140
141
  rspec-mocks (3.12.5)
@@ -145,25 +146,28 @@ GEM
145
146
  rspec-core (>= 2, < 4, != 2.12.0)
146
147
  rss (0.2.9)
147
148
  rexml
148
- rubocop (1.48.1)
149
+ rubocop (1.52.1)
149
150
  json (~> 2.3)
150
151
  parallel (~> 1.10)
151
- parser (>= 3.2.0.0)
152
+ parser (>= 3.2.2.3)
152
153
  rainbow (>= 2.2.2, < 4.0)
153
154
  regexp_parser (>= 1.8, < 3.0)
154
155
  rexml (>= 3.2.5, < 4.0)
155
- rubocop-ast (>= 1.26.0, < 2.0)
156
+ rubocop-ast (>= 1.28.0, < 2.0)
156
157
  ruby-progressbar (~> 1.7)
157
158
  unicode-display_width (>= 2.4.0, < 3.0)
158
- rubocop-ast (1.28.0)
159
+ rubocop-ast (1.29.0)
159
160
  parser (>= 3.2.1.0)
160
- rubocop-capybara (2.17.1)
161
+ rubocop-capybara (2.18.0)
161
162
  rubocop (~> 1.41)
163
+ rubocop-factory_bot (2.23.1)
164
+ rubocop (~> 1.33)
162
165
  rubocop-rake (0.6.0)
163
166
  rubocop (~> 1.0)
164
- rubocop-rspec (2.19.0)
167
+ rubocop-rspec (2.22.0)
165
168
  rubocop (~> 1.33)
166
169
  rubocop-capybara (~> 2.17)
170
+ rubocop-factory_bot (~> 2.22)
167
171
  ruby-progressbar (1.13.0)
168
172
  ruby2_keywords (0.0.5)
169
173
  simplecov (0.22.0)
@@ -176,7 +180,7 @@ GEM
176
180
  attr_extras (>= 6.2.4)
177
181
  diff-lcs
178
182
  patience_diff
179
- thor (1.2.1)
183
+ thor (1.2.2)
180
184
  tzinfo (2.0.6)
181
185
  concurrent-ruby (~> 1.0)
182
186
  unicode-display_width (2.4.2)
@@ -184,7 +188,7 @@ GEM
184
188
  addressable (>= 2.8.0)
185
189
  crack (>= 0.3.2)
186
190
  hashdiff (>= 0.4.0, < 2.0.0)
187
- zeitwerk (2.6.7)
191
+ zeitwerk (2.6.8)
188
192
 
189
193
  PLATFORMS
190
194
  x86_64-darwin-19
@@ -206,4 +210,4 @@ DEPENDENCIES
206
210
  webmock (~> 3.7)
207
211
 
208
212
  BUNDLED WITH
209
- 2.3.22
213
+ 2.4.13
@@ -10,19 +10,37 @@ module SdrClient
10
10
  checksum = Digest::MD5.file(path).base64digest
11
11
  new(checksum: checksum,
12
12
  byte_size: ::File.size(path),
13
- content_type: content_type || 'application/octet-stream',
13
+ content_type: clean_and_translate_content_type(content_type),
14
14
  filename: file_name)
15
15
  end
16
16
 
17
17
  def as_json
18
18
  {
19
- blob: { filename: filename, byte_size: byte_size, checksum: checksum, content_type: content_type }
19
+ blob: { filename: filename, byte_size: byte_size, checksum: checksum,
20
+ content_type: self.class.clean_and_translate_content_type(content_type) }
20
21
  }
21
22
  end
22
23
 
23
24
  def to_json(*_args)
24
25
  JSON.generate(as_json)
25
26
  end
27
+
28
+ # Invalid JSON files with a content type of application/json will trigger 400 errors in sdr-api
29
+ # since they are parsed and rejected (not clear why and what part of the stack is doing this).
30
+ # The work around is to change the content_type for any JSON files to a custom stand-in and
31
+ # specific to avoid the parsing, and then have this translated back to application/json after .
32
+ # upload is complete. There is a corresponding change in sdr-api to translate the content_type back
33
+ # before the Cocina is saved.
34
+ # See https://github.com/sul-dlss/happy-heron/issues/3075 for the original bug report
35
+ # See https://github.com/sul-dlss/sdr-api/pull/585 for the change in sdr-api
36
+ def self.clean_and_translate_content_type(content_type)
37
+ return 'application/octet-stream' if content_type.blank?
38
+
39
+ # ActiveStorage is expecting "application/x-stata-dta" not "application/x-stata-dta;version=14"
40
+ content_type = content_type.split(';')&.first
41
+
42
+ content_type == 'application/json' ? 'application/x-stanford-json' : content_type
43
+ end
26
44
  end
27
45
  end
28
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '2.4.0'
4
+ VERSION = '2.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdr-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-31 00:00:00.000000000 Z
11
+ date: 2023-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -304,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
304
  - !ruby/object:Gem::Version
305
305
  version: '0'
306
306
  requirements: []
307
- rubygems_version: 3.2.32
307
+ rubygems_version: 3.4.13
308
308
  signing_key:
309
309
  specification_version: 4
310
310
  summary: The CLI for https://github.com/sul-dlss/sdr-api