legato 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZGEwNThlYTM2NzM2YTVlYTgxYmMxODFkMWEzNjEyM2QyYjg1NWI2Ng==
5
+ data.tar.gz: !binary |-
6
+ OGI3NzZlYzdlZmI3NzVlZDIxM2I0YWFkYjU5NzE5NGU2NDFmZGQzMw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MjgxODA4Nzg3YmVjNjZhNDMwMmE2ZTQ2Y2U3ZmExOTg0ZjQ1NDdjMjI3YjNh
10
+ ZmNiNTk3ZjhkOWQ4OTJiY2ZiMGU2YTI2ZGU1MzUyYjAyYTBkZTViYjJlOTMy
11
+ MDdlNWUzNTBiODI1ZjQ4MGJhNzhiMGM4N2U0YTU1NzcxNTVhZGU=
12
+ data.tar.gz: !binary |-
13
+ Y2E3ZDQxNmIyMDJkOTU3NmQzMmE0ZDA1MmJkNDY3ZGE5MGUyYjVhZmFiOGI0
14
+ MWM0Y2E4YjJkY2EwNWNkNWFjN2NlM2Y4N2I2OWRhN2UxZGUwMDViYjc4MmJi
15
+ MjY2OTI0MjNkZmIxZGM1MzUzNjBiODQ0NDQ0Yzg5ODY1M2M5MDY=
@@ -4,7 +4,7 @@ rvm:
4
4
  - 1.9.2
5
5
  - 1.9.3
6
6
  - 2.0.0
7
- - 2.1.0
7
+ - 2.1.2
8
8
  script: bundle exec rspec spec
9
9
  notifications:
10
10
  webhooks:
@@ -1,3 +1,9 @@
1
+ ## Legato 0.3.3 ##
2
+
3
+ * Adds `realtime` to `Legato::Model`, returns `Query` with tracking_scope set for the realtime API
4
+
5
+ *Tony Pitale*
6
+
1
7
  ## Legato 0.3.2 ##
2
8
 
3
9
  * Fixes `sampling_level` not being properly sent in query params
data/README.md CHANGED
@@ -262,10 +262,19 @@ https://developers.google.com/analytics/devguides/reporting/realtime/dimsmets/
262
262
 
263
263
  GA provides an endpoint to do **basic** reporting in near-realtime. Please read the above documentation to know which features (and dimentsion/metrics) are or are _not_ available. It is also only available in **beta** so you must already have access.
264
264
 
265
- Inside of Legato, you can simply add `realtime` to your query, like this:
265
+ Inside of Legato, you can simply add `realtime` to your query (`#results` returns a `Query` instance), like this:
266
266
 
267
267
  ```ruby
268
- Exit.realtime.results(profile)
268
+ Exit.results(profile).realtime
269
+ ```
270
+ The results you iterate over (with `.each`, etc) will be from the realtime reporting API.
271
+
272
+ You can also call `realtime` on your model to get a new `Query` instance with realtime API set.
273
+
274
+ ```ruby
275
+ query = Exit.realtime
276
+ query.realtime? #=> true
277
+ query.tracking_scope #=> 'rt'
269
278
  ```
270
279
 
271
280
  ## License ##
@@ -91,6 +91,13 @@ module Legato
91
91
  Query.new(self).results(profile, options)
92
92
  end
93
93
 
94
+ # Builds a `query` and sets the `realtime` property
95
+ #
96
+ # @return [Query] a new query with `realtime` property set
97
+ def realtime
98
+ Query.new(self).realtime
99
+ end
100
+
94
101
  def options_from_fields(fields)
95
102
  options = fields.pop if fields.last.is_a?(Hash)
96
103
  [fields, (options || {})]
@@ -197,6 +197,10 @@ module Legato
197
197
  profile && Legato.to_ga_string(profile.id)
198
198
  end
199
199
 
200
+ def realtime?
201
+ tracking_scope == 'rt'
202
+ end
203
+
200
204
  def realtime
201
205
  self.tracking_scope = 'rt'
202
206
  self
@@ -1,3 +1,3 @@
1
1
  module Legato
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -110,5 +110,10 @@ describe "Legato::Model" do
110
110
  Legato::Query.should have_received(:new).with(@model)
