labimotion 2.3.0.rc3 → 2.3.0.rc4
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/lib/labimotion/libs/converter.rb +43 -5
- data/lib/labimotion/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: bf074c0e6f0eb9c3b52aec0dcde8e8c2a9b2f386027eae477a089e2ff19f4572
|
|
4
|
+
data.tar.gz: 6927c3bc49367aed7830fa2744769deb6fad51c4b24897da10531dab1cb235ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 30cf888e8b21894ebcf8b9bc1b1b7618271a56b73678c5f83e3ce17b420a1f8452c16ecc7b073f3bd756edc33765316714a0247a623479505a4db54a8cc7c1ab
|
|
7
|
+
data.tar.gz: 6938831a6aa29266675e58aba6e092aadc5a1252b7df453376509fe38904a5254eb42a01b333a8954039c1fc7e5b9106ad234cc5a1b71ded6b1b8d0596dbb1a0
|
|
@@ -125,7 +125,6 @@ module Labimotion
|
|
|
125
125
|
tmp_file.rewind
|
|
126
126
|
|
|
127
127
|
filename = oat.filename
|
|
128
|
-
# name = "#{File.basename(filename, '.*')}.zip"
|
|
129
128
|
name = "#{File.basename(filename, '.*')}#{File.extname(filename) == '.zip' ? '.bagit.zip' : '.zip'}"
|
|
130
129
|
att = Attachment.new(
|
|
131
130
|
filename: name,
|
|
@@ -247,14 +246,22 @@ module Labimotion
|
|
|
247
246
|
dsr.each do |ds|
|
|
248
247
|
layer = layers[ds[:layer]]
|
|
249
248
|
next if layer.blank? || layer[Labimotion::Prop::FIELDS].blank?
|
|
249
|
+
is_unit = ds[:field].start_with?(Prop::CONVERTER_FIELD_UINT_PREFIX)
|
|
250
|
+
next if is_unit && ds[:value].nil?
|
|
250
251
|
|
|
251
|
-
|
|
252
|
+
field_name = ds[:field].delete_prefix(Prop::CONVERTER_FIELD_UINT_PREFIX)
|
|
253
|
+
|
|
254
|
+
fields = layer[Labimotion::Prop::FIELDS].select{ |f| f['field'] == field_name }
|
|
252
255
|
fi = fields&.first
|
|
253
256
|
next if fi.blank?
|
|
254
257
|
|
|
255
258
|
idx = layer[Labimotion::Prop::FIELDS].find_index(fi)
|
|
256
|
-
|
|
257
|
-
|
|
259
|
+
if is_unit
|
|
260
|
+
fi['value_system'] = ds[:value]
|
|
261
|
+
else
|
|
262
|
+
fi['value'] = ds[:value]
|
|
263
|
+
fi['device'] = ds[:device] || ds[:value]
|
|
264
|
+
end
|
|
258
265
|
new_prop[Labimotion::Prop::LAYERS][ds[:layer]][Labimotion::Prop::FIELDS][idx] = fi
|
|
259
266
|
end
|
|
260
267
|
element = Container.find(dataset.element_id)&.root_element
|
|
@@ -320,6 +327,37 @@ module Labimotion
|
|
|
320
327
|
res
|
|
321
328
|
end
|
|
322
329
|
|
|
330
|
+
def self.test_conversions(tmpfile, format)
|
|
331
|
+
res = {}
|
|
332
|
+
File.open(tmpfile.path, 'r') do |file|
|
|
333
|
+
body = { file: file, format: format }
|
|
334
|
+
response = HTTParty.post(
|
|
335
|
+
uri('conversions'),
|
|
336
|
+
basic_auth: auth,
|
|
337
|
+
body: body,
|
|
338
|
+
timeout: timeout,
|
|
339
|
+
)
|
|
340
|
+
res = response.parsed_response
|
|
341
|
+
end
|
|
342
|
+
res
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
def self.restore(profile_id, version, hard)
|
|
346
|
+
body = { hard: hard }
|
|
347
|
+
response = HTTParty.post(
|
|
348
|
+
uri("profiles/restore/#{profile_id}/#{version}"),
|
|
349
|
+
headers: {
|
|
350
|
+
"Content-Type" => "application/json"
|
|
351
|
+
},
|
|
352
|
+
basic_auth: auth,
|
|
353
|
+
body: body.to_json,
|
|
354
|
+
timeout: timeout,
|
|
355
|
+
)
|
|
356
|
+
res = response.parsed_response
|
|
357
|
+
|
|
358
|
+
res
|
|
359
|
+
end
|
|
360
|
+
|
|
323
361
|
def self.metadata(id, current_user)
|
|
324
362
|
att = Attachment.find(id)
|
|
325
363
|
return if att.nil? || att.attachable_id.nil? || att.attachable_type != Labimotion::Prop::CONTAINER
|
|
@@ -334,4 +372,4 @@ end
|
|
|
334
372
|
# rubocop: enable Metrics/AbcSize
|
|
335
373
|
# rubocop: enable Metrics/MethodLength
|
|
336
374
|
# rubocop: enable Metrics/ClassLength
|
|
337
|
-
# rubocop: enable Metrics/CyclomaticComplexity
|
|
375
|
+
# rubocop: enable Metrics/CyclomaticComplexity
|
data/lib/labimotion/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: labimotion
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.0.
|
|
4
|
+
version: 2.3.0.rc4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chia-Lin Lin
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-07-
|
|
12
|
+
date: 2026-07-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: caxlsx
|