module Exlibris::Primo::WebService::Request::Locations

Public Instance Methods

add_location(kind, value) click to toggle source
# File lib/exlibris/primo/web_service/request/search/locations.rb, line 26
def add_location(kind, value)
  locations << Location.new(:kind => kind, :value => value)
end
locations() click to toggle source
# File lib/exlibris/primo/web_service/request/search/locations.rb, line 22
def locations
  @locations ||= []
end

Protected Instance Methods

locations_xml() click to toggle source

Returns a lambda that takes a Nokogiri::XML::Builder as an argument and appends locations XML to it.

# File lib/exlibris/primo/web_service/request/search/locations.rb, line 10
def locations_xml
  lambda { |xml|
    # Specify the uic namespace. Not great, but adequate.
    xml.Locations {
      locations.each do |location|
        xml['uic'].Location(:type => location.kind, :value => location.value)
      end
    } unless locations.empty?
  }
end