timber 2.0.1 → 2.0.2

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: 59dfc96fa6eee2260cbfb09b2fb6eddfcae573e6
4
- data.tar.gz: dce374823788ebcfeb4f036e2c01a09170354d2e
3
+ metadata.gz: 764a9a04b4bb8dcb4a6bd93e531ba1eea9959f8d
4
+ data.tar.gz: 6dbf3db66270006e11d274c0a966456bb57e9419
5
5
  SHA512:
6
- metadata.gz: 0cff008838b0289281df7f30904d65cf435a91c46f50050a23261cbba66c6a61db8632e649f77e3cbcb04fdda09b741b1cc02fc02aba0d0b239eb7105d298881
7
- data.tar.gz: 4fbe781f747db8043c783e8732157f2d285e84f4ba14c0010b5944e082dbec86defdeacb9a5c66be5352122dd8652348aee09e26d33513256608569b927bf498
6
+ metadata.gz: b9b093be5167377e5b6566441c7e5e91f98f2eaa06bd18d25906ffd11fba35b9338dadb7aa99e85b05c8d64ddd659686d29d58d7aa8f8f8865d058d9c15688e2
7
+ data.tar.gz: fc8ebd26419c4b8b248c8af55007b6579e428c96249cfc673ee4439de9480cde0f883d66880110cb1d5cb15b4ba84254e823bfd6da084fa716f330908dbd4507
@@ -8,13 +8,9 @@ module Timber
8
8
  end
9
9
 
10
10
  def call(env)
11
- user = get_user(env)
12
- if user
13
- context = Contexts::User.new(
14
- id: user_id(user),
15
- name: user_name(user),
16
- email: user_email(user)
17
- )
11
+ user_hash = get_user_hash(env)
12
+ if user_hash
13
+ context = Contexts::User.new(user_hash)
18
14
  CurrentContext.with(context) do
19
15
  @app.call(env)
20
16
  end
@@ -24,14 +20,31 @@ module Timber
24
20
  end
25
21
 
26
22
  private
27
- def get_user(env)
23
+ def get_user_hash(env)
28
24
  if env['warden']
29
- env['warden'].user
25
+ get_user_hash_from_object(env['warden'].user)
26
+ elsif env['omniauth.auth']
27
+ auth_hash = env['omniauth.auth']
28
+ info = auth_hash['info']
29
+
30
+ {
31
+ id: auth_hash['uid'],
32
+ name: info['name'],
33
+ email: info['email']
34
+ }
30
35
  else
31
36
  nil
32
37
  end
33
38
  end
34
39
 
40
+ def get_user_hash_from_object(user)
41
+ {
42
+ id: user_id(user),
43
+ name: user_name(user),
44
+ email: user_email(user)
45
+ }
46
+ end
47
+
35
48
  def user_id(user)
36
49
  user.respond_to?(:id) ? user.id : nil
37
50
  end
@@ -1,3 +1,3 @@
1
1
  module Timber
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
data/timber.gemspec CHANGED
@@ -20,16 +20,16 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_dependency('msgpack', '~> 1.0')
22
22
 
23
- s.add_development_dependency('rails_stdout_logging')
24
- s.add_development_dependency('rake')
23
+ s.add_development_dependency('rails_stdout_logging', '~> 0')
24
+ s.add_development_dependency('rake', '~> 0')
25
25
  s.add_development_dependency('rspec', '~> 3.4')
26
- s.add_development_dependency('rspec-its')
27
- s.add_development_dependency('timecop')
26
+ s.add_development_dependency('rspec-its', '~> 0')
27
+ s.add_development_dependency('timecop', '~> 0')
28
28
 
29
29
  if RUBY_PLATFORM == "java"
30
- s.add_development_dependency('activerecord-jdbcsqlite3-adapter')
30
+ s.add_development_dependency('activerecord-jdbcsqlite3-adapter', '~> 0')
31
31
  else
32
- s.add_development_dependency('sqlite3')
32
+ s.add_development_dependency('sqlite3', '~> 0')
33
33
  end
34
34
 
35
35
  if RUBY_VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timber Technologies, Inc.
@@ -28,28 +28,28 @@ dependencies:
28
28
  name: rails_stdout_logging
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
@@ -70,42 +70,42 @@ dependencies:
70
70
  name: rspec-its
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: timecop
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sqlite3
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency