dicom-package 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ee83a04257b48e02db0329f2b83a33aa1e408837e205502f25a8df9cac84f00c
4
+ data.tar.gz: 173a66a3f93cae30a5ebf7145670056ca8798267878198f4564f01f17a4e1386
5
+ SHA512:
6
+ metadata.gz: 67c43becb40136ec507c50eda7cebb21f32e798f51fdf1f65f8d025fd53265832a325f5ff5d6254631627c5418861c4e764c3ba211da552f4e2c1f8cafbeea77
7
+ data.tar.gz: 07ea1afb0e9da655af9d4f4016df61c502f582a97fb519d72a7f425a2e275e1edfaedd76c9506fca75cdce2530e9d8a6262d0f717baf85fd1cc704b7da4b4e9a
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining
2
+ a copy of this software and associated documentation files (the
3
+ "Software"), to deal in the Software without restriction, including
4
+ without limitation the rights to use, copy, modify, merge, publish,
5
+ distribute, sublicense, and/or sell copies of the Software, and to
6
+ permit persons to whom the Software is furnished to do so, subject to
7
+ the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be
10
+ included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ $:.unshift 'lib'
@@ -0,0 +1,38 @@
1
+ require 'tempfile'
2
+
3
+ module DicomPackage
4
+ class Middleware
5
+ def initialize(app)
6
+ @app = app
7
+ end
8
+
9
+ def call(env)
10
+ if env['CONTENT_TYPE'] =~ /^multipart\/related.*type\="application\/dicom"/ni
11
+ request = Rack::Request.new(env)
12
+
13
+ files = env['rack.request.form_hash'].keys.each_with_object({}).with_index(1) do |(param, memo), index|
14
+ memo[param] = {
15
+ type: 'application/dicom',
16
+ filename: (filename = '%s.dcm' % index),
17
+ tempfile: temporary_file(filename, env['rack.request.form_hash'][param])
18
+ }
19
+
20
+ request.delete_param(param)
21
+ end
22
+
23
+ request.update_param :files, files
24
+ end
25
+
26
+ @app.call(env)
27
+ end
28
+
29
+ private
30
+
31
+ def temporary_file filename, binary
32
+ file = Tempfile.new(filename)
33
+ file.binmode
34
+ file.write(binary)
35
+ file
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,3 @@
1
+ module DicomPackage
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1,3 @@
1
+ module DicomPackage
2
+ autoload :Middleware, 'dicom-package/middleware'
3
+ end
metadata ADDED
@@ -0,0 +1,76 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dicom-package
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - sanzstez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-04-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Middleware that make DICOM params package compatible with rails.
42
+ email:
43
+ - sanzstez@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - LICENSE
49
+ - Rakefile
50
+ - lib/dicom-package.rb
51
+ - lib/dicom-package/middleware.rb
52
+ - lib/dicom-package/version.rb
53
+ homepage: https://github.com/sanzstez/dicom-package
54
+ licenses:
55
+ - MIT
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '2.0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ requirements: []
72
+ rubygems_version: 3.0.9
73
+ signing_key:
74
+ specification_version: 4
75
+ summary: Middleware that make DICOM params package compatible with rails.
76
+ test_files: []