mml-ruby 0.0.1
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 +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/LICENSE +13 -0
- data/README.md +36 -0
- data/Rakefile +6 -0
- data/lib/mml.rb +22 -0
- data/lib/mml/common.rb +306 -0
- data/mml-ruby.gemspec +26 -0
- data/spec/mml/address_spec.rb +67 -0
- data/spec/mml/base_spec.rb +11 -0
- data/spec/mml/creator_info_spec.rb +48 -0
- data/spec/mml/creator_license_spec.rb +16 -0
- data/spec/mml/department_spec.rb +48 -0
- data/spec/mml/external_ref_spec.rb +37 -0
- data/spec/mml/facility_name_spec.rb +18 -0
- data/spec/mml/facility_spec.rb +50 -0
- data/spec/mml/identification_spec.rb +61 -0
- data/spec/mml/name_spec.rb +67 -0
- data/spec/mml/personalized_info_spec.rb +79 -0
- data/spec/mml/phone_spec.rb +48 -0
- data/spec/spec_helper.rb +8 -0
- metadata +150 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 72e0e8b2cf0a3af44cae8cfad91c6881d11aacc8
|
4
|
+
data.tar.gz: 620cda5a27d64f3e487ef21f0fa0a16b29a35cd9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 873e3037b21b6a874a6c6e513d4938e02f76829443980ce5268a6288646a99b5dada2fe9d4d18b4a9dba54cbf2b55f9f8b5c097fd603dac96d7296f0156d699a
|
7
|
+
data.tar.gz: 00a926a915a2baae33b0339dbb5561aa98eeadbbe2ef970b935f5c99fd249e5be8a18211128c1be5d7e5dbbda2bdc5e42f5bd39ac316319692c35608d52ffc91
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2013, Shinji KOBAYASHI
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
[](https://travis-ci.org/skoba/mml-ruby)
|
2
|
+
|
3
|
+
# Ruby MML(Medical Markup Language) implementation
|
4
|
+
|
5
|
+
This is an preliminary implementation for MML by Ruby.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'mml-ruby'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install mml-ruby
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Make MML from data model and write it to XML form.
|
24
|
+
|
25
|
+
## License
|
26
|
+
|
27
|
+
This product is provided under Apache 2 license.
|
28
|
+
See LICENSE file in detail.
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
1. Fork it
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
36
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/mml.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'builder'
|
2
|
+
|
3
|
+
module MML
|
4
|
+
MML_NAMESPACE = 'xmlns:mml="http://www.medxml.net/MML"'
|
5
|
+
|
6
|
+
class Base
|
7
|
+
def namespace
|
8
|
+
MML_NAMESPACE
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_xml
|
12
|
+
@xb = Builder::XmlMarkup.new
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class V2Base < Base
|
17
|
+
VERSION = '2.3'
|
18
|
+
end
|
19
|
+
|
20
|
+
require_relative 'mml/common'
|
21
|
+
require_relative 'mml/version'
|
22
|
+
end
|
data/lib/mml/common.rb
ADDED
@@ -0,0 +1,306 @@
|
|
1
|
+
require 'builder'
|
2
|
+
|
3
|
+
module MML
|
4
|
+
class BaseName
|
5
|
+
attr_reader :value, :repCode
|
6
|
+
attr_accessor :tableId
|
7
|
+
|
8
|
+
def initialize(args ={})
|
9
|
+
%W(value repCode tableId).each do |item|
|
10
|
+
self.send("#{item}=", args[item.to_sym])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def value=(value)
|
15
|
+
raise ArgumentError, 'value is mandatory' if value.nil?
|
16
|
+
@value = value
|
17
|
+
end
|
18
|
+
|
19
|
+
def repCode=(repCode)
|
20
|
+
raise ArgumentError, 'repCode is mandatory' if repCode.nil?
|
21
|
+
@repCode = repCode
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class FacilityName < BaseName
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
class DepartmentName < BaseName
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
class Name < BaseName
|
34
|
+
attr_accessor :family, :given, :middle, :fullname, :prefix, :degree
|
35
|
+
|
36
|
+
def initialize(args = {})
|
37
|
+
%W(family given middle fullname prefix degree repCode tableId).each do |item|
|
38
|
+
self.send("#{item}=", args[item.to_sym])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
undef value=
|
43
|
+
|
44
|
+
def to_xml
|
45
|
+
xb = Builder::XmlMarkup.new
|
46
|
+
xb.mmlNm(:Name, {'mmlNm:repCode' => @repCode, 'mmlNm:tableId' => @tableId}) do
|
47
|
+
xb.mmlNm :family, @family if @family
|
48
|
+
xb.mmlNm :middle, @middle if @middle
|
49
|
+
xb.mmlNm :given, @given if @given
|
50
|
+
xb.mmlNm :fullname, @fullname if @fullname
|
51
|
+
xb.mmlNm :prefix, @prefix if @prefix
|
52
|
+
xb.mmlNm :degree, @degree if @degree
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
class Id
|
58
|
+
attr_reader :value, :type, :tableId
|
59
|
+
attr_accessor :checkDigit, :checkDigitSchema
|
60
|
+
|
61
|
+
def initialize(args = {})
|
62
|
+
self.value = args[:value]
|
63
|
+
self.type = args[:type]
|
64
|
+
self.tableId = args[:tableId]
|
65
|
+
self.checkDigit = args[:checkDigit]
|
66
|
+
self.checkDigitSchema = args[:checkDigitSchema]
|
67
|
+
end
|
68
|
+
|
69
|
+
def value=(value)
|
70
|
+
raise ArgumentError, 'value should not be nil' if value.nil? or value.empty?
|
71
|
+
@value = value
|
72
|
+
end
|
73
|
+
|
74
|
+
def type=(type)
|
75
|
+
raise ArgumentError, 'type should no be nil' if type.nil? or type.empty?
|
76
|
+
@type = type
|
77
|
+
end
|
78
|
+
|
79
|
+
def tableId=(tableId)
|
80
|
+
raise ArgumentError, 'table id is required' if tableId.nil? or type.empty?
|
81
|
+
@tableId = tableId
|
82
|
+
end
|
83
|
+
|
84
|
+
def to_xml
|
85
|
+
xb = Builder::XmlMarkup.new
|
86
|
+
attributes = {'mmlCm:type' => type, 'mmlCm:tableId' => tableId }
|
87
|
+
attributes['mmlCm:checkDigit'] = checkDigit if checkDigit
|
88
|
+
attributes['mmlCm:checkDigitSchema'] = checkDigitSchema if checkDigitSchema
|
89
|
+
xb.mmlCm :Id, value, attributes
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
class ExtRef
|
94
|
+
attr_accessor :contentType, :medicalRole, :title
|
95
|
+
attr_reader :href
|
96
|
+
|
97
|
+
def initialize(args = {})
|
98
|
+
self.contentType = args[:contentType]
|
99
|
+
self.medicalRole = args[:medicalRole]
|
100
|
+
self.title = args[:title]
|
101
|
+
self.href = args[:href]
|
102
|
+
end
|
103
|
+
|
104
|
+
def href=(href)
|
105
|
+
raise ArgumentError, 'href is mandatory' if href.nil?
|
106
|
+
@href = href
|
107
|
+
end
|
108
|
+
|
109
|
+
def to_xml
|
110
|
+
xb = Builder::XmlMarkup.new
|
111
|
+
attributes = { 'mmlCm:href' => href }
|
112
|
+
attributes['mmlCm:contentType'] = contentType if contentType
|
113
|
+
attributes['mmlCm:medicalRole'] = medicalRole if medicalRole
|
114
|
+
attributes['mmlCm:title'] = title if title
|
115
|
+
xb.mmlCm :extRef, attributes
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
class Address
|
120
|
+
attr_reader :repCode
|
121
|
+
attr_accessor :addressClass, :tableId, :homeNumber, :town, :city, :prefecture, :full, :zip, :countryCode
|
122
|
+
|
123
|
+
def initialize(args = {})
|
124
|
+
%W(repCode addressClass tableId full homeNumber town city prefecture zip countryCode).each do |item|
|
125
|
+
self.send("#{item}=", args[item.to_sym])
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def repCode=(repCode)
|
130
|
+
raise ArgumentError, 'repCode is mandatory' if repCode.nil?
|
131
|
+
@repCode = repCode
|
132
|
+
end
|
133
|
+
|
134
|
+
def to_xml
|
135
|
+
xb = Builder::XmlMarkup.new
|
136
|
+
attributes = { 'mmlAd:repCode' => repCode }
|
137
|
+
attributes['mmlAd:addressClass'] = addressClass
|
138
|
+
attributes['mmlAd:tableId'] = tableId
|
139
|
+
xb.mmlAd :Address, attributes do
|
140
|
+
xb.mmlAd :homeNumber, homeNumber if homeNumber
|
141
|
+
xb.mmlAd :town, town if town
|
142
|
+
xb.mmlAd :city, city if city
|
143
|
+
xb.mmlAd :prefecture, prefecture if prefecture
|
144
|
+
xb.mmlAd :full, full if full
|
145
|
+
xb.mmlAd :zip, zip if zip
|
146
|
+
xb.mmlAd :countryCode, countryCode if countryCode
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
class Phone
|
152
|
+
attr_accessor :telEquipType, :area, :city, :number, :extension, :country, :memo
|
153
|
+
|
154
|
+
def initialize(args = {})
|
155
|
+
%W(telEquipType area city number extension country memo).each do |item|
|
156
|
+
self.send("#{item}=", args[item.to_sym])
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def to_xml
|
161
|
+
xb = Builder::XmlMarkup.new
|
162
|
+
attributes = {'mmlPh:telEquipType' => telEquipType} if telEquipType
|
163
|
+
xb.mmlPh :Phone, attributes do
|
164
|
+
xb.mmlPh :area, area if area
|
165
|
+
xb.mmlPh :city, city if city
|
166
|
+
xb.mmlPh :number, number if number
|
167
|
+
xb.mmlPh :extension, extension if extension
|
168
|
+
xb.mmlPh :country, country if country
|
169
|
+
xb.mmlPh :memo, memo if memo
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
class Facility
|
175
|
+
attr_reader :name
|
176
|
+
attr_accessor :id
|
177
|
+
|
178
|
+
def initialize(args = {})
|
179
|
+
%W(name id).each do |item|
|
180
|
+
self.send("#{item}=", args[item.to_sym])
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def name=(name)
|
185
|
+
raise ArgumentError, 'name is mandatory' if name.nil? or name.empty?
|
186
|
+
@name = name
|
187
|
+
end
|
188
|
+
|
189
|
+
def to_xml
|
190
|
+
xb = Builder::XmlMarkup.new
|
191
|
+
xb.mmlFc :Facility do
|
192
|
+
name.each do |n|
|
193
|
+
attributes = {'mmlFc:repCode' => n.repCode}
|
194
|
+
attributes['mmlFc:tableId'] = n.tableId if n.tableId
|
195
|
+
xb.mmlFc :name, n.value, attributes
|
196
|
+
end
|
197
|
+
xb << id.to_xml if id
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
class Department < Facility
|
203
|
+
def initialize(args = {})
|
204
|
+
super
|
205
|
+
end
|
206
|
+
|
207
|
+
def to_xml
|
208
|
+
xb = Builder::XmlMarkup.new
|
209
|
+
xb.mmlDp :Department do
|
210
|
+
name.each do |n|
|
211
|
+
attributes = { 'mmlDp:repCode' => n.repCode}
|
212
|
+
attributes['mmlDp:tableId'] = n.tableId if n.tableId
|
213
|
+
xb.mmlDp :name, n.value, attributes
|
214
|
+
end
|
215
|
+
xb << id.to_xml if id
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
class PersonalizedInfo
|
221
|
+
attr_reader :id, :personName
|
222
|
+
attr_accessor :facility, :department, :addresses, :emailAddresses, :phones
|
223
|
+
|
224
|
+
def initialize(args = {})
|
225
|
+
%W(id personName facility department addresses emailAddresses phones).each do |item|
|
226
|
+
send "#{item}=", args[item.to_sym]
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
def id=(id)
|
231
|
+
@id = id
|
232
|
+
end
|
233
|
+
|
234
|
+
def personName=(personName)
|
235
|
+
@personName = personName
|
236
|
+
end
|
237
|
+
|
238
|
+
def to_xml
|
239
|
+
xb = Builder::XmlMarkup.new
|
240
|
+
xb.mmlPsi :PersonalizedInfo do
|
241
|
+
xb << id.to_xml
|
242
|
+
xb.mmlPsi :personName do
|
243
|
+
personName.each do |n|
|
244
|
+
xb << n.to_xml
|
245
|
+
end
|
246
|
+
end
|
247
|
+
xb << facility.to_xml if facility
|
248
|
+
xb << department.to_xml if department
|
249
|
+
xb.mmlPsi :addresses do
|
250
|
+
addresses.each do |address|
|
251
|
+
xb << address.to_xml
|
252
|
+
end
|
253
|
+
end if addresses
|
254
|
+
xb.mmlPsi :emailAddresses do
|
255
|
+
emailAddresses.each do |email|
|
256
|
+
xb.mmlCm :email, email
|
257
|
+
end
|
258
|
+
end if emailAddresses
|
259
|
+
xb.mmlPsi :phones do
|
260
|
+
phones.each do |phone|
|
261
|
+
xb << phone.to_xml
|
262
|
+
end
|
263
|
+
end if phones
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
class CreatorLicense
|
269
|
+
attr_accessor :tableId, :value
|
270
|
+
|
271
|
+
def initialize(args = {})
|
272
|
+
@tableId = args[:tableId]
|
273
|
+
@value = args[:value]
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
class CreatorInfo
|
278
|
+
attr_reader :personalizedInfo, :creatorLicense
|
279
|
+
|
280
|
+
def initialize(args = {})
|
281
|
+
self.personalizedInfo = args[:personalizedInfo]
|
282
|
+
self.creatorLicense = args[:creatorLicense]
|
283
|
+
end
|
284
|
+
|
285
|
+
def personalizedInfo=(personalizedInfo)
|
286
|
+
raise ArgumentError, 'personalizedInfo is mandatory' if personalizedInfo.nil?
|
287
|
+
@personalizedInfo = personalizedInfo
|
288
|
+
end
|
289
|
+
|
290
|
+
def creatorLicense=(creatorLicense)
|
291
|
+
raise ArgumentError, 'creatorLicense is mandatory' if creatorLicense.nil? or creatorLicense.empty?
|
292
|
+
@creatorLicense = creatorLicense
|
293
|
+
end
|
294
|
+
|
295
|
+
def to_xml
|
296
|
+
xb= Builder::XmlMarkup.new
|
297
|
+
xb.mmlCi :CreatorInfo do
|
298
|
+
xb << personalizedInfo.to_xml
|
299
|
+
creatorLicense.each do |license|
|
300
|
+
attributes = {'mmlCi:tableId' => license.tableId} if license.tableId
|
301
|
+
xb.mmlCi :creatorLicense, license.value, attributes
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
data/mml-ruby.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mml/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mml-ruby"
|
8
|
+
spec.version = Mml::Ruby::VERSION
|
9
|
+
spec.authors = ["Shinji KOBAYASHI"]
|
10
|
+
spec.email = ["skoba@moss.gr.jp"]
|
11
|
+
spec.description = %q{Ruby implementation of MML(Medical Markup Language) library}
|
12
|
+
spec.summary = %q{MML implementation by Ruby}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "Apache2"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
spec.add_dependency "builder"
|
21
|
+
spec.add_dependency 'nokogiri'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
describe MML::Address do
|
2
|
+
let(:address) { MML::Address.new(repCode: 'A', addressClass: 'business', tableId: 'MML0025', full: '506, Dept. 9, Kyoto Research Park (KRP), Awata-cho 91, Chudoji, Shimogyo-ku, Kyoto-city', homeNumber: '506, Dept. 9, Kyoto Research Park (KRP)', town: 'Awata-cho 91, Chudoji, Shimogyo-ku', city: 'Kyoto-city', prefecture: 'Kyoto-fu', zip: '600-8815', countryCode: 'JPN') }
|
3
|
+
|
4
|
+
it 'should be an instance of Address' do
|
5
|
+
expect(address).to be_an_instance_of MML::Address
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'repCode should be properly assigned' do
|
9
|
+
expect(address.repCode).to eq 'A'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'repCode is mandatory' do
|
13
|
+
expect {address.repCode = nil}.to raise_error ArgumentError
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'addressClass should be properly assigned' do
|
17
|
+
expect(address.addressClass).to eq 'business'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'tableId should be properly assigned' do
|
21
|
+
expect(address.tableId).to eq 'MML0025'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'homeNumber should be propwerly assigned' do
|
25
|
+
expect(address.homeNumber).to eq '506, Dept. 9, Kyoto Research Park (KRP)'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'town should be properly assigned' do
|
29
|
+
expect(address.town).to eq 'Awata-cho 91, Chudoji, Shimogyo-ku'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'city should be properly assigned' do
|
33
|
+
expect(address.city).to eq 'Kyoto-city'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'prefecture should be properly assigned' do
|
37
|
+
expect(address.prefecture).to eq 'Kyoto-fu'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'full address should be properly assigned' do
|
41
|
+
expect(address.full).to eq '506, Dept. 9, Kyoto Research Park (KRP), Awata-cho 91, Chudoji, Shimogyo-ku, Kyoto-city'
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'zip should be properly assigned' do
|
45
|
+
expect(address.zip).to eq '600-8815'
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'countryCode should be properly assigned' do
|
49
|
+
expect(address.countryCode).to eq 'JPN'
|
50
|
+
end
|
51
|
+
|
52
|
+
context '#to_xml' do
|
53
|
+
subject { address.to_xml }
|
54
|
+
|
55
|
+
it {should match '<mmlAd:Address mmlAd:'}
|
56
|
+
it {should match 'mmlAd:repCode="A"'}
|
57
|
+
it {should match 'mmlAd:addressClass="business"'}
|
58
|
+
it {should match 'mmlAd:tableId="MML0025"'}
|
59
|
+
it {should match '<mmlAd:full>506, Dept. 9, Kyoto Research Park \(KRP\), Awata-cho 91, Chudoji, Shimogyo-ku, Kyoto-city</mmlAd:full>'}
|
60
|
+
it {should match '<mmlAd:homeNumber>506, Dept. 9, Kyoto Research Park \(KRP\)</mmlAd:homeNumber>'}
|
61
|
+
it {should match '<mmlAd:town>Awata-cho 91, Chudoji, Shimogyo-ku</mmlAd:town>'}
|
62
|
+
it {should match '<mmlAd:city>Kyoto-city</mmlAd:city>'}
|
63
|
+
it {should match '<mmlAd:prefecture>Kyoto-fu</mmlAd:prefecture>'}
|
64
|
+
it {should match '<mmlAd:zip>600-8815</mmlAd:zip>'}
|
65
|
+
it {should match '<mmlAd:countryCode>JPN</mmlAd:countryCode>'}
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
describe MML::Base do
|
2
|
+
let(:mml){MML::Base.new}
|
3
|
+
|
4
|
+
it 'should be an instance of MML::Base' do
|
5
|
+
expect(mml).to be_an_instance_of MML::Base
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'namespace should be xmlns:mml="http://www.medxml.net/MML"' do
|
9
|
+
expect(mml.namespace).to eq 'xmlns:mml="http://www.medxml.net/MML"'
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
describe MML::CreatorInfo do
|
2
|
+
let(:person_id) { MML::Id.new(type: 'facility', tableId: 'MML00024', value: '54321')}
|
3
|
+
let(:name) {MML::Name.new(repCode: 'A', fullname: 'Shinji KOBAYASHI')}
|
4
|
+
let(:personalizedInfo) {MML::PersonalizedInfo.new(id: person_id, personName: [name])}
|
5
|
+
let(:creator_license) { MML::CreatorLicense.new(tableId: 'MML0026', value: 'doctor')}
|
6
|
+
let(:creator_info){ MML::CreatorInfo.new(personalizedInfo: personalizedInfo, creatorLicense: [creator_license]) }
|
7
|
+
|
8
|
+
it 'personalizedInfo should be assigned properly' do
|
9
|
+
expect(creator_info.personalizedInfo.id.value).to eq '54321'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'personalizedInfo is mandatory' do
|
13
|
+
expect {creator_info.personalizedInfo = nil}.to raise_error ArgumentError
|
14
|
+
end
|
15
|
+
it 'should be an isntance of CreatorInfo' do
|
16
|
+
expect(creator_info).to be_an_instance_of MML::CreatorInfo
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'default table id is MML0026' do
|
20
|
+
expect(creator_info.creatorLicense[0].tableId).to eq 'MML0026'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'creator license should be assigned properly' do
|
24
|
+
expect(creator_info.creatorLicense[0].value).to eq 'doctor'
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'creator license is mandatory' do
|
28
|
+
it 'should not be nil' do
|
29
|
+
expect {creator_info.creatorLicense = nil}.to raise_error ArgumentError
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should not be empty' do
|
33
|
+
expect {creator_info.creatorLicense = []}.to raise_error ArgumentError
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#to_xml' do
|
38
|
+
subject { creator_info.to_xml }
|
39
|
+
|
40
|
+
it {should match '<mmlCi:CreatorInfo>'}
|
41
|
+
it {should match '<mmlPsi:PersonalizedInfo>'}
|
42
|
+
it {should match '>Shinji KOBAYASHI</mmlNm:fullname></mmlNm:Name>'}
|
43
|
+
it {should match '</mmlPsi:PersonalizedInfo>'}
|
44
|
+
it {should match '<mmlCi:creatorLicense mmlCi:tableId="MML0026">'}
|
45
|
+
it {should match '>doctor</mmlCi:creatorLicense>'}
|
46
|
+
it {should match '</mmlCi:CreatorInfo>'}
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
describe MML::CreatorLicense do
|
2
|
+
let(:creator_license) { MML::CreatorLicense.new(tableId: 'MML0026',
|
3
|
+
value: 'doctor')}
|
4
|
+
|
5
|
+
it "creator license should be an instance of CreatorLicense" do
|
6
|
+
expect(creator_license).to be_an_instance_of MML::CreatorLicense
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'table id should be MML0026' do
|
10
|
+
expect(creator_license.tableId).to eq 'MML0026'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'value should be doctor' do
|
14
|
+
expect(creator_license.value).to eq 'doctor'
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
describe MML::Department do
|
2
|
+
let(:id) { MML::Id.new(value: '16', type: 'medical', tableId: 'MML0029') }
|
3
|
+
let(:name) { MML::DepartmentName.new(value: 'Cardiovascular Surgery', repCode: 'A', tableId: 'MML0025') }
|
4
|
+
let(:department) { MML::Department.new(id: id, name: [name]) }
|
5
|
+
|
6
|
+
it 'is an instance of MML::Department' do
|
7
|
+
expect(department).to be_an_instance_of MML::Department
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'name' do
|
11
|
+
let(:department_name) { department.name[0] }
|
12
|
+
|
13
|
+
it 'name should assigned properly' do
|
14
|
+
expect(department_name.value).to eq 'Cardiovascular Surgery'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'name shold not be nil' do
|
18
|
+
expect {department.name = nil}.to raise_error ArgumentError
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'name should not be empty' do
|
22
|
+
expect {department.name = []}.to raise_error ArgumentError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'id should be properyl assigned' do
|
27
|
+
expect(department.id.value).to eq '16'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'id is not mandatory' do
|
31
|
+
expect { department.id = nil}.not_to raise_error
|
32
|
+
end
|
33
|
+
|
34
|
+
context "#to_xml" do
|
35
|
+
subject { department.to_xml }
|
36
|
+
|
37
|
+
it {should match '<mmlDp:Department>'}
|
38
|
+
it {should match '<mmlDp:name'}
|
39
|
+
it {should match 'mmlDp:repCode="A"'}
|
40
|
+
it {should match 'mmlDp:tableId="MML0025"'}
|
41
|
+
it {should match '>Cardiovascular Surgery</mmlDp:name>'}
|
42
|
+
it {should match '<mmlCm:Id'}
|
43
|
+
it {should match 'mmlCm:type="medical"'}
|
44
|
+
it {should match 'mmlCm:tableId="MML0029"'}
|
45
|
+
it {should match '>16</mmlCm:Id>'}
|
46
|
+
it {should match '</mmlDp:Department>'}
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
describe MML::ExtRef do
|
2
|
+
let(:ext_ref) { MML::ExtRef.new(contentType: 'APPLICATION/HL72.3-HL7ER2.3', medicalRole: 'prescription', title: 'Prescription on discharge', href: 'patient1234/prescription831.HL7' )}
|
3
|
+
|
4
|
+
it 'should be an instance of MML::ExtRef' do
|
5
|
+
expect(ext_ref).to be_an_instance_of MML::ExtRef
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'content type should be APPLICATION/HL72.3-HL7ER2.3' do
|
9
|
+
expect(ext_ref.contentType).to eq 'APPLICATION/HL72.3-HL7ER2.3'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'medical role should be prescription' do
|
13
|
+
expect(ext_ref.medicalRole).to eq 'prescription'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'title should be Prescription on discharge' do
|
17
|
+
expect(ext_ref.title).to eq 'Prescription on discharge'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'href should be patient1234/prescription831.HL7' do
|
21
|
+
expect(ext_ref.href).to eq 'patient1234/prescription831.HL7'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'href is mandatory' do
|
25
|
+
expect {ext_ref.href=nil}.to raise_error ArgumentError
|
26
|
+
end
|
27
|
+
|
28
|
+
context '#to_xml' do
|
29
|
+
subject { ext_ref.to_xml }
|
30
|
+
|
31
|
+
it { should match '<mmlCm:extRef'}
|
32
|
+
it { should match 'mmlCm:contentType="APPLICATION/HL72.3-HL7ER2.3"'}
|
33
|
+
it { should match 'mmlCm:medicalRole="prescription"'}
|
34
|
+
it { should match 'mmlCm:title="Prescription on discharge"'}
|
35
|
+
it { should match 'mmlCm:href="patient1234/prescription831.HL7"'}
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
describe MML::FacilityName do
|
2
|
+
let(:facility_name) { MML::FacilityName.new(value: 'New Millenium Medical College Hospital', repCode: 'A', tableId: 'MML0025') }
|
3
|
+
|
4
|
+
it 'should be an instance of MML::FacilityName' do
|
5
|
+
expect(facility_name).to be_an_instance_of MML::FacilityName
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'value should be assigned porperly' do
|
9
|
+
expect(facility_name.value).to eq 'New Millenium Medical College Hospital'
|
10
|
+
end
|
11
|
+
it 'repCode should be assigned properly' do
|
12
|
+
expect(facility_name.repCode).to eq 'A'
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'tableId should be assigned properly' do
|
16
|
+
expect(facility_name.tableId).to eq 'MML0025'
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
describe MML::Facility do
|
2
|
+
let(:id) { MML::Id.new(value: '12345', type: 'facility', tableId: 'MML0024', checkDigit: 5, checkDigitSchema: 'MML0001') }
|
3
|
+
let(:name) { MML::FacilityName.new(value: 'New Millenium Medical College Hospital', repCode: 'A', tableId: 'MML0025') }
|
4
|
+
let(:facility) { MML::Facility.new(name: [name], id: id) }
|
5
|
+
|
6
|
+
it 'should be an instance of MML::Facility' do
|
7
|
+
expect(facility).to be_an_instance_of MML::Facility
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'name' do
|
11
|
+
let(:facility_name) { facility.name[0] }
|
12
|
+
|
13
|
+
it 'name should be assigned properly' do
|
14
|
+
expect(facility_name.value).to eq 'New Millenium Medical College Hospital'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'repCode should be assigned properly' do
|
18
|
+
expect(facility_name.repCode).to eq 'A'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'talbeId should be assigned properly' do
|
22
|
+
expect(facility_name.tableId).to eq 'MML0025'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'facility name is mandatory' do
|
26
|
+
expect{ facility.name = nil }.to raise_error ArgumentError
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'id should be properly assgined' do
|
31
|
+
expect(facility.id.value).to eq '12345'
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'id is not mandatory' do
|
35
|
+
expect {facility.id = nil}.not_to raise_error
|
36
|
+
end
|
37
|
+
|
38
|
+
context '#to_xml' do
|
39
|
+
subject { facility.to_xml}
|
40
|
+
|
41
|
+
it {should match '<mmlFc:Facility>'}
|
42
|
+
it {should match '<mmlFc:name mmlFc:'}
|
43
|
+
it {should match 'mmlFc:repCode="A"'}
|
44
|
+
it {should match 'mmlFc:tableId="MML0025"'}
|
45
|
+
it {should match '<mmlCm:Id mmlCm:type="facility"'}
|
46
|
+
it {should match 'mmlCm:tableId="MML0024"'}
|
47
|
+
it {should match 'mmlCm:checkDigit="5"'}
|
48
|
+
it {should match 'mmlCm:checkDigitSchema="MML0001"'}
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
describe MML::Id do
|
2
|
+
let(:id) { MML::Id.new(value: '12345', type: 'facility', tableId: 'MML0024', checkDigit: 5, checkDigitSchema: 'MML0001') }
|
3
|
+
|
4
|
+
it 'should be an instance of MML::Id' do
|
5
|
+
expect(id).to be_an_instance_of MML::Id
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'value should be 12345' do
|
9
|
+
expect(id.value).to eq '12345'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'value is mandatory' do
|
13
|
+
expect { id.value = nil }.to raise_error ArgumentError
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'type should be facility' do
|
17
|
+
expect(id.type).to eq 'facility'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'type is mandatory' do
|
21
|
+
expect { id.type = nil }.to raise_error ArgumentError
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'tableId should be MML0024' do
|
25
|
+
expect(id.tableId).to eq 'MML0024'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'tableId is required' do
|
29
|
+
expect{id.tableId = nil}.to raise_error ArgumentError
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'check digit is 5' do
|
33
|
+
expect(id.checkDigit).to be 5
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'check digit schema is MML0001' do
|
37
|
+
expect(id.checkDigitSchema).to eq 'MML0001'
|
38
|
+
end
|
39
|
+
|
40
|
+
context '#to_xml' do
|
41
|
+
it 'assigned type attribute matches facility' do
|
42
|
+
expect(id.to_xml).to match 'mmlCm:type="facility"'
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'assigned tableId matches MML0024' do
|
46
|
+
expect(id.to_xml).to match 'mmlCm:tableId="MML0024"'
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'assigned check digit matches 5' do
|
50
|
+
expect(id.to_xml).to match 'mmlCm:checkDigit="5"'
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'assigned check digit schema matches MML0001' do
|
54
|
+
expect(id.to_xml).to match 'mmlCm:checkDigitSchema="MML0001"'
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'assigned value match 12345' do
|
58
|
+
expect(id.to_xml).to match '>12345</mmlCm:Id>'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
describe MML::Name do
|
2
|
+
let(:name) {MML::Name.new(repCode: 'A', tableId: 'MML0025', family: 'KOBAYASHI', given: 'Shinji', middle: 'middle', fullname: 'KOBAYASHI, Shinji', prefix: 'Dr', degree: 'MD, PhD')}
|
3
|
+
|
4
|
+
it 'name should be an instance of MML::Name' do
|
5
|
+
expect(name).to be_an_instance_of MML::Name
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'repCode should be A' do
|
9
|
+
expect(name.repCode).to eq 'A'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'tableId should be MML0025' do
|
13
|
+
expect(name.tableId).to eq 'MML0025'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'repCode is mandatory' do
|
17
|
+
expect{name.repCode = nil}.to raise_error
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'family name is KOBAYASHI' do
|
21
|
+
expect(name.family).to eq 'KOBAYASHI'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'given name is Shinji' do
|
25
|
+
expect(name.given).to eq 'Shinji'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'middle name is middle' do
|
29
|
+
expect(name.middle).to eq 'middle'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'full name is KOBAYASHI, Shinji' do
|
33
|
+
expect(name.fullname).to eq 'KOBAYASHI, Shinji'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'prefix should be Dr' do
|
37
|
+
expect(name.prefix).to eq 'Dr'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'degree is MD, PhD' do
|
41
|
+
expect(name.degree).to eq 'MD, PhD'
|
42
|
+
end
|
43
|
+
|
44
|
+
context '#to_xml' do
|
45
|
+
let(:xml) { name.to_xml }
|
46
|
+
|
47
|
+
it 'mmlNm:given tag matches Shinji' do
|
48
|
+
expect(xml).to match '<mmlNm:given>Shinji</mmlNm:given>'
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'mmlNm:family tag matches KOBAYASHI' do
|
52
|
+
expect(xml).to match '<mmlNm:family>KOBAYASHI</mmlNm:family>'
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'mmlNm:fullname tag matches KOBAYASHI, Shinji' do
|
56
|
+
expect(xml).to match '<mmlNm:fullname>KOBAYASHI, Shinji</mmlNm:fullname>'
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'mmlNm:prefix tag matches Dr' do
|
60
|
+
expect(xml).to match '<mmlNm:prefix>Dr</mmlNm:prefix>'
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'mmlNm:degree tag matches MD, PhD' do
|
64
|
+
expect(xml).to match '<mmlNm:degree>MD, PhD</mmlNm:degree>'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
describe MML::PersonalizedInfo do
|
2
|
+
let(:id) { MML::Id.new(type: 'facility', tableId: 'MML0024', value: '5555') }
|
3
|
+
let(:personName) { MML::Name.new(repCode: 'A', fullname: 'Shinji KOBAYASHI') }
|
4
|
+
let(:facility_id) { MML::Id.new(type: 'insurance', tableId: 'MML0027', value: '12345')}
|
5
|
+
let(:facility_name) {MML::FacilityName.new(value: 'New Millenium Medical College Hospital', repCode: 'A', tableId: 'MML0025')}
|
6
|
+
let(:facility) { MML::Facility.new(id: facility_id, name: [facility_name]) }
|
7
|
+
let(:department_name){MML::DepartmentName.new(repCode: 'A', tableId: 'MML0025', value: 'Cardiovascular surgery')}
|
8
|
+
let(:department) { MML::Department.new(name: [department_name])}
|
9
|
+
let(:address) { MML::Address.new(repCode: 'A', tableId: 'MML0025', addressClass: 'business', full: '5200 Kihara, Kiyotake-cho, Miyazaki-gun, Miyazaki-prefecture', zip: '889-1692', countryCode: 'JPN') }
|
10
|
+
let(:email) {'araki@post.medxml.net'}
|
11
|
+
let(:phone) {MML::Phone.new(telEquipType: 'PH', area: '0985', city: '85', number: '1500')}
|
12
|
+
let(:personalized_info) { MML::PersonalizedInfo.new(id: id, personName: [personName], facility: facility, department: department, addresses: [address], emailAddresses: [email], phones: [phone]) }
|
13
|
+
|
14
|
+
it 'personalized info should be an instance of PersonalizedInfo' do
|
15
|
+
expect(personalized_info).to be_an_instance_of MML::PersonalizedInfo
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'id should be assigned properly' do
|
19
|
+
expect(personalized_info.id.value).to eq '5555'
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'personName should be assigned properly' do
|
23
|
+
expect(personalized_info.personName[0].fullname).to eq 'Shinji KOBAYASHI'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'faciilty should be assigned properly' do
|
27
|
+
expect(personalized_info.facility.name[0].value).to eq 'New Millenium Medical College Hospital'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'department should be assigned properly' do
|
31
|
+
expect(personalized_info.department.name[0].value).to eq 'Cardiovascular surgery'
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'addresses are properly assined' do
|
35
|
+
expect(personalized_info.addresses[0].zip).to eq '889-1692'
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'emailAddresses are properly assigned' do
|
39
|
+
expect(personalized_info.emailAddresses[0]).to eq 'araki@post.medxml.net'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'phones are properly assigned' do
|
43
|
+
expect(personalized_info.phones[0].area).to eq '0985'
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "#to_xml" do
|
47
|
+
subject { personalized_info.to_xml }
|
48
|
+
|
49
|
+
it {should match '<mmlPsi:PersonalizedInfo>'}
|
50
|
+
it {should match '<mmlCm:Id'}
|
51
|
+
it {should match 'mmlCm:type="facility"'}
|
52
|
+
it {should match '<mmlPsi:personName>'}
|
53
|
+
it {should match '<mmlNm:Name'}
|
54
|
+
it {should match '<mmlNm:fullname>Shinji KOBAYASHI</mmlNm:fullname>'}
|
55
|
+
it {should match '</mmlNm:Name>'}
|
56
|
+
it {should match '<mmlFc:Facility>'}
|
57
|
+
it {should match '<mmlFc:name'}
|
58
|
+
it {should match '>New Millenium Medical College Hospital</mmlFc:name>'}
|
59
|
+
it {should match 'mmlCm:tableId="MML0027"'}
|
60
|
+
it {should match '>12345</mmlCm:Id>'}
|
61
|
+
it {should match '</mmlFc:Facility>'}
|
62
|
+
it {should match '<mmlDp:Department>'}
|
63
|
+
it {should match '>Cardiovascular surgery</mmlDp:name>'}
|
64
|
+
it {should match '</mmlDp:Department>'}
|
65
|
+
it {should match '<mmlPsi:addresses>'}
|
66
|
+
it {should match '<mmlAd:full>5200 Kihara, Kiyotake-cho, Miyazaki-gun, Miyazaki-prefecture'}
|
67
|
+
it {should match '</mmlAd:full>'}
|
68
|
+
it {should match '</mmlPsi:addresses>'}
|
69
|
+
it {should match '<mmlPsi:emailAddresses>'}
|
70
|
+
it {should match '<mmlCm:email>araki@post.medxml.net</mmlCm:email>'}
|
71
|
+
it {should match '</mmlPsi:emailAddresses>'}
|
72
|
+
it {should match '<mmlPsi:phones>'}
|
73
|
+
it {should match '<mmlPh:Phone'}
|
74
|
+
it {should match 'mmlPh:telEquipType="PH">'}
|
75
|
+
it {should match '<mmlPh:city>85</mmlPh:city>'}
|
76
|
+
it {should match '</mmlPsi:phones>'}
|
77
|
+
it {should match '</mmlPsi:PersonalizedInfo>'}
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
describe MML::Phone do
|
2
|
+
let(:phone) { MML::Phone.new(telEquipType: 'PH', area: '075', city: '874', number: '7030', extension: '123', country: '81', memo: 'daytime') }
|
3
|
+
|
4
|
+
it 'should be an instance of MML::Phone' do
|
5
|
+
expect(phone).to be_an_instance_of MML::Phone
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'equipType should be properly assigned' do
|
9
|
+
expect(phone.telEquipType).to eq 'PH'
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'area number should be assigned properly' do
|
13
|
+
expect(phone.area).to eq '075'
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'city number should be assigned properly' do
|
17
|
+
expect(phone.city).to eq '874'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'number should be assigned properly' do
|
21
|
+
expect(phone.number).to eq'7030'
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'extension should be assigned properly' do
|
25
|
+
expect(phone.extension).to eq '123'
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'country code should be assigned properly' do
|
29
|
+
expect(phone.country).to eq '81'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'memo should be assigned properly' do
|
33
|
+
expect(phone.memo).to eq 'daytime'
|
34
|
+
end
|
35
|
+
|
36
|
+
context '#xml' do
|
37
|
+
subject { phone.to_xml }
|
38
|
+
|
39
|
+
it {should match '<mmlPh:Phone mmlPh:telEquipType="PH">'}
|
40
|
+
it {should match '<mmlPh:area>075</mmlPh:area>'}
|
41
|
+
it {should match '<mmlPh:city>874</mmlPh:city>'}
|
42
|
+
it {should match '<mmlPh:number>7030</mmlPh:number>'}
|
43
|
+
it {should match '<mmlPh:extension>123</mmlPh:extension>'}
|
44
|
+
it {should match '<mmlPh:country>81</mmlPh:country>'}
|
45
|
+
it {should match '<mmlPh:memo>daytime</mmlPh:memo>'}
|
46
|
+
it {should match '</mmlPh:Phone>'}
|
47
|
+
end
|
48
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mml-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shinji KOBAYASHI
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: builder
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Ruby implementation of MML(Medical Markup Language) library
|
84
|
+
email:
|
85
|
+
- skoba@moss.gr.jp
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .rspec
|
92
|
+
- .travis.yml
|
93
|
+
- Gemfile
|
94
|
+
- LICENSE
|
95
|
+
- README.md
|
96
|
+
- Rakefile
|
97
|
+
- lib/mml.rb
|
98
|
+
- lib/mml/common.rb
|
99
|
+
- mml-ruby.gemspec
|
100
|
+
- spec/mml/address_spec.rb
|
101
|
+
- spec/mml/base_spec.rb
|
102
|
+
- spec/mml/creator_info_spec.rb
|
103
|
+
- spec/mml/creator_license_spec.rb
|
104
|
+
- spec/mml/department_spec.rb
|
105
|
+
- spec/mml/external_ref_spec.rb
|
106
|
+
- spec/mml/facility_name_spec.rb
|
107
|
+
- spec/mml/facility_spec.rb
|
108
|
+
- spec/mml/identification_spec.rb
|
109
|
+
- spec/mml/name_spec.rb
|
110
|
+
- spec/mml/personalized_info_spec.rb
|
111
|
+
- spec/mml/phone_spec.rb
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
homepage: ''
|
114
|
+
licenses:
|
115
|
+
- Apache2
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.1.11
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: MML implementation by Ruby
|
137
|
+
test_files:
|
138
|
+
- spec/mml/address_spec.rb
|
139
|
+
- spec/mml/base_spec.rb
|
140
|
+
- spec/mml/creator_info_spec.rb
|
141
|
+
- spec/mml/creator_license_spec.rb
|
142
|
+
- spec/mml/department_spec.rb
|
143
|
+
- spec/mml/external_ref_spec.rb
|
144
|
+
- spec/mml/facility_name_spec.rb
|
145
|
+
- spec/mml/facility_spec.rb
|
146
|
+
- spec/mml/identification_spec.rb
|
147
|
+
- spec/mml/name_spec.rb
|
148
|
+
- spec/mml/personalized_info_spec.rb
|
149
|
+
- spec/mml/phone_spec.rb
|
150
|
+
- spec/spec_helper.rb
|