lazy_google_analytics 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -34,6 +34,7 @@ module LazyGoogleAnalytics
|
|
34
34
|
|
35
35
|
def results
|
36
36
|
@results = @auth.client.execute(@options)
|
37
|
+
raise_detected_errors
|
37
38
|
end
|
38
39
|
|
39
40
|
def formatted_columns
|
@@ -58,6 +59,15 @@ module LazyGoogleAnalytics
|
|
58
59
|
@options.merge! name => opts
|
59
60
|
end
|
60
61
|
|
62
|
+
def raise_detected_errors
|
63
|
+
body = JSON.parse(@results.body)
|
64
|
+
if body.keys.include?("error")
|
65
|
+
raise body["error"]["errors"].collect{|e| e["reason"] + e["message"] }.join(", ")
|
66
|
+
else
|
67
|
+
@results
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
61
71
|
end
|
62
72
|
end
|
63
73
|
|
@@ -1,5 +1,24 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
|
2
2
|
|
3
|
+
|
4
|
+
describe "errors" do
|
5
|
+
before :each do
|
6
|
+
config_setup
|
7
|
+
@error_report = LazyGoogleAnalytics::Client.new()
|
8
|
+
@error_report.parameters({'ids' => "ga:#{LazyGoogleAnalytics::Config.profile_id}",
|
9
|
+
'start-date' => DateTime.now.prev_month.strftime("%Y-%m-%d"),
|
10
|
+
'end-date' => DateTime.now.strftime("%Y-%m-%d"),
|
11
|
+
'dimensions' => "ga:year,ga:month",
|
12
|
+
'metrics' => "ga:visits,ga:bounces,ga:entranceBounceRate",
|
13
|
+
'sort' => "ga:month,ga:day" })
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should raise and error" do
|
18
|
+
lambda { @error_report.results }.should raise_error
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
3
22
|
describe "Client" do
|
4
23
|
before(:all) do
|
5
24
|
config_setup
|
@@ -20,3 +39,5 @@ describe "Client" do
|
|
20
39
|
end
|
21
40
|
|
22
41
|
end
|
42
|
+
|
43
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazy_google_analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -140,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
segments:
|
142
142
|
- 0
|
143
|
-
hash: -
|
143
|
+
hash: -3670511021453100152
|
144
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
145
|
none: false
|
146
146
|
requirements:
|
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
segments:
|
151
151
|
- 0
|
152
|
-
hash: -
|
152
|
+
hash: -3670511021453100152
|
153
153
|
requirements: []
|
154
154
|
rubyforge_project:
|
155
155
|
rubygems_version: 1.8.25
|