def query(xri, service_types)
canonicalID = nil
services = service_types.collect { |service_type|
url = self.query_url(xri, service_type)
begin
response = OpenID.fetch(url)
rescue
raise XRIHTTPError, ["Could not fetch #{xri}", $!]
end
raise XRIHTTPError, "Could not fetch #{xri}" if response.nil?
xrds = Yadis::parseXRDS(response.body)
canonicalID = Yadis::get_canonical_id(xri, xrds)
Yadis::services(xrds) unless xrds.nil?
}
services = services.inject([]) { |flatter, some_services|
flatter += some_services unless some_services.nil?
}
return canonicalID, services
end