scotdalton/exlibris-primo

View on GitHub
lib/exlibris/primo/web_service/response/facets.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Exlibris
  module Primo
    module WebService
      module Response
        module Facets
          def facets
            @facets ||= (facet_list) ? facet_list.xpath("//search:FACET", response_namespaces).collect { |facet|
              accurate = (facet.parent["ACCURATE_COUNTERS"].eql? "true")
              Exlibris::Primo::Facet.new(:raw_xml => facet.to_xml, :accurate => accurate)
            } : []
          end

          def facet_list
            @facet_list ||= xml.at_xpath("//search:FACETLIST", response_namespaces)
          end
          private :facet_list
        end
      end
    end
  end
end