Sha256: 8cb9a529bc3f9045dba5aeed7737cc6d78187a21187bc879437f0586f5a3bd33

Contents?: true

Size: 562 Bytes

Versions: 5

Compression:

Stored size: 562 Bytes

Contents

require "celsius/transformation/step"
require "ox"

class Celsius::Primo::SoapApi::Searcher::SearchBrief::SearchRequestTransformation::
  SetLocations < Celsius::Transformation::Step

  def call
    (transformation.locations || []).each do |location|
      type = location[:type] || location["type"]
      value = location[:value] || location["value"]

      transformation.inner_search_request.locate("PrimoSearchRequest/Locations").first.tap do |node|
        node << Ox.parse("<uic:Location type=\"#{type}\" value=\"#{value}\"/>")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
celsius-primo-0.1.4 lib/celsius/primo/soap_api/searcher/search_brief/search_request_transformation/set_locations.rb
celsius-primo-0.1.3 lib/celsius/primo/soap_api/searcher/search_brief/search_request_transformation/set_locations.rb
celsius-primo-0.1.2 lib/celsius/primo/soap_api/searcher/search_brief/search_request_transformation/set_locations.rb
celsius-primo-0.1.1 lib/celsius/primo/soap_api/searcher/search_brief/search_request_transformation/set_locations.rb
celsius-primo-0.1.0 lib/celsius/primo/soap_api/searcher/search_brief/search_request_transformation/set_locations.rb