legato 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/CHANGELOG.md +14 -0
- data/legato.gemspec +1 -0
- data/lib/legato/list_parameter.rb +4 -0
- data/lib/legato/query.rb +2 -2
- data/lib/legato/version.rb +1 -1
- data/spec/lib/legato/query_spec.rb +29 -0
- data/spec/spec_helper.rb +5 -0
- metadata +18 -2
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## Legato 0.2.0 ##
|
2
|
+
|
3
|
+
* Changed Query API for #metrics & #dimensions
|
4
|
+
|
5
|
+
If you add metrics and dimensions to a query, it will not modify the
|
6
|
+
parent (of the query) class's dimensions or metrics. Resolves issue #40.
|
7
|
+
|
8
|
+
*Tony Pitale*
|
9
|
+
|
10
|
+
## Legato 0.1.0 ##
|
11
|
+
|
12
|
+
* Added dynamic segment support from @etiennebarrie
|
13
|
+
* Fixed some readme typos from PR by @juuso
|
14
|
+
|
1
15
|
## Legato 0.0.3 ##
|
2
16
|
|
3
17
|
* Merged branch oauth-1-support
|
data/legato.gemspec
CHANGED
data/lib/legato/query.rb
CHANGED
@@ -172,11 +172,11 @@ module Legato
|
|
172
172
|
# end
|
173
173
|
|
174
174
|
def metrics
|
175
|
-
parent_klass.metrics
|
175
|
+
@metrics ||= parent_klass.metrics.dup
|
176
176
|
end
|
177
177
|
|
178
178
|
def dimensions
|
179
|
-
parent_klass.dimensions
|
179
|
+
@dimensions ||= parent_klass.dimensions.dup
|
180
180
|
end
|
181
181
|
|
182
182
|
def sort=(arr)
|
data/lib/legato/version.rb
CHANGED
@@ -18,6 +18,7 @@ describe Legato::Query do
|
|
18
18
|
context "a query" do
|
19
19
|
before :each do
|
20
20
|
@klass = Class.new
|
21
|
+
@klass.extend(Legato::Model)
|
21
22
|
@block = lambda {eql(:key, 1000)}
|
22
23
|
@klass.stubs(:filters).returns({:high => @block})
|
23
24
|
@klass.stubs(:segments).returns([])
|
@@ -131,6 +132,34 @@ describe Legato::Query do
|
|
131
132
|
@query.should have_received(:apply_options).with({:sort => [:city]})
|
132
133
|
end
|
133
134
|
|
135
|
+
context "when modifying dimensions" do
|
136
|
+
it 'changes the query dimensions' do
|
137
|
+
@query.dimensions << :city
|
138
|
+
@query.dimensions.include?(:city).should be_true
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'does not change the parent class dimensions' do
|
142
|
+
empty_dimensions = Legato::ListParameter.new(:dimensions, [])
|
143
|
+
|
144
|
+
@query.dimensions << :city
|
145
|
+
@klass.dimensions.should eq(empty_dimensions)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
context "when modifying metrics" do
|
150
|
+
it 'changes the query metrics' do
|
151
|
+
@query.metrics << :pageviews
|
152
|
+
@query.metrics.include?(:pageviews).should be_true
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'does not change the parent class metrics' do
|
156
|
+
empty_metrics = Legato::ListParameter.new(:metrics, [])
|
157
|
+
|
158
|
+
@query.metrics << :pageviews
|
159
|
+
@klass.metrics.should eq(empty_metrics)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
134
163
|
context 'when applying filters' do
|
135
164
|
before :each do
|
136
165
|
@filter = Legato::Filter.new(:key, :eql, 1000, nil)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: legato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -123,6 +123,22 @@ dependencies:
|
|
123
123
|
- - ! '>='
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: simplecov
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
126
142
|
- !ruby/object:Gem::Dependency
|
127
143
|
name: multi_json
|
128
144
|
requirement: !ruby/object:Gem::Requirement
|