Class: XDS::RegistryStoredQueryRequest

Inherits:
XdsRequest
  • Object
show all
Includes:
Helper
Defined in:
lib/xds/registry_stored_query_request.rb

Instance Attribute Summary

Attributes inherited from XdsRequest

#endpoint_uri, #header, #proxy_host, #proxy_port

Instance Method Summary collapse

Methods included from Helper

#create_classification, #create_external_identifier, #create_extrinsic_object, #create_localized_string, #create_name, #create_slot, #get_external_identifier_value, #get_slot_value, #get_slot_values, #with_classification

Methods inherited from XdsRequest

#to_soap

Constructor Details

#initialize(service_url, query) ⇒ RegistryStoredQueryRequest

Returns a new instance of RegistryStoredQueryRequest.



5
6
7
8
# File 'lib/xds/registry_stored_query_request.rb', line 5

def initialize(service_url, query)
  super(service_url,"urn:ihe:iti:2007:RegistryStoredQuery")
  @query = query
end

Instance Method Details

#executeObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/xds/registry_stored_query_request.rb', line 10

def execute
  post = super
  rsqr = RegistryStoredQueryResponse.new
  rsqr.parse_soap_response(post.response_body_as_string)
  if rsqr.request_successful?
    return rsqr.
  else
    return nil
  end
end

#to_soap_body(builder, body_attributes = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/xds/registry_stored_query_request.rb', line 21

def to_soap_body(builder,body_attributes = {})
  builder.soapenv(:Body, body_attributes) do
    builder.query(:AdhocQueryRequest, 'xmlns:query' => "urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0",
                                      'xmlns:rs' => "urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0",
                                      'xmlns' => "urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0") do
      builder.query(:ResponseOption, 'returnComposedObjects' => "true", 'returnType' => "LeafClass")
      # Currently hardcoded to FindDocuments
      builder.AdhocQuery('id' => "urn:uuid:14d4debf-8f97-4251-9a74-a90016b0af0d") do
        @query.each_pair do |slot_name, values|
          packed_values = values.kind_of?(Array) ? values : [values]
          create_slot(builder, slot_name, packed_values)
        end
      end
    end
  end
end