-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sergei-krylov
committed
Oct 21, 2014
1 parent
40cc94e
commit c436a9e
Showing
7 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
*.gem | ||
*.rbc | ||
.bundle | ||
.config | ||
.idea | ||
.yardoc | ||
Gemfile.lock | ||
InstalledFiles | ||
_yardoc | ||
coverage | ||
doc/ | ||
lib/bundler/man | ||
pkg | ||
rdoc | ||
spec/reports | ||
test/tmp | ||
test/version_tmp | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
# Specify your gem's dependencies in ruby_ICE_client.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require "bundler/gem_tasks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require 'ruby_ICE_client/version' | ||
require 'nokogiri' | ||
require 'base64' | ||
|
||
module RubyICEClient | ||
class << self | ||
def call(message, url) | ||
xml = Nokogiri::XML::Builder.new | ||
xml.Envelope { | ||
xml.Body { | ||
xml.evaluateAtSpecifiedTime('xmlns:ns2' => 'http://www.omg.org/spec/CDSS/201105/dss') { | ||
xml.interactionId(scopingEntityId: 'gov.nyc.health', interactionId: '123456') | ||
xml.specifiedTime "#{Date.today.strftime('%Y-%m-%d')}" | ||
xml.evaluationRequest(clientLanguage: '', clientTimeZoneOffset: '') { | ||
xml.kmEvaluationRequest { | ||
xml.kmId(scopingEntityId: 'org.nyc.cir', businessId: 'ICE', version: '1.0.0') | ||
} | ||
xml.dataRequirementItemData { | ||
xml.driId(itemId: 'cdsPayload') { | ||
xml.containingEntityId(scopingEntityId: 'gov.nyc.health', businessId: 'ICEData', version: '1.0.0.0') | ||
} | ||
xml.data { | ||
xml.informationModelSSId(scopingEntityId: 'org.opencds.vmr', businessId: 'VMR', version: '1.0') | ||
xml.base64EncodedPayload Base64.encode64 message | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
ns = xml.doc.root.add_namespace_definition 'S', 'http://www.w3.org/2003/05/soap-envelope' | ||
xml.doc.root.namespace = ns | ||
xml.doc.root.child.namespace = ns | ||
|
||
uri = URI.parse url | ||
http = Net::HTTP.new uri.host, uri.port | ||
request = Net::HTTP::Post.new uri.path | ||
request.body = xml.to_xml | ||
response = http.request request | ||
response_xml = Nokogiri::XML response.body | ||
output_message_node = response_xml.xpath '//evaluationResponse//base64EncodedPayload' | ||
|
||
Base64.decode64 output_message_node.first.text | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module RubyICEClient | ||
VERSION = "0.0.1" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../lib', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'ruby_ICE_client/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "ruby_ICE_client" | ||
spec.version = RubyICEClient::VERSION | ||
spec.authors = ["sergei-krylov"] | ||
spec.email = ["[email protected]"] | ||
spec.description = %q{A ruby client for calling ICE - Immunization Calculation Engine (http://www.hln.com/ice/)} | ||
spec.summary = %q{} | ||
spec.homepage = "" | ||
spec.license = "MIT" | ||
|
||
spec.files = `git ls-files`.split($/) | ||
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } | ||
spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_development_dependency "bundler", "~> 1.3" | ||
spec.add_development_dependency "rake" | ||
spec.add_development_dependency "nokogiri", "~> 1.6" | ||
spec.add_development_dependency "base64" | ||
end |