Skip to content

Commit

Permalink
Updated the local test file with a call to active_distribution_events
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhellberg committed Jan 7, 2011
1 parent 067f044 commit fdfee3c
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,56 @@
:per_page => 1
})


if results.ok?
puts "Sökning: #{results.solr.params.inspect}\n\n"

results.products.map { |p| puts p.title }

puts "\nFöregående sida: #{results.previous_page}"
puts "Nästa sida: #{results.next_page}"
puts "\nAntal träffar: #{results.num_found}\n"

results.facets.each_pair do |name, items|
puts "\nFacett: #{name}"
items.each do |item|
puts " - #{item.value} => #{item.hits}"
end
end

p = results.products.first
puts "\n\nFörsta produkten: #{p.title} (#{p.ur_product_id})"
puts " -> Distribution: #{p.distribution_events.map { |e| e.platform }.join(', ')}" if p.has_distribution_events?
puts " -> Lagring: #{p.storages.map { |s| s.storage_format }.join(', ')}" if p.has_storages?
puts " -> Andra stora bilden: #{p.image_url(2, '_l')}" if p.has_image?(2, '_l')


p = UR::Product.find(160050)
if p.available_on_avc?
puts "AVC"
puts p.active_distribution_events['avc'].inspect
end

p = UR::Product.find(106485)
if p.has_documents?
puts p.documents.first.storages.first.location
end

if p.has_media_id?
puts "\nBandnummer/Media ID: #{p.media_id}\n\n"
end

p = UR::Product.find(143664)
puts p.url

p = UR::Product.find(140502)
puts p.url
puts p.related_product_ids

p = UR::Product.find(129859)
puts "Produkt is ok?: #{p.ok?}"

search_result = UR::Product.search({ :per_page => 10 })
puts "Hits: #{search_result.num_found}, Pages: #{search_result.total_pages}"

end

0 comments on commit fdfee3c

Please sign in to comment.