thisdata 0.1.5 → 0.1.6
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 +4 -4
- data/CHANGELOG +5 -0
- data/README.md +2 -1
- data/lib/this_data/track_request.rb +16 -2
- data/lib/this_data/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a460e8478eb4bca5802e86c76eba3017d42c5bfa
|
4
|
+
data.tar.gz: 58af31a7fab25be9d628aa612641da581ca03009
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48adde7517313dcb521fbdd3c36386a5391a1b75366261b679c709c8ad5d8df62d4a3607f8908469ce910f4f317f307469b123c72257f591e7424333448b1198
|
7
|
+
data.tar.gz: 3bf8a38732da9679277ddb7770fe2ec17064985e8f37ce50d51d15a2e7d7e277dd28fa17118ca62c1f86fa6f95aee3a3d0b2a2961b9034c5ada1c281ba898f33
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -117,7 +117,8 @@ class SessionsController < ApplicationController
|
|
117
117
|
if attempted_user = User.find_by(email: params[:email])
|
118
118
|
thisdata_track(
|
119
119
|
verb: ThisData::Verbs::LOG_IN_DENIED,
|
120
|
-
user: attempted_user
|
120
|
+
user: attempted_user,
|
121
|
+
authenticated: false
|
121
122
|
)
|
122
123
|
else
|
123
124
|
# email and password were both incorrect
|
@@ -20,19 +20,33 @@ module ThisData
|
|
20
20
|
# `current_user`.
|
21
21
|
# The object must respond to at least
|
22
22
|
# `ThisData.configuration.user_id_method`, which defaults to `id`.
|
23
|
+
# authenticated: (Boolean, Optional, default nil). Used to indicate
|
24
|
+
# whether a user is authenticated or not. By default we assume that if
|
25
|
+
# there is a user specified then they are authenticated, but in some
|
26
|
+
# cases (like a log-in-denied event) you might want to track the user
|
27
|
+
# but tell us that they are not authenticated.
|
28
|
+
# In these situations you should set `authenticated` to false.
|
23
29
|
#
|
24
30
|
# Returns the result of ThisData.track (an HTTPartyResponse)
|
25
|
-
def thisdata_track(verb: ThisData::Verbs::LOG_IN, user: nil)
|
31
|
+
def thisdata_track(verb: ThisData::Verbs::LOG_IN, user: nil, authenticated: nil)
|
32
|
+
# Fetch the user unless it's been overridden
|
26
33
|
if user.nil?
|
27
34
|
user = send(ThisData.configuration.user_method)
|
28
35
|
end
|
29
36
|
|
37
|
+
# Get a Hash of details for the user
|
38
|
+
user_details = user_details(user)
|
39
|
+
|
40
|
+
# If specified, set the authenticated state of the user
|
41
|
+
unless authenticated.nil?
|
42
|
+
user_details.merge!(authenticated: authenticated)
|
43
|
+
end
|
30
44
|
|
31
45
|
event = {
|
32
46
|
verb: verb,
|
33
47
|
ip: request.remote_ip,
|
34
48
|
user_agent: request.user_agent,
|
35
|
-
user: user_details
|
49
|
+
user: user_details,
|
36
50
|
session: {
|
37
51
|
td_cookie_expected: ThisData.configuration.expect_js_cookie,
|
38
52
|
td_cookie_id: td_cookie_value,
|
data/lib/this_data/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thisdata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ThisData Ltd
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|