yeller_ruby 0.0.8 → 0.1.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
2
  SHA1:
3
- metadata.gz: 2fb27b695dfdb1504682392c8130436e0390ef5a
4
- data.tar.gz: 21887a8a02ed2a4bdc28e407e57c52185c2c7015
3
+ metadata.gz: 9be335c24f5bc5cc32739b5dd1e213ab257b0ee8
4
+ data.tar.gz: 6fe8f356c2bd651b6da8a99c68cf8709b38e1f96
5
5
  SHA512:
6
- metadata.gz: 8818a911cff332badf57e1e235eb22d106ce82444a125f206f4ee03af440afc547fbc6c8768ec7aa5dd6c1400b07fe2e2cc6b001b0cdd675e5412e444c998091
7
- data.tar.gz: ee85ebf9b82bfc914f5aa454879e49b78412cdc28ed4ad443538af88b3de6c8df6630e543424b2ae2e8bf9408560e51d3dacfde5cdfa942c2b083d1c2463b825
6
+ metadata.gz: a31b8067de2352ece465297e840212a8975bde91fc3a0c5846b53bc6e5f4be2e09f02cffa8153b00271f7929b8d7177893fd30b39af82f6049910bcb21836679
7
+ data.tar.gz: 0d26f185687705c49af4dba7536cc44c2bbeffe116a9ef9d3092ac0971a8c9d5f576e95c0af09d4fda51ed65335abf46983ad6b8651e922a587c7fb306e90668
@@ -20,6 +20,28 @@ module Yeller
20
20
  Yeller::Rack.client
21
21
  end
22
22
 
23
+ module ControllerMethods
24
+ def _yeller_custom_data
25
+ out = {
26
+ :params => params,
27
+ :session => env.fetch('rack.session', {})
28
+ }
29
+ out.merge!(yeller_user_data || {})
30
+ if respond_to?(:yeller_custom_data)
31
+ out.merge!(yeller_custom_data || {})
32
+ end
33
+ out
34
+ end
35
+
36
+ def yeller_user_data
37
+ return {} unless respond_to?(:current_user)
38
+ return {} unless current_user.respond_to?(:id)
39
+ id = current_user.id
40
+ return {} unless id.is_a?(Integer)
41
+ {"user" => {"id" => id}}
42
+ end
43
+ end
44
+
23
45
  module ActionControllerCatchingHooks
24
46
  def self.included(base)
25
47
  base.send(:alias_method, :render_exception_without_yeller, :render_exception)
@@ -35,10 +57,8 @@ module Yeller
35
57
  exception,
36
58
  :url => request.url,
37
59
  :location => "#{controller.class.to_s}##{params[:action]}",
38
- :custom_data => {
39
- :params => params,
40
- :session => env.fetch('rack.session', {})
41
- })
60
+ :custom_data => controller._yeller_custom_data
61
+ )
42
62
 
43
63
  render_exception_without_yeller(env, exception)
44
64
  end
@@ -55,6 +75,7 @@ module Yeller
55
75
  elsif defined(::ActionDispatch::ShowExceptions)
56
76
  ::ActionDispatch::ShowExceptions.send(:include, Yeller::Rails::ActionControllerCatchingHooks)
57
77
  end
78
+ ActionController::Base.send(:include, Yeller::Rails::ControllerMethods)
58
79
  end
59
80
  end
60
81
  end
@@ -1,3 +1,3 @@
1
1
  module Yeller
2
- VERSION = "0.0.8"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yeller_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Crayford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-25 00:00:00.000000000 Z
11
+ date: 2014-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler