labimotion 1.4.0.rc10 → 1.4.0.rc11

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: 1160c0d45fcef0b85fed2c8425d10dd918ef2c1485d642ea209bf351f36a6404
4
- data.tar.gz: aaf504ed78051becf1e7429336799c64468cd6154b91d0eb2a791bd58964a916
3
+ metadata.gz: 349eb3f74dc52138be867db330fa4cdf18a7a834fb3247961d162ed704590cba
4
+ data.tar.gz: 5b012425c3faf3921be54879ceb7dbae3f9e73a3cfbdc1c6bff8155d3e5ec206
5
5
  SHA512:
6
- metadata.gz: fbb7b484dc00070fb61451addf73748a3460d3fc2ccec6571bdc022192d44a3b0df388c4b2dc57934a4ab1121b63854e639225c09712d909dd85c83df4ef0a82
7
- data.tar.gz: a0deb2f4263cdb46e94d240a48077956c41b166b8cc159670b795feb08f4a27f589d4a675fde08245f918f0a92bb0d5b689e8f827b2f6f33a77e2a0c476ccdbc
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '1.4.0.rc10'
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.rc10
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-30 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