111
111
  query.should have_received(:results).with(profile, options)
112
112
  end
113
+
114
+ it 'has a query with realtime set' do
115
+ query = @model.realtime
116
+ expect(query.realtime?).to eq(true)
117
+ end
113
118
  end
114
119
  end
@@ -144,6 +144,20 @@ describe Legato::Query do
144
144
  @query.dimensions << :city
145
145
  @klass.dimensions.should eq(empty_dimensions)
146
146
  end
147
+
148
+ it 'accepts an array of dimensions' do
149
+ @query.dimensions << [:city, :browser]
150
+ @query.dimensions.include?(:city).should eq(true)
151
+ @query.dimensions.include?(:browser).should eq(true)
152
+ end
153
+
154
+ it 'does not share metrics across queries' do
155
+ query1 = Legato::Query.new(@klass)
156
+ query2 = Legato::Query.new(@klass)
157
+
158
+ query1.dimensions << :city
159
+ expect(query2.dimensions).to_not include(:city)
160
+ end
147
161
  end
148
162
 
149
163
  context "when modifying metrics" do
@@ -158,6 +172,20 @@ describe Legato::Query do
158
172
  @query.metrics << :pageviews
159
173
  @klass.metrics.should eq(empty_metrics)
160
174
  end
175
+
176
+ it 'accepts an array of metrics' do
177
+ @query.metrics << [:pageviews, :sessions]
178
+ @query.metrics.include?(:pageviews).should eq(true)
179
+ @query.metrics.include?(:sessions).should eq(true)
180
+ end
181
+
182
+ it 'does not share metrics across queries' do
183
+ query1 = Legato::Query.new(@klass)
184
+ query2 = Legato::Query.new(@klass)
185
+
186
+ query1.metrics << :pageviews
187
+ expect(query2.metrics).to_not include(:pageviews)
188
+ end
161
189
  end
162
190
 
163
191
  context 'when applying filters' do
@@ -1,5 +1,9 @@
1
- require 'simplecov'
2
- SimpleCov.start
1
+ begin
2
+ require 'simplecov'
3
+ SimpleCov.start
4
+ rescue
5
+ # we do not have simplecov in 1.8
6
+ end
3
7
 
4
8
  require 'bundler/setup'
5
9
 
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
5
- prerelease:
4
+ version: 0.3.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tony Pitale
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-22 00:00:00.000000000 Z
11
+ date: 2014-08-01 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: mocha
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: bourne
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ! '>='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ! '>='
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: vcr
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - '='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - '='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: fakeweb
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ! '>='
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ! '>='
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: simplecov
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ! '>='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ! '>='
124
109
  - !ruby/object:Gem::Version
@@ -126,7 +111,6 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: multi_json
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
115
  - - ! '>='
132
116
  - !ruby/object:Gem::Version
@@ -134,7 +118,6 @@ dependencies:
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
122
  - - ! '>='
140
123
  - !ruby/object:Gem::Version
@@ -204,27 +187,26 @@ files:
204
187
  - spec/support/macros/oauth.rb
205
188
  homepage: http://github.com/tpitale/legato
206
189
  licenses: []
190
+ metadata: {}
207
191
  post_install_message:
208
192
  rdoc_options: []
209
193
  require_paths:
210
194
  - lib
211
195
  required_ruby_version: !ruby/object:Gem::Requirement
212
- none: false
213
196
  requirements:
214
197
  - - ! '>='
215
198
  - !ruby/object:Gem::Version
216
199
  version: 1.8.7
217
200
  required_rubygems_version: !ruby/object:Gem::Requirement
218
- none: false
219
201
  requirements:
220
202
  - - ! '>='
221
203
  - !ruby/object:Gem::Version
222
204
  version: '0'
223
205
  requirements: []
224
206
  rubyforge_project: legato
225
- rubygems_version: 1.8.29
207
+ rubygems_version: 2.2.1
226
208
  signing_key:
227
- specification_version: 3
209
+ specification_version: 4
228
210
  summary: Access the Google Analytics API with Ruby
229
211
  test_files:
230
212
  - spec/cassettes/management/accounts.json