legato 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/legato/query.rb +10 -4
- data/lib/legato/version.rb +1 -1
- data/spec/lib/legato/query_spec.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 304acd2f0f716bf682b425bea037c4445afc97fd
|
4
|
+
data.tar.gz: 4443a2410d7c782ae282bd4913ae5f5e6730cadd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d978c8ac87bcab86a9ac8003b7afb18735f8f7281203bb186f23d0cc773a33b2ac1cd5750f502ad1ed0490a47189c6311d63f5e09f005452614dc69a750ac501
|
7
|
+
data.tar.gz: c1d37f5c5b819ae0c14fc7a88b486165c5ad000d1762550ee8e12a15cbe63d36668c7fc69b743dcc22cda394a3cf76862ba651db1f522849a7e0e7749bb02b8c
|
data/CHANGELOG.md
CHANGED
data/lib/legato/query.rb
CHANGED
@@ -39,6 +39,10 @@ module Legato
|
|
39
39
|
attr_accessor :filters, :segment_filters # combined, can be appended to
|
40
40
|
attr_accessor :tracking_scope
|
41
41
|
|
42
|
+
def self.from_query(query)
|
43
|
+
new(query.parent_klass, query.tracking_scope)
|
44
|
+
end
|
45
|
+
|
42
46
|
def initialize(klass, tracking_scope = "ga")
|
43
47
|
@loaded = false
|
44
48
|
@parent_klass = klass
|
@@ -164,11 +168,13 @@ module Legato
|
|
164
168
|
|
165
169
|
# if no filters, we use results to add profile
|
166
170
|
def results(profile=nil, options={})
|
167
|
-
|
171
|
+
query = loaded? ? Query.from_query(self) : self
|
168
172
|
|
169
|
-
|
170
|
-
|
171
|
-
|
173
|
+
options, profile = profile, self.profile if profile.is_a?(Hash)
|
174
|
+
|
175
|
+
query.profile = profile
|
176
|
+
query.apply_options(options)
|
177
|
+
query
|
172
178
|
end
|
173
179
|
|
174
180
|
# def total_results
|
data/lib/legato/version.rb
CHANGED
@@ -123,15 +123,25 @@ describe Legato::Query do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
it 'sets options and returns self' do
|
126
|
+
profile = @query.profile
|
126
127
|
@query.stubs(:profile=)
|
127
128
|
@query.stubs(:apply_options)
|
128
129
|
|
129
130
|
@query.results({:sort => [:city]}).should == @query
|
130
131
|
|
131
|
-
@query.should have_received(:profile=).
|
132
|
+
@query.should have_received(:profile=).with(profile)
|
132
133
|
@query.should have_received(:apply_options).with({:sort => [:city]})
|
133
134
|
end
|
134
135
|
|
136
|
+
it 'creates a new query if collection has already been loaded' do
|
137
|
+
@query.stubs(:loaded?).returns(true)
|
138
|
+
|
139
|
+
new_query = @query.results({offset: 10_000})
|
140
|
+
|
141
|
+
expect(new_query).to_not eql(@query)
|
142
|
+
expect(new_query.offset).to eql(10_000)
|
143
|
+
end
|
144
|
+
|
135
145
|
context "when modifying dimensions" do
|
136
146
|
it 'changes the query dimensions' do
|
137
147
|
@query.dimensions << :city
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: legato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|