Module: XDS::Helper
- Included in:
- Author, CodedAttribute, Metadata, RegistryStoredQueryRequest, SourcePatientInfo
- Defined in:
- lib/xds/helper.rb
Instance Method Summary collapse
- #create_classification(builder, scheme, classified_object, node_rep, id = UUID.new.generate, &block) ⇒ Object
- #create_external_identifier(builder, id, reg_object, scheme, value, &block) ⇒ Object
- #create_extrinsic_object(builder, id, mime_type, object_type, &block) ⇒ Object
- #create_localized_string(builder, value) ⇒ Object
- #create_name(builder, name, &block) ⇒ Object
- #create_slot(builder, name, value_list = []) ⇒ Object
- #get_external_identifier_value(eo_node, scheme) ⇒ Object
- #get_slot_value(eo_node, slot_name) ⇒ Object
- #get_slot_values(eo_node, slot_name) ⇒ Object
- #with_classification(eo_node, classification_scheme, &block) ⇒ Object
Instance Method Details
#create_classification(builder, scheme, classified_object, node_rep, id = UUID.new.generate, &block) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/xds/helper.rb', line 39 def create_classification(builder,scheme, classified_object,node_rep ,id=UUID.new.generate,&block) builder.Classification("classificationScheme"=>scheme, "classifiedObject"=>classified_object, "nodeRepresentation"=>node_rep, "id"=>id) do yield builder if block_given? end end |
#create_external_identifier(builder, id, reg_object, scheme, value, &block) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/xds/helper.rb', line 11 def create_external_identifier(builder,id,reg_object,scheme, value, &block) builder.ExternalIdentifier("id"=>id,"registryObject"=>reg_object,"identificationScheme"=>scheme,"value"=>value) do yield builder if block_given? end end |
#create_extrinsic_object(builder, id, mime_type, object_type, &block) ⇒ Object
5 6 7 8 9 |
# File 'lib/xds/helper.rb', line 5 def create_extrinsic_object(builder,id,mime_type,object_type, &block) builder.ExtrinsicObject("id"=>id,"mimeType"=>mime_type,"objectType"=>object_type) do yield builder if block_given? end end |
#create_localized_string(builder, value) ⇒ Object
25 26 27 |
# File 'lib/xds/helper.rb', line 25 def create_localized_string(builder,value) builder.LocalizedString("value"=>value) end |
#create_name(builder, name, &block) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/xds/helper.rb', line 18 def create_name(builder,name,&block) builder.Name do create_localized_string(builder,name) yield builder if block_given? end end |
#create_slot(builder, name, value_list = []) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/xds/helper.rb', line 29 def create_slot(builder, name, value_list=[]) builder.Slot({"name"=>name}) do builder.ValueList do value_list.each do |val| builder.Value(val) end end end end |
#get_external_identifier_value(eo_node, scheme) ⇒ Object
76 77 78 79 |
# File 'lib/xds/helper.rb', line 76 def get_external_identifier_value(eo_node, scheme) ei_node = REXML::XPath.first(eo_node, "rim:ExternalIdentifier[@identificationScheme='#{scheme}']", {'rim' => 'urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0'}) ei_node.attributes['value'] if ei_node end |
#get_slot_value(eo_node, slot_name) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/xds/helper.rb', line 58 def get_slot_value(eo_node, slot_name) value_node = REXML::XPath.first(eo_node, "rim:Slot[@name='#{slot_name}']/rim:ValueList/rim:Value", {'rim' => 'urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0'}) if value_node return value_node.text else return nil end end |
#get_slot_values(eo_node, slot_name) ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'lib/xds/helper.rb', line 67 def get_slot_values(eo_node, slot_name) value_nodes = REXML::XPath.match(eo_node, "rim:Slot[@name='#{slot_name}']/rim:ValueList/rim:Value", {'rim' => 'urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0'}) if value_nodes return value_nodes.map {|n| n.text} else return nil end end |
#with_classification(eo_node, classification_scheme, &block) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/xds/helper.rb', line 49 def with_classification(eo_node, classification_scheme, &block) if block_given? classification = REXML::XPath.first(eo_node, "rim:Classification[@classificationScheme='#{classification_scheme}']", {'rim' => 'urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0'}) if classification yield classification end end end |