ga_events 1.4.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d58cdb3aafef92d454bb79021d01ed65773e710d
4
- data.tar.gz: 2b46d6a7bcb1906f68a95f100521c65644cfedc6
2
+ SHA256:
3
+ metadata.gz: 8733925b29ae71da3da081d25679727857f92ee7bcb5390c72b97a87fc3c9b53
4
+ data.tar.gz: 67d86fd9ea6ced7564d851b40faa957d2138a92977a5d3197a2a6f7bdcdd7068
5
5
  SHA512:
6
- metadata.gz: 8139269a9fa960a91f3fda4dd8bebc113fba30eaf84ecff627408aa446333e40e5d56a5eb792f71a588189c82d42d9c0d33c8a5524814530c407f4c87a11e123
7
- data.tar.gz: 664f45cd5043f86e61608fd434e530dd71e4b0fdd4b14beff7a6f9adb3a6faffabc46c20048bb9b3466b0383b5726b360d5d126ef182754564f84495e6e4ec14
6
+ metadata.gz: 0ffaa24b43857c82f369e98861b82ddd99dca42bc88b97148d4a055210e0ed76b2f82961932e83e03b76264e091a7e698577b07a69cb2efef6d40b92616965c0
7
+ data.tar.gz: 59e2857a160797e12bfec180e10aadae8f66633e303cb9c41e739a77669ee03f2b13c22faea9f10df263e1d43f2eef172f6c5d03cbca90b7a9944597c8390a77
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg
5
+ vendor
@@ -1,13 +1,8 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.2
2
+ TargetRubyVersion: 2.3
3
3
  Exclude:
4
4
  - 'vendor/bundle/**/*'
5
5
  DisplayCopNames: true
6
- Rails:
7
- Enabled: true
8
- Style/Encoding:
9
- EnforcedStyle: when_needed
10
- Enabled: true
11
6
  Style/AsciiComments:
12
7
  Enabled: false
13
8
  Style/Documentation:
@@ -16,13 +11,13 @@ Metrics/MethodLength:
16
11
  Enabled: false
17
12
  Style/MethodDefParentheses:
18
13
  Enabled: false
19
- Style/MultilineOperationIndentation:
14
+ Layout/MultilineOperationIndentation:
20
15
  EnforcedStyle: aligned
21
- Style/MultilineMethodCallIndentation:
16
+ Layout/MultilineMethodCallIndentation:
22
17
  EnforcedStyle: indented
23
- Style/MultilineMethodDefinitionBraceLayout:
18
+ Layout/MultilineMethodDefinitionBraceLayout:
24
19
  Enabled: true
25
- Style/MultilineHashBraceLayout:
20
+ Layout/MultilineHashBraceLayout:
26
21
  Enabled: true
27
22
  Style/SignalException:
28
23
  Enabled: false
@@ -38,3 +33,5 @@ Style/CommentAnnotation:
38
33
  Enabled: false
39
34
  Style/GuardClause:
40
35
  Enabled: false
36
+ Metrics/BlockLength:
37
+ Enabled: false
@@ -39,3 +39,12 @@ The format suggested at http://keepachangelog.com/ is used.
39
39
  ### Fixed
40
40
  - Ensure category, action and label do not include any umlauts or ß chars
41
41
  - Fixed an error where events are remaining after a redirect
42
+
43
+ ## 2.0.0 - 2018-04-03
44
+
45
+ ### Removed
46
+ - Support for rubies < 2.3
47
+ - Support for rails < 4.2
48
+
49
+ ### Added
50
+ - Compatibility for Rails 5
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in ga_events.gemspec
@@ -6,4 +8,4 @@ gemspec
6
8
  gem 'pry'
7
9
  gem 'rake'
8
10
  gem 'rspec', '~> 3.1.0'
9
- gem 'rubocop', '~> 0.39.0', require: false
11
+ gem 'rubocop', '~> 0.79.0', require: false
data/README.md CHANGED
@@ -13,8 +13,8 @@ pushes it to Google Analytics via ga.js or Google Tag Manager.
13
13
 
14
14
  ## Dependencies
15
15
 
16
- * Ruby >= 1.9
17
- * Rails 3.1 onwards
16
+ * Ruby >= 2.3
17
+ * Rails 4.2 onwards
18
18
  * jQuery
19
19
 
20
20
  ## Installation
data/Rakefile CHANGED
@@ -1,7 +1,5 @@
1
- #!/usr/bin/env rake
2
- require 'bundler/gem_tasks'
3
- require 'rspec/core/rake_task'
1
+ # frozen_string_literal: true
4
2
 
5
- RSpec::Core::RakeTask.new('spec')
3
+ require 'bundler/gem_tasks'
6
4
 
7
5
  task default: :spec
