labimotion 1.4.0.rc9 → 1.4.0.rc11

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: fb543b734cfa88ed1f5893b944b47228df997e61574c742e2b9aaa274f45693f
4
- data.tar.gz: 986f63c50927aefb8e916bdce5df5cc65450e25affda62bd439ce7c39c99f5b6
3
+ metadata.gz: 349eb3f74dc52138be867db330fa4cdf18a7a834fb3247961d162ed704590cba
4
+ data.tar.gz: 5b012425c3faf3921be54879ceb7dbae3f9e73a3cfbdc1c6bff8155d3e5ec206
5
5
  SHA512:
6
- metadata.gz: 49535ea3462a5e4c5a14389ab8dc4b55a99ba9bd284561318a4d742b47ce67f1d2cc0ed235f86ad1b1d874345c7f5e4782ab8398ed4e9cc522444e946d849dcf
7
- data.tar.gz: 9b5630097f7a17e752c3e90c5ef3d50b7b6fc72759b5e6755b74188a16f6efdef6b73a9dd9c4763a44916391286663a95602f519155ee7e4ec7c5392799d3bcd
6
+ metadata.gz: 81057d05d05f8f8bfcc1ec2accef2c357f7d4393f2db177937b1c8a8246ece7e2ab0af67691a04f87f133322911aeffc1c85266759a42ed140817c7ec66c4b57
7
+ data.tar.gz: 67ea5a2057eeea3090169993caf874ed95c6aa670aba79b49387428115d6bb7a078bd8903cb322b83d08e187fdffaedb22563f9cbfc7a51d0f1d21747f9bad14
@@ -35,6 +35,31 @@ module Labimotion
35
35
  end
36
36
  end
37
37
 
38
+ resource :structure do
39
+ helpers do
40
+ def convert_structure(molfile)
41
+ molecule_viewer = Matrice.molecule_viewer
42
+ if molecule_viewer.blank? || molecule_viewer[:chembox_endpoint].blank?
43
+ { molfile: molfile }
44
+ else
45
+ options = { timeout: 10, body: { mol: molfile }.to_json, headers: { 'Content-Type' => 'application/json' } }
46
+ response = HTTParty.post(molecule_viewer[:chembox_endpoint], options)
47
+ response.code == 200 ? { molfile: response.parsed_response } : { molfile: molfile }
48
+ end
49
+ end
50
+ end
51
+ desc 'convert molfile to 3d'
52
+ params do
53
+ requires :molfile, type: String, desc: 'Molecule molfile'
54
+ end
55
+ post do
56
+ convert_structure(params[:molfile])
57
+ rescue StandardError => e
58
+ # return { msg: { level: 'error', message: e } }
59
+ { molfile: params[:molfile], msg: { level: 'error', message: e } }
60
+ end
61
+ end
62
+
38
63
  resource :options do
39
64
  before do
40
65
  error!(401) unless current_user.profile&.data['converter_admin'] == true
@@ -11,7 +11,7 @@ module Labimotion
11
11
  def klass_list(el_klass, is_active=false)
12
12
  scope = Labimotion::SegmentKlass.all
13
13
  scope = scope.where(is_active: is_active) if is_active.present? && is_active == true
14
- scope = scope.joins(:element_klass).where(klass_element: params[:element], is_active: true) if el_klass.present?
14
+ scope = scope.joins(:element_klass).where(klass_element: params[:element], is_active: true).preload(:element_klass) if el_klass.present?
15
15
  scope.order('place') || []
16
16
  end
17
17
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '1.4.0.rc9'
5
+ VERSION = '1.4.0.rc11'
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.rc9
4
+ version: 1.4.0.rc11
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-07-22 00:00:00.000000000 Z
12
+ date: 2024-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails