picky-client 4.0.8 → 4.0.9
Sign up to get free protection for your applications and to get access to all the features.
@@ -31,8 +31,8 @@ module Picky
|
|
31
31
|
# Note: See class documentation for a description.
|
32
32
|
#
|
33
33
|
# Examples:
|
34
|
-
# Picky::Client::ActiveRecord.
|
35
|
-
# Picky::Client::ActiveRecord.
|
34
|
+
# Picky::Client::ActiveRecord.configure
|
35
|
+
# Picky::Client::ActiveRecord.configure('name', 'surname', index: 'some_index_name')
|
36
36
|
#
|
37
37
|
# Options:
|
38
38
|
# * index: The index name to save to.
|
@@ -41,6 +41,9 @@ module Picky
|
|
41
41
|
# * path: The path the Picky server uses for index updates (use e.f. extend Picky::Sinatra::IndexActions to open up a HTTP indexing interface).
|
42
42
|
# * client: The client to use if you want to pass in your own (host, port, path options will be ignored).
|
43
43
|
#
|
44
|
+
def self.configure *attributes
|
45
|
+
new *attributes
|
46
|
+
end
|
44
47
|
def initialize *attributes
|
45
48
|
options = {}
|
46
49
|
options = attributes.pop if attributes.last.respond_to?(:to_hash)
|
@@ -57,7 +57,7 @@ describe Picky::Client::ActiveRecord do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
context 'default module' do
|
60
|
-
let(:ar_module) { described_class.
|
60
|
+
let(:ar_module) { described_class.configure }
|
61
61
|
|
62
62
|
it 'is (also) a module' do
|
63
63
|
ar_module.should be_kind_of(Module)
|
@@ -80,7 +80,7 @@ describe Picky::Client::ActiveRecord do
|
|
80
80
|
context 'with params' do
|
81
81
|
let(:client) { stub :client }
|
82
82
|
context 'with client' do
|
83
|
-
let(:ar_module) { described_class.
|
83
|
+
let(:ar_module) { described_class.configure :client => client }
|
84
84
|
let(:ar) { fake_ar.extend(ar_module).new(1, 'Niko', 'Dittmann') }
|
85
85
|
|
86
86
|
it 'is a module' do
|
@@ -102,7 +102,7 @@ describe Picky::Client::ActiveRecord do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
context 'with client and index' do
|
105
|
-
let(:ar_module) { described_class.
|
105
|
+
let(:ar_module) { described_class.configure :client => client, :index => 'some_other_index_name' }
|
106
106
|
let(:ar) { fake_ar.extend(ar_module).new(1, 'Niko', 'Dittmann') }
|
107
107
|
|
108
108
|
it 'is a module' do
|
@@ -122,7 +122,7 @@ describe Picky::Client::ActiveRecord do
|
|
122
122
|
end
|
123
123
|
end
|
124
124
|
context 'with client and specific attributes' do
|
125
|
-
let(:ar_module) { described_class.
|
125
|
+
let(:ar_module) { described_class.configure 'name', :client => client }
|
126
126
|
let(:ar) { fake_ar.extend(ar_module).new(1, 'Niko', 'Dittmann') }
|
127
127
|
|
128
128
|
it 'is a module' do
|
@@ -145,12 +145,12 @@ describe Picky::Client::ActiveRecord do
|
|
145
145
|
it 'instantiates the client correctly' do
|
146
146
|
Picky::Client.should_receive(:new).once.with :path => '/'
|
147
147
|
|
148
|
-
described_class.
|
148
|
+
described_class.configure
|
149
149
|
end
|
150
150
|
it 'instantiates the client correctly' do
|
151
151
|
Picky::Client.should_receive(:new).once.with :host => 'some_host', :port => :some_port, :path => '/bla'
|
152
152
|
|
153
|
-
described_class.
|
153
|
+
described_class.configure :host => 'some_host', :port => :some_port, :path => '/bla'
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picky-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yajl-ruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &70147404189540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.7.8
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70147404189540
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70147404188720 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 3.0.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70147404188720
|
36
36
|
description: Picky Client
|
37
37
|
email: florian.hanke+picky-client@gmail.com
|
38
38
|
executables: []
|