File tree Expand file tree Collapse file tree 11 files changed +136
-3
lines changed
Expand file tree Collapse file tree 11 files changed +136
-3
lines changed Original file line number Diff line number Diff line change 2727
2828# for a library or gem, you might want to ignore these files since the code is
2929# intended to run in multiple environments; otherwise, check them in:
30- # Gemfile.lock
31- # .ruby-version
32- # .ruby-gemset
30+ / Gemfile.lock
31+ / .ruby-version
32+ / .ruby-gemset
3333
3434# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
3535.rvmrc
Original file line number Diff line number Diff line change 1+ language : ruby
2+ before_install : gem install bundler
3+ matrix :
4+ allow_failures :
5+ - rvm : ruby-head
6+ rvm :
7+ - 2.2.0
8+ - 2.1.0
9+ - 2.0.0
10+ - 1.9.3
11+ - ruby-head
12+ - jruby-19mode # JRuby in 1.9 mode
13+ - rbx
Original file line number Diff line number Diff line change 1+ source 'https://rubygems.org'
2+
3+ # Specify your gem's dependencies in ruby-hl7-zef.gemspec
4+ gemspec
5+
6+ group :test , :development do
7+ gem 'rspec' , '~> 2.99.0'
8+ end
Original file line number Diff line number Diff line change 1+ # HL7::ZEF
2+
3+ Adds support for the ZEF segment to [ ` ruby-hl7 ` ] ( https://github.com/ruby-hl7/ruby-hl7 )
4+
5+ ## Installation
6+
7+ Add this line to your application's Gemfile:
8+
9+ ``` ruby
10+ gem ' ruby-hl7-zef'
11+ ```
12+
13+ And then execute:
14+
15+ $ bundle
16+
17+ Or install it yourself as:
18+
19+ $ gem install ruby-hl7-zef
20+
21+ ## Usage
22+
23+ ``` ruby
24+ require ' base64'
25+
26+ msg = HL7 ::Message .parse(hl7_with_zef)
27+ Array (msg[:ZEF ]).each_with_index do |zef , i |
28+ File .write(" zef-#{ i } .pdf" , Base64 .decode64(zef.embedded_pdf))
29+ end
30+ ```
31+
32+ ## Contributing
33+
34+ 1 . Fork it ( https://github.com/[my-github-username ] /ruby-hl7-zef/fork )
35+ 2 . Create your feature branch (` git checkout -b my-new-feature ` )
36+ 3 . Commit your changes (` git commit -am 'Add some feature' ` )
37+ 4 . Push to the branch (` git push origin my-new-feature ` )
38+ 5 . Create a new Pull Request
Original file line number Diff line number Diff line change 1+ require "bundler/gem_tasks"
2+
3+ require "rspec/core/rake_task"
4+ RSpec ::Core ::RakeTask . new ( :spec )
5+
6+ task :default => :spec
Original file line number Diff line number Diff line change 1+ module HL7
2+ class Message ::Segment ::ZEF < HL7 ::Message ::Segment
3+ weight 8
4+ add_field :set_id , :idx => 1 # ZEF-1 "Sequence Number", 1~9999
5+ add_field :embedded_pdf , :idx => 2 # ZEF-2
6+ end
7+ end
8+
9+ HL7 ::Message ::Segment ::OBX . add_child_type :ZEF
Original file line number Diff line number Diff line change 1+ module HL7
2+ module ZEF
3+ VERSION = "1.0.0"
4+ end
5+ end
Original file line number Diff line number Diff line change 1+ require "ruby-hl7"
2+ require "hl7/zef"
3+ require "hl7/zef/version"
Original file line number Diff line number Diff line change 1+ # coding: utf-8
2+ lib = File . expand_path ( '../lib' , __FILE__ )
3+ $LOAD_PATH. unshift ( lib ) unless $LOAD_PATH. include? ( lib )
4+ require 'hl7/zef/version'
5+
6+ Gem ::Specification . new do |spec |
7+ spec . name = "ruby-hl7-zef"
8+ spec . version = HL7 ::ZEF ::VERSION
9+ spec . authors = [ "Enrique Carlos Mogollan" ]
10+ spec . email = [ "emogollan@gmail.com" ]
11+ spec . summary = %q{Provides a custom ZEF segment to the ruby-hl7 gem.}
12+ spec . description = %q{ZEF is a custom segment commonly used to embed PDFs}
13+ spec . homepage = ""
14+
15+ spec . files = `git ls-files -z` . split ( "\x0 " ) . reject { |f | f . match ( %r{^spec/} ) }
16+ spec . test_files = spec . files . grep ( %r{^spec/} )
17+ spec . require_paths = [ "lib" ]
18+
19+ spec . add_dependency "ruby-hl7" , "~> 1.1"
20+ spec . add_development_dependency "bundler" , "~> 1.7"
21+ spec . add_development_dependency "rake" , "~> 10.0"
22+ end
Original file line number Diff line number Diff line change 1+ require 'spec_helper'
2+
3+ describe HL7 ::Message ::Segment ::ZEF do
4+ let ( :zef_segment ) {
5+ %[ZEF|1|embedded-pdf-data]
6+ }
7+
8+ let ( :zef ) {
9+ HL7 ::Message ::Segment ::ZEF . new ( zef_segment )
10+ }
11+
12+ it 'creates a ZEF segment' do
13+ expect ( zef ) . to_not be_nil
14+ end
15+
16+ it 'converts the segment to a string' do
17+ expect ( zef . to_s ) . to eq zef_segment
18+ end
19+
20+ it 'allows access to a ZEF segment' do
21+ expect ( zef . set_id ) . to eq '1'
22+ expect ( zef . embedded_pdf ) . to eq ( 'embedded-pdf-data' )
23+ end
24+
25+ it 'is a child of OBX' do
26+ expect ( HL7 ::Message ::Segment ::OBX . child_types ) . to include ( :ZEF )
27+ end
28+ end
You can’t perform that action at this time.
0 commit comments