lib/endeca/document.rb in primedia-endeca-0.9.1 vs lib/endeca/document.rb in primedia-endeca-0.9.2
- old
+ new
@@ -34,12 +34,13 @@
# Returns the collection of Endeca::Dimension for the given Document
def dimensions
return @dimensions if @dimensions
@dimensions = {}
- (raw['Dimensions'] || {}).each do |name, value|
- @dimensions[name] = Dimension.new(value)
+ (raw['Dimensions'] || {}).each do |name, values|
+ values = [values] unless Array === values
+ @dimensions[name] = values.map(&Dimension)
end
@dimensions
end
# Find operates with three distinct retrieval approaches:
@@ -70,11 +71,11 @@
# # find first
# Listing.find(:first) # Returns the first Document for the query
# Listing.find(:first, :available => true)
def self.find(what, query_options={})
case what
- when /^[A-Z\d]+$/
+ when Integer, /^[A-Z\d]+$/
by_id(what, query_options)
when :first
first(query_options)
when :all
all(query_options)
@@ -100,10 +101,10 @@
end
private
def self.request(query_options)
- query_options = transform_query_options(query_options.merge(get_default_params))
+ query_options = transform_query_options(get_default_params.merge(query_options))
Endeca::Request.perform(get_path, query_options)
end
end
end