primedia-endeca 1.3.6 → 1.3.7
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 +4 -4
- data/lib/core_ext.rb +6 -0
- data/lib/endeca.rb +1 -2
- data/lib/endeca/request.rb +0 -3
- data/spec/endeca/request_spec.rb +0 -1
- metadata +2 -4
- data/lib/endeca/caching.rb +0 -70
- data/spec/endeca/caching_spec.rb +0 -73
data/endeca.gemspec
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{endeca}
|
5
|
-
s.version = "1.3.
|
5
|
+
s.version = "1.3.7"
|
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"]
|
9
|
-
s.date = %q{2009-09-
|
9
|
+
s.date = %q{2009-09-15}
|
10
10
|
s.description = %q{An Endeca client library for Ruby.}
|
11
11
|
s.email = %q{}
|
12
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
|
13
|
-
s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "endeca.gemspec", "example/benchmark.rb", "example/listing.rb", "lib/class_to_proc.rb", "lib/core_ext.rb", "lib/endeca.rb", "lib/endeca/benchmarking.rb", "lib/endeca/breadcrumb.rb", "lib/endeca/breadcrumbs.rb", "lib/endeca/
|
13
|
+
s.files = ["History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "endeca.gemspec", "example/benchmark.rb", "example/listing.rb", "lib/class_to_proc.rb", "lib/core_ext.rb", "lib/endeca.rb", "lib/endeca/benchmarking.rb", "lib/endeca/breadcrumb.rb", "lib/endeca/breadcrumbs.rb", "lib/endeca/dimension.rb", "lib/endeca/document.rb", "lib/endeca/document_collection.rb", "lib/endeca/logging.rb", "lib/endeca/map.rb", "lib/endeca/readers.rb", "lib/endeca/refinement.rb", "lib/endeca/refinement_dimension.rb", "lib/endeca/request.rb", "lib/endeca/transformer.rb", "spec/core_ext_spec.rb", "spec/endeca/benchmarking_spec.rb", "spec/endeca/breadcrumb_spec.rb", "spec/endeca/dimension_spec.rb", "spec/endeca/document_collection_spec.rb", "spec/endeca/document_spec.rb", "spec/endeca/map_spec.rb", "spec/endeca/readers_spec.rb", "spec/endeca/refinement_dimension_spec.rb", "spec/endeca/refinement_spec.rb", "spec/endeca/request_spec.rb", "spec/endeca/transformer_spec.rb", "spec/endeca_spec.rb", "spec/rcov.opts", "spec/spec.opts", "spec/spec_helper.rb"]
|
14
14
|
s.homepage = %q{http://github.com/primedia/endeca-ruby}
|
15
15
|
s.rdoc_options = ["--main", "README.rdoc"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{endeca}
|
18
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
19
|
s.summary = %q{An Endeca client library for Ruby}
|
20
20
|
end
|
data/lib/core_ext.rb
CHANGED
data/lib/endeca.rb
CHANGED
@@ -2,7 +2,6 @@ require 'rubygems'
|
|
2
2
|
require 'net/http'
|
3
3
|
require 'json'
|
4
4
|
require 'logger'
|
5
|
-
require 'activesupport'
|
6
5
|
|
7
6
|
$:.unshift(File.dirname(__FILE__))
|
8
7
|
require 'core_ext'
|
@@ -27,7 +26,7 @@ module Endeca
|
|
27
26
|
extend Logging
|
28
27
|
|
29
28
|
# :stopdoc:
|
30
|
-
VERSION = '1.3.
|
29
|
+
VERSION = '1.3.7'
|
31
30
|
# :startdoc:
|
32
31
|
|
33
32
|
# Returns the version string for the library.
|
data/lib/endeca/request.rb
CHANGED
data/spec/endeca/request_spec.rb
CHANGED
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: 1.3.
|
4
|
+
version: 1.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rein Henrichs
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-09-
|
13
|
+
date: 2009-09-15 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -38,7 +38,6 @@ files:
|
|
38
38
|
- lib/endeca/benchmarking.rb
|
39
39
|
- lib/endeca/breadcrumb.rb
|
40
40
|
- lib/endeca/breadcrumbs.rb
|
41
|
-
- lib/endeca/caching.rb
|
42
41
|
- lib/endeca/dimension.rb
|
43
42
|
- lib/endeca/document.rb
|
44
43
|
- lib/endeca/document_collection.rb
|
@@ -52,7 +51,6 @@ files:
|
|
52
51
|
- spec/core_ext_spec.rb
|
53
52
|
- spec/endeca/benchmarking_spec.rb
|
54
53
|
- spec/endeca/breadcrumb_spec.rb
|
55
|
-
- spec/endeca/caching_spec.rb
|
56
54
|
- spec/endeca/dimension_spec.rb
|
57
55
|
- spec/endeca/document_collection_spec.rb
|
58
56
|
- spec/endeca/document_spec.rb
|
data/lib/endeca/caching.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'digest/sha1'
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'active_support/core_ext/module/aliasing'
|
5
|
-
require 'active_support/core_ext/array'
|
6
|
-
require 'active_support/core_ext/class'
|
7
|
-
require 'active_support/cache'
|
8
|
-
require 'endeca'
|
9
|
-
|
10
|
-
module Endeca #:nodoc:
|
11
|
-
|
12
|
-
class << self
|
13
|
-
def perform_caching?
|
14
|
-
!cache_store.nil?
|
15
|
-
end
|
16
|
-
|
17
|
-
def cache_store
|
18
|
-
@cache_store
|
19
|
-
end
|
20
|
-
|
21
|
-
def disable_caching
|
22
|
-
@cache_store = nil
|
23
|
-
end
|
24
|
-
|
25
|
-
# Defines the storage option for cached queries
|
26
|
-
#
|
27
|
-
# ActiveSupport::Cache.lookup_store will return MemoryStore
|
28
|
-
# if nil is passed in and we don't want that.
|
29
|
-
def cache_store=(store_option)
|
30
|
-
if store_option
|
31
|
-
@cache_store = ActiveSupport::Cache.lookup_store(store_option)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# Caching is a way to speed up slow Endeca queries by keeping the result of
|
37
|
-
# an Endeca request around to be reused by subequest requests. Caching is
|
38
|
-
# turned off by default.
|
39
|
-
#
|
40
|
-
# Note: To ensure that caching is turned off, set Endeca.cache_store = nil
|
41
|
-
#
|
42
|
-
# == Caching stores
|
43
|
-
#
|
44
|
-
# All the caching stores from ActiveSupport::Cache are available to be used
|
45
|
-
# as backends for Endeca caching. See the Rails rdoc for more information on
|
46
|
-
# these stores
|
47
|
-
#
|
48
|
-
# Configuration examples (MemoryStore is the default):
|
49
|
-
#
|
50
|
-
# Endeca.cache_store = :memory_store
|
51
|
-
# Endeca.cache_store = :file_store, "/path/to/cache/directory"
|
52
|
-
# Endeca.cache_store = :drb_store, "druby://localhost:9192"
|
53
|
-
# Endeca.cache_store = :mem_cache_store, "localhost"
|
54
|
-
# Endeca.cache_store = MyOwnStore.new("parameter")
|
55
|
-
module Caching
|
56
|
-
def self.included(base)
|
57
|
-
base.alias_method_chain :get_response, :caching
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def get_response_with_caching #:nodoc:
|
63
|
-
return get_response_without_caching unless Endeca.perform_caching?
|
64
|
-
fetch { get_response_without_caching }
|
65
|
-
end
|
66
|
-
|
67
|
-
def cache_key; Digest::SHA1.hexdigest uri.to_s end
|
68
|
-
def fetch(&block); Endeca.cache_store.fetch(cache_key, &block) end
|
69
|
-
end
|
70
|
-
end
|
data/spec/endeca/caching_spec.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), %w[.. spec_helper])
|
2
|
-
|
3
|
-
describe Endeca::Request do
|
4
|
-
before(:all) do
|
5
|
-
Endeca.cache_store = :memory_store
|
6
|
-
end
|
7
|
-
|
8
|
-
after(:all) do
|
9
|
-
Endeca.disable_caching
|
10
|
-
end
|
11
|
-
|
12
|
-
before do
|
13
|
-
@path = "http://example.com"
|
14
|
-
@query = "foo=bar"
|
15
|
-
@request = Endeca::Request.new(@path, @query)
|
16
|
-
@response = {"a successful" => "response"}
|
17
|
-
|
18
|
-
@request.stub!(:handle_response).and_return(@response)
|
19
|
-
@cache_key = :key
|
20
|
-
@request.stub!(:cache_key).and_return(@cache_key)
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "When a cached response is available" do
|
24
|
-
before do
|
25
|
-
Endeca.cache_store.write(@cache_key, @response)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should not perform the request" do
|
29
|
-
@request.should_not_receive(:get_response_without_caching)
|
30
|
-
@request.perform
|
31
|
-
end
|
32
|
-
|
33
|
-
it "should read from the cache" do
|
34
|
-
@request.perform.should == @response
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "When a cached response is not available" do
|
39
|
-
before do
|
40
|
-
Endeca.cache_store.delete(@cache_key)
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should perform the request" do
|
44
|
-
@request.should_receive(:get_response_without_caching)
|
45
|
-
@request.perform
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should cache the response using the caching key" do
|
49
|
-
@request.stub!(:get_response_without_caching).and_return(@response)
|
50
|
-
|
51
|
-
@request.perform
|
52
|
-
Endeca.cache_store.read(@request.send(:cache_key)).should == @response
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
describe Endeca::Caching do
|
59
|
-
it "should return false when cache store is not set" do
|
60
|
-
Endeca.perform_caching?.should be_false
|
61
|
-
end
|
62
|
-
|
63
|
-
it "should return false when if disable_caching has been set" do
|
64
|
-
Endeca.cache_store = :memory_store
|
65
|
-
Endeca.disable_caching
|
66
|
-
Endeca.perform_caching?.should be_false
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should return memory store" do
|
70
|
-
Endeca.cache_store = :memory_store
|
71
|
-
Endeca.cache_store.class.should == ActiveSupport::Cache::MemoryStore
|
72
|
-
end
|
73
|
-
end
|