Sha256: 525c73440fb56047cb848a3aaaf7463111e0b07c6a88fc38fbf2a6df2c176c7d

Contents?: true

Size: 1.03 KB

Versions: 25

Compression:

Stored size: 1.03 KB

Contents

module Exlibris
  module Primo
    module WebService
      module Request
        module QueryTerms
          attr_writer :boolean_operator

          def boolean_operator
            @boolean_operator ||= "AND"
          end
          
          # 
          # Returns a lambda that takes a Nokogiri::XML::Builder as an argument
          # and appends query terms XML to it.
          # 
          def query_terms_xml
            bool_operator = boolean_operator
            lambda do |xml|
              xml.QueryTerms {
                xml.BoolOpeator bool_operator
                query_terms.each do |query_term|
                  xml << query_term.to_xml
                end
              }
            end
          end
          protected :query_terms_xml

          def query_terms
            @query_terms ||= []
          end

          def add_query_term(value, index, precision="contains")
            query_terms << QueryTerm.new(:value => value, :index => index, :precision => precision)
          end
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
exlibris-primo-2.1.1 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-2.1.0 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-2.0.0 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.9 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.8 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.7 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.6 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.5 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.4 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.3 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.2 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.1 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.1.0 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.0.11 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.0.10 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.0.9 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.0.8 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.0.7 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.0.6 lib/exlibris/primo/web_service/request/search/query_terms.rb
exlibris-primo-1.0.5 lib/exlibris/primo/web_service/request/search/query_terms.rb