hl7-submitter 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +103 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +45 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/bin/submit_hl7.rb +83 -0
- data/lib/hl7-submitter.rb +1 -0
- data/lib/hl7-submitter/cmdline_options.rb +112 -0
- data/spec/cmdline_options_spec.rb +134 -0
- data/spec/spec_helper.rb +29 -0
- metadata +150 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 246cf68970c520f57a3ad7b1ee4f6de88566b282
|
4
|
+
data.tar.gz: 009783ba0a3138c8e62f71907c92e62f51bd2164
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c86f36e6a41e994d4b35921b91b2e82a9a62342715ac9b6acf37c3e70bf49ab64b9e3fc7723a87767adce3dfbf95124126e719cf91971b81d9d45efd3ae529c5
|
7
|
+
data.tar.gz: 2171bc8affdda0e258fb34781256fd2a6230b93f431e12537287bfac1780fffb05bcacc812c9ef5125b85b404e64eaaa2b57aa0bc0570e22cc7a621099cce6a0
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
gem 'savon', '~> 2.0'
|
7
|
+
|
8
|
+
# Add dependencies to develop your gem here.
|
9
|
+
# Include everything needed to run rake, tests, features, etc.
|
10
|
+
group :development do
|
11
|
+
gem "rspec", "~> 3.4"
|
12
|
+
gem "rdoc", "~> 3.12"
|
13
|
+
gem "bundler", "~> 1.0"
|
14
|
+
gem "jeweler", "~> 2.0", ">= 2.0.1"
|
15
|
+
gem "simplecov", "~> 0"
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.4.0)
|
5
|
+
akami (1.3.1)
|
6
|
+
gyoku (>= 0.4.0)
|
7
|
+
nokogiri
|
8
|
+
builder (3.2.2)
|
9
|
+
descendants_tracker (0.0.4)
|
10
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
docile (1.1.5)
|
13
|
+
faraday (0.9.2)
|
14
|
+
multipart-post (>= 1.2, < 3)
|
15
|
+
git (1.3.0)
|
16
|
+
github_api (0.14.1)
|
17
|
+
addressable (~> 2.4.0)
|
18
|
+
descendants_tracker (~> 0.0.4)
|
19
|
+
faraday (~> 0.8, < 0.10)
|
20
|
+
hashie (>= 3.4)
|
21
|
+
oauth2
|
22
|
+
gyoku (1.3.1)
|
23
|
+
builder (>= 2.1.2)
|
24
|
+
hashie (3.4.4)
|
25
|
+
highline (1.7.8)
|
26
|
+
httpi (2.4.2)
|
27
|
+
rack
|
28
|
+
socksify
|
29
|
+
jeweler (2.0.1)
|
30
|
+
builder
|
31
|
+
bundler (>= 1.0)
|
32
|
+
git (>= 1.2.5)
|
33
|
+
github_api
|
34
|
+
highline (>= 1.6.15)
|
35
|
+
nokogiri (>= 1.5.10)
|
36
|
+
rake
|
37
|
+
rdoc
|
38
|
+
json (1.8.3)
|
39
|
+
jwt (1.5.1)
|
40
|
+
mini_portile2 (2.1.0)
|
41
|
+
multi_json (1.12.1)
|
42
|
+
multi_xml (0.5.5)
|
43
|
+
multipart-post (2.0.0)
|
44
|
+
nokogiri (1.6.8)
|
45
|
+
mini_portile2 (~> 2.1.0)
|
46
|
+
pkg-config (~> 1.1.7)
|
47
|
+
nori (2.6.0)
|
48
|
+
oauth2 (1.1.0)
|
49
|
+
faraday (>= 0.8, < 0.10)
|
50
|
+
jwt (~> 1.0, < 1.5.2)
|
51
|
+
multi_json (~> 1.3)
|
52
|
+
multi_xml (~> 0.5)
|
53
|
+
rack (>= 1.2, < 3)
|
54
|
+
pkg-config (1.1.7)
|
55
|
+
rack (1.6.4)
|
56
|
+
rake (11.2.2)
|
57
|
+
rdoc (3.12.2)
|
58
|
+
json (~> 1.4)
|
59
|
+
rspec (3.4.0)
|
60
|
+
rspec-core (~> 3.4.0)
|
61
|
+
rspec-expectations (~> 3.4.0)
|
62
|
+
rspec-mocks (~> 3.4.0)
|
63
|
+
rspec-core (3.4.4)
|
64
|
+
rspec-support (~> 3.4.0)
|
65
|
+
rspec-expectations (3.4.0)
|
66
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
+
rspec-support (~> 3.4.0)
|
68
|
+
rspec-mocks (3.4.1)
|
69
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
70
|
+
rspec-support (~> 3.4.0)
|
71
|
+
rspec-support (3.4.1)
|
72
|
+
savon (2.11.1)
|
73
|
+
akami (~> 1.2)
|
74
|
+
builder (>= 2.1.2)
|
75
|
+
gyoku (~> 1.2)
|
76
|
+
httpi (~> 2.3)
|
77
|
+
nokogiri (>= 1.4.0)
|
78
|
+
nori (~> 2.4)
|
79
|
+
wasabi (~> 3.4)
|
80
|
+
simplecov (0.11.2)
|
81
|
+
docile (~> 1.1.0)
|
82
|
+
json (~> 1.8)
|
83
|
+
simplecov-html (~> 0.10.0)
|
84
|
+
simplecov-html (0.10.0)
|
85
|
+
socksify (1.7.0)
|
86
|
+
thread_safe (0.3.5)
|
87
|
+
wasabi (3.5.0)
|
88
|
+
httpi (~> 2.0)
|
89
|
+
nokogiri (>= 1.4.2)
|
90
|
+
|
91
|
+
PLATFORMS
|
92
|
+
ruby
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
bundler (~> 1.0)
|
96
|
+
jeweler (~> 2.0, >= 2.0.1)
|
97
|
+
rdoc (~> 3.12)
|
98
|
+
rspec (~> 3.4)
|
99
|
+
savon (~> 2.0)
|
100
|
+
simplecov (~> 0)
|
101
|
+
|
102
|
+
BUNDLED WITH
|
103
|
+
1.12.5
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2016 Dave Sieh
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
= hl7-submitter
|
2
|
+
|
3
|
+
A little program used to submit HL7 messages to a Mirth Connect server.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
Well, it's a Ruby gem, so:
|
8
|
+
|
9
|
+
gem install hl7-submitter
|
10
|
+
|
11
|
+
== Usage
|
12
|
+
|
13
|
+
Invoke the binary script like:
|
14
|
+
|
15
|
+
$ submit_hl7.rb
|
16
|
+
|
17
|
+
The command line arguments are:
|
18
|
+
|
19
|
+
$ submit_hl7.rb --help
|
20
|
+
Usage: submit_hl7.rb [options]
|
21
|
+
-a, --auth Use basic auth; must specify username and password. Defaults to false
|
22
|
+
-h, --host HOST Specify the web service host. Defaults to 'localhost'
|
23
|
+
-f, --file PATH Specify the file containing the HL7 data to submit
|
24
|
+
-n, --no-run Don't actually run the service
|
25
|
+
-p, --port PORT Specify the port of the web service host. Defaults to '20440'
|
26
|
+
-u, --username USERNAME Specify the username for authentication.
|
27
|
+
-v, --verbose Display verbose
|
28
|
+
--password PASSWORD Specify the password for authentication.
|
29
|
+
--help Show the help for this script
|
30
|
+
|
31
|
+
== Contributing to hl7-submitter
|
32
|
+
|
33
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
34
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
35
|
+
* Fork the project.
|
36
|
+
* Start a feature/bugfix branch.
|
37
|
+
* Commit and push until you are happy with your contribution.
|
38
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
39
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
40
|
+
|
41
|
+
== Copyright
|
42
|
+
|
43
|
+
Copyright (c) 2016 Dave Sieh. See LICENSE.txt for
|
44
|
+
further details.
|
45
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "hl7-submitter"
|
18
|
+
gem.homepage = "http://github.com/j0hnds/hl7-submitter"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Submit HL7 messages to a Mirth Connect server}
|
21
|
+
gem.description = %Q{Allows you to submit HL7 messages to a Mirth Connect server. Dumps the response to the command line.}
|
22
|
+
gem.email = "dave.sieh@providigm.com"
|
23
|
+
gem.authors = ["Dave Sieh"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Code coverage detail"
|
35
|
+
task :simplecov do
|
36
|
+
ENV['COVERAGE'] = "true"
|
37
|
+
Rake::Task['spec'].execute
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rdoc/task'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "hl7-submitter #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/bin/submit_hl7.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This client uses SAVON to invoke the HL7 service on the
|
4
|
+
# Mirth server.
|
5
|
+
|
6
|
+
# Provides the SAVON client. This allows us to easily send messages
|
7
|
+
# to the Mirth SOAP service.
|
8
|
+
require 'savon'
|
9
|
+
# To encode the HL7 data to be consumed by the Mirth service
|
10
|
+
require 'base64'
|
11
|
+
# For command line parsing
|
12
|
+
require 'hl7-submitter'
|
13
|
+
|
14
|
+
options = CmdlineOptions.new.tap { | clo | clo.parse! }
|
15
|
+
|
16
|
+
if options.verbose?
|
17
|
+
puts "Options specified: #{options.inspect}"
|
18
|
+
end
|
19
|
+
|
20
|
+
hl7_data = options.hl7_data
|
21
|
+
|
22
|
+
if options.verbose?
|
23
|
+
puts "The HL7 data being sent:"
|
24
|
+
puts hl7_data
|
25
|
+
end
|
26
|
+
|
27
|
+
# Build a client against the WSDL of the Mirth SOAP service
|
28
|
+
#
|
29
|
+
# wsdl: The URL to the Mirth service WSDL. The host:port must match the
|
30
|
+
# host:port of the source connector you want to communicate with.
|
31
|
+
#
|
32
|
+
# basic_auth: The username and password to the service. Without this, you
|
33
|
+
# wouldn't be able to connect to the Mirth service at all
|
34
|
+
# (e.g. basic_auth: [ 'user', 'password' ]).
|
35
|
+
#
|
36
|
+
# PCC doesn't want to deal with this, so we'll have to remove
|
37
|
+
# this bit from the setup. This means we'll have to remove the
|
38
|
+
# credentials from the source connector
|
39
|
+
#
|
40
|
+
client_options = {
|
41
|
+
wsdl: "http://#{options.host}:#{options.port}/services/Mirth?wsdl"
|
42
|
+
}
|
43
|
+
|
44
|
+
if options.basic_auth?
|
45
|
+
client_options[:basic_auth] = [ options.username, options.password ]
|
46
|
+
end
|
47
|
+
|
48
|
+
client = Savon.client(client_options)
|
49
|
+
|
50
|
+
# Just debugging; it will list out the operations present for this service.
|
51
|
+
if options.verbose?
|
52
|
+
puts "The available operations: #{client.operations.inspect}"
|
53
|
+
end
|
54
|
+
|
55
|
+
if options.run?
|
56
|
+
# Invoke the service:
|
57
|
+
#
|
58
|
+
# Note that the following reflects the custom Mirth connector
|
59
|
+
# we're using just for PCC. The message provides the following
|
60
|
+
# arguments:
|
61
|
+
#
|
62
|
+
# username: the user for the service
|
63
|
+
# password: the password for the service
|
64
|
+
# data: the actual uuencoded payload of the service.
|
65
|
+
#
|
66
|
+
response = client.call(
|
67
|
+
:submit_message,
|
68
|
+
message: {
|
69
|
+
username: options.username,
|
70
|
+
password: options.password,
|
71
|
+
data: Base64.encode64(hl7_data)
|
72
|
+
}
|
73
|
+
)
|
74
|
+
|
75
|
+
{:submit_message_response=>{:data=>"TVNIfF5+XCZ8YWJhcWlzTWlydGh8MjAwOHxmYXJ0fEdSQVB8MjAxNDA3MDk
|
76
|
+
wMDAwMDB8fEFDS3wxNTQzODN8UHwyLjUKTVNBfEFBfDE1NDM4Mw==", :"@xmlns:ns2"=>"http://www.pointclickcare.com/msg/"}}
|
77
|
+
# Dump the response from the server
|
78
|
+
puts "Here's what we got (as Hash): \n#{response.body}"
|
79
|
+
puts
|
80
|
+
puts "Here's what we got: (as XML): \n#{response.to_xml}"
|
81
|
+
puts
|
82
|
+
puts "Here's the decoded response: \n#{Base64.decode64(response.body[:submit_message_response][:data])}"
|
83
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'hl7-submitter/cmdline_options'
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
class CmdlineOptions
|
4
|
+
attr_reader :options
|
5
|
+
|
6
|
+
DEFAULT_HOST = 'localhost'
|
7
|
+
DEFAULT_PORT = 20440
|
8
|
+
DEFAULT_BASIC_AUTH = false
|
9
|
+
DEFAULT_USERNAME = 'pcc'
|
10
|
+
DEFAULT_PASSWORD = 'Splatter'
|
11
|
+
DEFAULT_VERBOSE = false
|
12
|
+
DEFAULT_RUN = true
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
@options = {
|
16
|
+
host: DEFAULT_HOST,
|
17
|
+
port: DEFAULT_PORT,
|
18
|
+
auth: DEFAULT_BASIC_AUTH,
|
19
|
+
username: DEFAULT_USERNAME,
|
20
|
+
password: DEFAULT_PASSWORD,
|
21
|
+
verbose: DEFAULT_VERBOSE,
|
22
|
+
run: DEFAULT_RUN
|
23
|
+
}
|
24
|
+
|
25
|
+
@option_parser = OptionParser.new do | opts |
|
26
|
+
opts.banner = 'Usage: submit_hl7.rb [options]'
|
27
|
+
|
28
|
+
opts.on('-a', '--auth', "Use basic auth; must specify username and password. Defaults to false") do
|
29
|
+
@options[:auth] = true
|
30
|
+
end
|
31
|
+
|
32
|
+
opts.on('-h', '--host HOST', "Specify the web service host. Defaults to '#{@options[:host]}'") do | host |
|
33
|
+
@options[:host] = host
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on('-f', '--file PATH', "Specify the file containing the HL7 data to submit") do | path |
|
37
|
+
@options[:file] = path
|
38
|
+
end
|
39
|
+
|
40
|
+
opts.on('-n', '--no-run', "Don't actually run the service") do
|
41
|
+
@options[:run] = false
|
42
|
+
end
|
43
|
+
|
44
|
+
opts.on('-p', '--port PORT', Integer, "Specify the port of the web service host. Defaults to '#{@options[:port]}'") do | port |
|
45
|
+
@options[:port] = port
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.on('-u', '--username USERNAME', "Specify the username for authentication.") do | username |
|
49
|
+
@options[:username] = username
|
50
|
+
end
|
51
|
+
|
52
|
+
opts.on('-v', '--verbose', "Display verbose") do
|
53
|
+
@options[:verbose] = true
|
54
|
+
end
|
55
|
+
|
56
|
+
opts.on('--password PASSWORD', "Specify the password for authentication.") do | password |
|
57
|
+
@options[:password] = password
|
58
|
+
end
|
59
|
+
|
60
|
+
opts.on('--help', "Show the help for this script") do
|
61
|
+
puts opts
|
62
|
+
exit
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def parse!(argv=@option_parser.default_argv)
|
69
|
+
@option_parser.parse!(argv)
|
70
|
+
end
|
71
|
+
|
72
|
+
def verbose?
|
73
|
+
options[:verbose]
|
74
|
+
end
|
75
|
+
|
76
|
+
def basic_auth?
|
77
|
+
options[:auth]
|
78
|
+
end
|
79
|
+
|
80
|
+
def run?
|
81
|
+
options[:run]
|
82
|
+
end
|
83
|
+
|
84
|
+
def host
|
85
|
+
options[:host]
|
86
|
+
end
|
87
|
+
|
88
|
+
def port
|
89
|
+
options[:port]
|
90
|
+
end
|
91
|
+
|
92
|
+
def username
|
93
|
+
options[:username]
|
94
|
+
end
|
95
|
+
|
96
|
+
def password
|
97
|
+
options[:password]
|
98
|
+
end
|
99
|
+
|
100
|
+
def hl7_data
|
101
|
+
if options[:file]
|
102
|
+
File.read(options[:file])
|
103
|
+
else
|
104
|
+
# The HL7 message to send
|
105
|
+
'MSH|^~\&|PCC|2008|fart|GRAP|20140709000000||ADT^A03|154383|T|2.5
|
106
|
+
EVN|A03|20140709000000|||grap|19570711000000
|
107
|
+
PID|1||121212121^^^^FI~130104^6102^^^HC~130104^^^^PN~121212121^^^^SS||Brooks^susie||19570711000000|F||||||||||130104|121212121
|
108
|
+
PV1|1|I|^^^^^N^19|||||||||||||||2||||||||||||||||||||||||||20140421000000|20140708000000'
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe CmdlineOptions do
|
4
|
+
let(:cmd_options) { CmdlineOptions.new }
|
5
|
+
|
6
|
+
describe "Option Defaults" do
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
cmd_options.parse!([])
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have verbose turned off" do
|
13
|
+
expect(cmd_options.verbose?).to be_falsey
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have basic_auth turned off" do
|
17
|
+
expect(cmd_options.basic_auth?).to be_falsey
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have run turned on" do
|
21
|
+
expect(cmd_options.run?).to be_truthy
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have a default host of 'localhost'" do
|
25
|
+
expect(cmd_options.host).to eq('localhost')
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should have a default port of 20440" do
|
29
|
+
expect(cmd_options.port).to eq(20440)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should have a default username of 'pcc'" do
|
33
|
+
expect(cmd_options.username).to eq('pcc')
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should have a default password of 'Splatter'" do
|
37
|
+
expect(cmd_options.password).to eq('Splatter')
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should always return some hl7 data" do
|
41
|
+
expect(cmd_options.hl7_data).not_to be_empty
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "Short options" do
|
47
|
+
before(:each) do
|
48
|
+
cmd_options.parse!([ "-a",
|
49
|
+
"-h", "www.thing.com",
|
50
|
+
"-f", "Gemfile",
|
51
|
+
"-n",
|
52
|
+
"-p", "2301",
|
53
|
+
"-u", "myuser",
|
54
|
+
"-v"])
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should have verbose turned on" do
|
59
|
+
expect(cmd_options.verbose?).to be_truthy
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should have basic_auth turned on" do
|
63
|
+
expect(cmd_options.basic_auth?).to be_truthy
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should have run turned off" do
|
67
|
+
expect(cmd_options.run?).to be_falsey
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should have a host of 'www.thing.com'" do
|
71
|
+
expect(cmd_options.host).to eq('www.thing.com')
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should have a port of 2301" do
|
75
|
+
expect(cmd_options.port).to eq(2301)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should have a username of 'myuser'" do
|
79
|
+
expect(cmd_options.username).to eq('myuser')
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should always return some hl7 data" do
|
83
|
+
expect(cmd_options.hl7_data).not_to be_empty
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "Long options" do
|
89
|
+
before(:each) do
|
90
|
+
cmd_options.parse!([ "-auth",
|
91
|
+
"--host", "www.thing.com",
|
92
|
+
"--file", "Gemfile",
|
93
|
+
"--no-run",
|
94
|
+
"--port", "2301",
|
95
|
+
"--password", "mypass",
|
96
|
+
"--username", "myuser",
|
97
|
+
"--verbose"])
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should have verbose turned on" do
|
102
|
+
expect(cmd_options.verbose?).to be_truthy
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should have basic_auth turned on" do
|
106
|
+
expect(cmd_options.basic_auth?).to be_truthy
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should have run turned off" do
|
110
|
+
expect(cmd_options.run?).to be_falsey
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should have a host of 'www.thing.com'" do
|
114
|
+
expect(cmd_options.host).to eq('www.thing.com')
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should have a port of 2301" do
|
118
|
+
expect(cmd_options.port).to eq(2301)
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should have a username of 'myuser'" do
|
122
|
+
expect(cmd_options.username).to eq('myuser')
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should have a password of 'mypass'" do
|
126
|
+
expect(cmd_options.password).to eq('mypass')
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should always return some hl7 data" do
|
130
|
+
expect(cmd_options.hl7_data).not_to be_empty
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
module SimpleCov::Configuration
|
4
|
+
def clean_filters
|
5
|
+
@filters = []
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
SimpleCov.configure do
|
10
|
+
clean_filters
|
11
|
+
load_profile 'test_frameworks'
|
12
|
+
end
|
13
|
+
|
14
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
+
add_filter "/.rvm/"
|
16
|
+
end
|
17
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
18
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
19
|
+
|
20
|
+
require 'rspec'
|
21
|
+
require 'hl7-submitter'
|
22
|
+
|
23
|
+
# Requires supporting files with custom matchers and macros, etc,
|
24
|
+
# in ./support/ and its subdirectories.
|
25
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
26
|
+
|
27
|
+
RSpec.configure do |config|
|
28
|
+
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hl7-submitter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dave Sieh
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: savon
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.4'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jeweler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.0.1
|
76
|
+
- - "~>"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '2.0'
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.0.1
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: simplecov
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
description: Allows you to submit HL7 messages to a Mirth Connect server. Dumps the
|
104
|
+
response to the command line.
|
105
|
+
email: dave.sieh@providigm.com
|
106
|
+
executables:
|
107
|
+
- submit_hl7.rb
|
108
|
+
extensions: []
|
109
|
+
extra_rdoc_files:
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.rdoc
|
112
|
+
files:
|
113
|
+
- ".document"
|
114
|
+
- ".rspec"
|
115
|
+
- Gemfile
|
116
|
+
- Gemfile.lock
|
117
|
+
- LICENSE.txt
|
118
|
+
- README.rdoc
|
119
|
+
- Rakefile
|
120
|
+
- VERSION
|
121
|
+
- bin/submit_hl7.rb
|
122
|
+
- lib/hl7-submitter.rb
|
123
|
+
- lib/hl7-submitter/cmdline_options.rb
|
124
|
+
- spec/cmdline_options_spec.rb
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
homepage: http://github.com/j0hnds/hl7-submitter
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata: {}
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 2.4.8
|
147
|
+
signing_key:
|
148
|
+
specification_version: 4
|
149
|
+
summary: Submit HL7 messages to a Mirth Connect server
|
150
|
+
test_files: []
|