labimotion 1.4.0.1 → 1.4.0.2

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: b71d187c31ec221dea2c2ac6d92bf29efbf4004e16b48cf7a2bd0a85cd1dfdd4
4
- data.tar.gz: 4360e6cfe542ae5e9db004c0039187cdd551981abd53f81370a0be5ee10839de
3
+ metadata.gz: 5564b71b1b531e05ab523719dbd1a052c19828c86921f17381ca545554f2c514
4
+ data.tar.gz: ee3b1e84d1aff2619a9ab65901c0f6c20af7288b3b6ef6f7ec49843dd78a543e
5
5
  SHA512:
6
- metadata.gz: 5fe065bae48fbf7a36b1b409a17c7ff1c805bd83ad6f04b43267c024ca25d334dd5ea1092346bea5d38226c0a4bbb773d88c7487bd6adf884ae307e31884335d
7
- data.tar.gz: 5ad569a9c25ef3fc9f454ce60634323ed3da644d1dc663fa949bc779630f25b1d8ba1c54ea21c4c5bd57efb6146e27ebca57e86bfa6fea8a60fad37ce09e93e2
6
+ metadata.gz: a8cfa29e6fbc0ed90c8bec7e581286f2921c461c0ba8fd9b957d98cd88287630f46fe86ab7f86404afd4379623e66296e23e858746b050b66ad76f3290799792
7
+ data.tar.gz: af817bdab6d263afbb26b9efb7313ab505d3b56727e97b7c31149f139bfe6c45b26650ebcabc4614a4e367ff10f6719ffbedb6b9c5acae580c301a50c5379f15
@@ -0,0 +1,13 @@
1
+ # app/api/labimotion/central_api.rb
2
+ module Labimotion
3
+ class LabimotionAPI < Grape::API
4
+ mount Labimotion::ConverterAPI
5
+ mount Labimotion::GenericKlassAPI
6
+ mount Labimotion::GenericElementAPI
7
+ mount Labimotion::GenericDatasetAPI
8
+ mount Labimotion::SegmentAPI
9
+ mount Labimotion::LabimotionHubAPI
10
+ mount Labimotion::StandardLayerAPI
11
+ mount Labimotion::VocabularyAPI
12
+ end
13
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'labimotion/version'
4
+
5
+ module Labimotion
6
+ # Generic Element API
7
+ class VocabularyAPI < Grape::API
8
+ include Grape::Kaminari
9
+ helpers Labimotion::ParamHelpers
10
+
11
+ resource :vocab do
12
+ namespace :save do
13
+ desc 'Save vocabularies'
14
+ params do
15
+ use :std_layer_save
16
+ end
17
+ before do
18
+ rescue ActiveRecord::RecordNotFound
19
+ error!('404 Not Found', 404)
20
+ end
21
+ post do
22
+ rescue ActiveRecord::RecordInvalid => e
23
+ { error: e.message }
24
+ end
25
+ end
26
+
27
+ namespace :field_klasses do
28
+ desc 'get all field klasses for admin function'
29
+ get do
30
+ list = Labimotion::Vocabulary.all.sort_by { |e| e.name }
31
+ present list, with: Labimotion::VocabularyEntity, root: 'klass'
32
+ rescue StandardError => e
33
+ Labimotion.log_exception(e, current_user)
34
+ []
35
+ end
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -232,10 +232,12 @@ module Labimotion
232
232
  new_prop = dataset.properties
233
233
  dsr.each do |ds|
234
234
  layer = layers[ds[:layer]]
235
- next if layer.nil? || layer[Labimotion::Prop::FIELDS].nil?
235
+ next if layer.blank? || layer[Labimotion::Prop::FIELDS].blank?
236
236
 
237
237
  fields = layer[Labimotion::Prop::FIELDS].select{ |f| f['field'] == ds[:field] }
238
238
  fi = fields&.first
239
+ next if fi.blank?
240
+
239
241
  idx = layer[Labimotion::Prop::FIELDS].find_index(fi)
240
242
  fi['value'] = ds[:value]
241
243
  fi['device'] = ds[:device] || ds[:value]
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '1.4.0.1'
5
+ VERSION = '1.4.0.2'
6
6
  end
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: 1.4.0.1
4
+ version: 1.4.0.2
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: 2024-08-22 00:00:00.000000000 Z
12
+ date: 2024-09-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -38,8 +38,10 @@ files:
38
38
  - lib/labimotion/apis/generic_dataset_api.rb
39
39
  - lib/labimotion/apis/generic_element_api.rb
40
40
  - lib/labimotion/apis/generic_klass_api.rb
41
+ - lib/labimotion/apis/labimotion_api.rb
41
42
  - lib/labimotion/apis/labimotion_hub_api.rb
42
43
  - lib/labimotion/apis/segment_api.rb
44
+ - lib/labimotion/apis/vocabulary_api.rb
43
45
  - lib/labimotion/collection/export.rb
44
46
  - lib/labimotion/collection/import.rb
45
47
  - lib/labimotion/conf.rb