primedia-endeca 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/endeca.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{endeca}
5
- s.version = "0.9.1"
5
+ s.version = "0.9.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Rein Henrichs", "Andy Stone"]
@@ -36,8 +36,9 @@ module Endeca
36
36
  def dimensions
37
37
  return @dimensions if @dimensions
38
38
  @dimensions = {}
39
- (raw['Dimensions'] || {}).each do |name, value|
40
- @dimensions[name] = Dimension.new(value)
39
+ (raw['Dimensions'] || {}).each do |name, values|
40
+ values = [values] unless Array === values
41
+ @dimensions[name] = values.map(&Dimension)
41
42
  end
42
43
  @dimensions
43
44
  end
@@ -72,7 +73,7 @@ module Endeca
72
73
  # Listing.find(:first, :available => true)
73
74
  def self.find(what, query_options={})
74
75
  case what
75
- when /^[A-Z\d]+$/
76
+ when Integer, /^[A-Z\d]+$/
76
77
  by_id(what, query_options)
77
78
  when :first
78
79
  first(query_options)
@@ -102,7 +103,7 @@ module Endeca
102
103
  private
103
104
 
104
105
  def self.request(query_options)
105
- query_options = transform_query_options(query_options.merge(get_default_params))
106
+ query_options = transform_query_options(get_default_params.merge(query_options))
106
107
  Endeca::Request.perform(get_path, query_options)
107
108
  end
108
109
  end
@@ -74,22 +74,5 @@ module Endeca
74
74
  def boolean_reader(*attrs)
75
75
  reader(*attrs) { |value| value == "1" ? true : false }
76
76
  end
77
-
78
- def dim_reader(*attrs, &block)
79
- hash = {}
80
- block ||= lambda {|x| x}
81
-
82
- hash.update(attrs.pop) if Hash === attrs.last
83
-
84
- attrs.each{|attr| hash[attr] = attr}
85
-
86
- hash.each do |variable, method|
87
- define_method method do
88
- dim = dimensions[variable.to_s]
89
- name = dim && dim.name
90
- block.call(name)
91
- end
92
- end
93
- end
94
77
  end
95
78
  end
data/lib/endeca.rb CHANGED
@@ -18,7 +18,7 @@ require 'endeca/document'
18
18
  module Endeca
19
19
 
20
20
  # :stopdoc:
21
- VERSION = '0.9.1'
21
+ VERSION = '0.9.2'
22
22
  # :startdoc:
23
23
 
24
24
  # Returns the version string for the library.
@@ -88,14 +88,14 @@ describe Endeca::Document do
88
88
 
89
89
  @document.
90
90
  stub!(:raw).
91
- and_return({'Dimensions' => {"key" => dimension_hash}})
91
+ and_return({'Dimensions' => {"key" => [dimension_hash]}})
92
92
 
93
93
  Endeca::Dimension.
94
94
  should_receive(:new).
95
95
  with(dimension_hash).
96
96
  and_return(dimension)
97
97
 
98
- @document.dimensions["key"].should == dimension
98
+ @document.dimensions["key"].should == [dimension]
99
99
  end
100
100
  end
101
101
  end
@@ -72,35 +72,6 @@ describe Endeca::Readers do
72
72
  end
73
73
  end
74
74
 
75
- describe ".dim_reader" do
76
- describe "with a symbol" do
77
- it "adds a reader that returns the name of that dimension" do
78
- @helper.dim_reader(:type)
79
- dimensions = {"type" => mock('type', :name => 'a type')}
80
- @a_helper.stub!(:dimensions).and_return(dimensions)
81
- @a_helper.type.should == 'a type'
82
- end
83
- end
84
-
85
- describe "with a string" do
86
- it "adds a reader that returns the name of that dimension" do
87
- @helper.dim_reader('type')
88
- dimensions = {"type" => mock('type', :name => 'a type')}
89
- @a_helper.stub!(:dimensions).and_return(dimensions)
90
- @a_helper.type.should == 'a type'
91
- end
92
- end
93
-
94
- describe "with a string that has spaces" do
95
- it "adds a reader that returns the name of that dimension" do
96
- @helper.dim_reader('type a lot' => :type_a_lot)
97
- dimensions = {"type a lot" => mock('type', :name => 'a type')}
98
- @a_helper.stub!(:dimensions).and_return(dimensions)
99
- @a_helper.type_a_lot.should == 'a type'
100
- end
101
- end
102
- end
103
-
104
75
  describe "exception handling" do
105
76
  it "should raise an Endeca::Reader error if the call fails" do
106
77
  helper = Class.new(Endeca::Document)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primedia-endeca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rein Henrichs