ga_collector_pusher 0.2.1 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 758ab689524a77fb611d1278a9dc2361b0db20a3
4
- data.tar.gz: dfb389df6bd735555ef86e64126cf633e0560f7b
3
+ metadata.gz: 04884778a7c20cea46872127570bc9e925c570c2
4
+ data.tar.gz: 6208dcf63f2cf4ac9cd1c6017bd1d3ab5410cc66
5
5
  SHA512:
6
- metadata.gz: 2bbdcd6465e0cc850ec2e46051175fa090da5ec09fbd36065bff8fb088d06850ceeae4d56c111a0410d9afa7c3fda9f1f6c1136b0e136e684421b17bcc8e64ef
7
- data.tar.gz: 3f7b7d45262290d45eb9b4f4e43dd98626fa474d6b0f355f575bf097b713a2be0ca6dfc3f8455591f84572852603248a107f92219416c2e993da54e9e3a12fd0
6
+ metadata.gz: de8b04bea7570e9a0f741501c809b07a4ab1dc8cbefac4800a7741fee9ab4276196b0646c35a56c5986f050bf45dabd1091eb7fe09a4b2a67e082e886f7a6cf7
7
+ data.tar.gz: bee1e822937dcc14963bd2adedebd7e574790a9aea7d7e57327fefd1c7ed2eb2e3618712daf6b6c75a2637dac0ac0feed18db0ff1e7df174ab2c1a784e28af78
data/Gemfile.lock CHANGED
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ga_collector_pusher (0.2)
4
+ ga_collector_pusher (0.2.5)
5
5
  activesupport
6
6
  rest-client
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (4.1.10)
11
+ activesupport (4.1.16)
12
12
  i18n (~> 0.6, >= 0.6.9)
13
13
  json (~> 1.7, >= 1.7.7)
14
14
  minitest (~> 5.1)
15
15
  thread_safe (~> 0.1)
16
16
  tzinfo (~> 1.1)
17
17
  diff-lcs (1.2.5)
18
- domain_name (0.5.23)
18
+ domain_name (0.5.20160615)
19
19
  unf (>= 0.0.5, < 1.0.0)
20
20
  faker (1.4.3)
21
21
  i18n (~> 0.5)
@@ -23,14 +23,16 @@ GEM
23
23
  domain_name (~> 0.5)
24
24
  i18n (0.6.11)
25
25
  json (1.8.3)
26
- mime-types (2.4.3)
27
- minitest (5.7.0)
28
- netrc (0.10.3)
26
+ mime-types (3.1)
27
+ mime-types-data (~> 3.2015)
28
+ mime-types-data (3.2016.0521)
29
+ minitest (5.9.0)
30
+ netrc (0.11.0)
29
31
  rake (10.4.2)
30
- rest-client (1.8.0)
32
+ rest-client (2.0.0)
31
33
  http-cookie (>= 1.0.2, < 2.0)
32
- mime-types (>= 1.16, < 3.0)
33
- netrc (~> 0.7)
34
+ mime-types (>= 1.16, < 4.0)
35
+ netrc (~> 0.8)
34
36
  rspec (3.1.0)
35
37
  rspec-core (~> 3.1.0)
36
38
  rspec-expectations (~> 3.1.0)
@@ -48,7 +50,7 @@ GEM
48
50
  thread_safe (~> 0.1)
49
51
  unf (0.1.4)
50
52
  unf_ext
51
- unf_ext (0.0.6)
53
+ unf_ext (0.0.7.2)
52
54
 
53
55
  PLATFORMS
54
56
  ruby
@@ -58,3 +60,6 @@ DEPENDENCIES
58
60
  ga_collector_pusher!
59
61
  rake
60
62
  rspec
63
+
64
+ BUNDLED WITH
65
+ 1.10.6
data/README.rdoc CHANGED
@@ -1 +1,5 @@
1
- TODO
1
+ # Configuration
2
+ * GACollectorPusher::Config.verbose = true
3
+ > Outputs more data to logs
4
+ * GACollectorPusher::Config.paranoid = true
5
+ > If returned GA push response status is not 20x then raises errors
@@ -1,6 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
  require "ga_collector_pusher/version"
4
+ require "ga_collector_pusher/config"
4
5
 
5
6
  Gem::Specification.new do |s|
6
7
  s.name = "ga_collector_pusher"
@@ -0,0 +1,10 @@
1
+ module GACollectorPusher
2
+ class Config
3
+
4
+ class << self
5
+ attr_accessor :paranoid
6
+ attr_accessor :verbose
7
+ end
8
+
9
+ end
10
+ end
@@ -70,7 +70,6 @@ module GACollectorPusher
70
70
  send_to_ga
71
71
  end
72
72
 
73
-
74
73
  #convert bool to integer
75
74
  def add_exception description: nil, is_fatal: false
76
75
  is_fatal_int = is_fatal ? 1 : 0
@@ -98,9 +97,17 @@ module GACollectorPusher
98
97
 
99
98
  begin
100
99
  response = RestClient.post 'http://www.google-analytics.com/collect', params: @params, timeout: self.timeout, open_timeout: self.open_timeout
101
- status = "sent"
102
- rescue => error
100
+ puts "GACollectorPusher Sent params: #{@params.inspect}. Response from GA: #{response.force_encoding('utf-8').encode.to_s} with Code: #{response.code}" if GACollectorPusher::Config.verbose
101
+
102
+ if (200..207).to_a.include? response.code
103
+ status = "sent"
104
+ else
105
+ raise "GACollectorPusher received non 20x status from GA for #{@params}" if GACollectorPusher::Config.paranoid
106
+ status = "error"
107
+ end
108
+ rescue RestClient::ExceptionWithResponse => error
103
109
  response = error.inspect
110
+ puts "GACollectorPusher error: #{response}" if GACollectorPusher::Config.verbose
104
111
  status = "error"
105
112
  end
106
113
 
@@ -1,3 +1,3 @@
1
1
  module GACollectorPusher
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.7"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  require 'rest-client'
2
2
  require 'active_support/core_ext'
3
3
  require 'ga_collector_pusher/instance'
4
+ require 'ga_collector_pusher/config'
4
5
 
5
6
  module GACollectorPusher
6
7
  def self.new
data/spec/config.rb CHANGED
@@ -2,4 +2,7 @@ GOOGLE_ANALYTICS_SETTINGS = {
2
2
  version: "1",
3
3
  tracking_code: "UA-123456-1",
4
4
  domain: "test@domain.com"
5
- }
5
+ }
6
+
7
+ GACollectorPusher::Config.verbose = true
8
+ GACollectorPusher::Config.paranoid = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ga_collector_pusher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Girts Kesteris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-10 00:00:00.000000000 Z
11
+ date: 2016-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -97,6 +97,7 @@ files:
97
97
  - Rakefile
98
98
  - ga_collector_pusher.gemspec
99
99
  - lib/ga_collector_pusher.rb
100
+ - lib/ga_collector_pusher/config.rb
100
101
  - lib/ga_collector_pusher/instance.rb
101
102
  - lib/ga_collector_pusher/version.rb
102
103
  - spec/config.rb