@@ -1,5 +1,6 @@
1
- # encoding: utf-8
2
- require File.expand_path('../lib/ga_events/version', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('lib/ga_events/version', __dir__)
3
4
 
4
5
  Gem::Specification.new do |gem|
5
6
  gem.authors = ['Florian Dütsch', 'Sven Winkler']
@@ -25,5 +26,5 @@ Gem::Specification.new do |gem|
25
26
  gem.require_paths = ['lib']
26
27
  gem.version = GaEvents::VERSION
27
28
 
28
- gem.add_dependency 'rails', '>= 3.1'
29
+ gem.add_dependency 'rails', '>= 4.2'
29
30
  end
@@ -1 +1,3 @@
1
- %w(middleware engine event list version).each { |f| require "ga_events/#{f}" }
1
+ # frozen_string_literal: true
2
+
3
+ %w[middleware engine event list version].each { |f| require "ga_events/#{f}" }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GaEvents
2
4
  class Engine < ::Rails::Engine
3
5
  config.app_middleware.use GaEvents::Middleware
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GaEvents
2
4
  Event = Struct.new(:category, :action, :label, :value) do
3
5
  # Default values are set here, see README.md for details.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # NOTE: Collecting the events is thread-safe, but will cause problems in an
2
4
  # asynchronous/evented environment.
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rack/utils'
2
4
 
3
5
  module GaEvents
@@ -35,33 +37,29 @@ module GaEvents
35
37
  private
36
38
 
37
39
  def init_event_list(env)
38
- # Handle events stored in flash
39
- # Parts borrowed from Rails:
40
- # https://github.com/rails/rails/blob/v3.2.14/actionpack/lib/action_dispatch/middleware/flash.rb
41
- flash = env['rack.session'] && env['rack.session']['flash']
42
-
43
- # Fix for Rails 4
44
- flash &&= flash['flashes'] if Rails::VERSION::MAJOR > 3
40
+ flash = env['rack.session'] && env['rack.session']['flash'] &&
41
+ env['rack.session']['flash']['flashes']
45
42
 
46
43
  # The key has to be removed from the flash here to ensure it does not
47
44
  # remain after the finished redirect. This copies the behaviour of the
48
45
  # "#use" and "#sweep" methods of the rails flash middleware:
49
46
  # https://github.com/rails/rails/blob/v3.2.14/actionpack/lib/action_dispatch/middleware/flash.rb#L220
50
- GaEvents::List.init(flash && flash.delete('ga_events'))
47
+ GaEvents::List.init(flash&.delete('ga_events'))
51
48
  end
52
49
 
53
50
  def add_events_to_flash env, serialized_data
54
- flash_hash = env[ActionDispatch::Flash::KEY]
55
- flash_hash ||= ActionDispatch::Flash::FlashHash.new
56
- flash_hash['ga_events'] = serialized_data
51
+ flash = env['rack.session'] && env['rack.session']['flash'] &&
52
+ env['rack.session']['flash']['flashes']
53
+
54
+ return unless flash
57
55
 
58
- env[ActionDispatch::Flash::KEY] = flash_hash
56
+ flash['ga_events'] = serialized_data
59
57
  end
60
58
 
61
- def normalize_response(r)
62
- r = r.body if r.respond_to?(:body)
63
- r = r.join if r.respond_to?(:join)
64
- r
59
+ def normalize_response(response)
60
+ response = response.body if response.respond_to?(:body)
61
+ response = response.join if response.respond_to?(:join)
62
+ response
65
63
  end
66
64
 
67
65
  def inject_div(response, serialized_data)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module GaEvents
2
- VERSION = '1.4.1'.freeze
4
+ VERSION = '2.0.0'
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe GaEvents::Middleware do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/setup'
2
4
  require 'pry'
3
5
  require 'rspec'
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ga_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Dütsch
8
8
  - Sven Winkler
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-09 00:00:00.000000000 Z
12
+ date: 2020-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '3.1'
20
+ version: '4.2'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '3.1'
27
+ version: '4.2'
28
28
  description: Google Analytics' Event Tracking everywhere in your Rails app)
29
29
  email:
30
30
  - florian.duetsch@nix-wie-weg.de
@@ -54,7 +54,7 @@ files:
54
54
  homepage: https://github.com/Nix-wie-weg/ga_events
55
55
  licenses: []
56
56
  metadata: {}
57
- post_install_message:
57
+ post_install_message:
58
58
  rdoc_options: []
59
59
  require_paths:
60
60
  - lib
@@ -69,9 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  requirements: []
72
- rubyforge_project:
73
- rubygems_version: 2.5.2
74
- signing_key:
72
+ rubygems_version: 3.0.3
73
+ signing_key:
75
74
  specification_version: 4
76
75
  summary: This gem allows you to annotate events everywhere in the code of your Rails
77
76
  app. A rack middleware is automatically inserted into the stack. It transports the