thisdata 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -0
- data/README.md +23 -9
- data/lib/generators/this_data/install_generator.rb +1 -0
- data/lib/this_data.rb +2 -1
- data/lib/this_data/verbs.rb +22 -0
- 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: 733fd722c94d64605f71c6c1dde7651ee3637ef0
|
4
|
+
data.tar.gz: c35dfe168584f381f8d7b4ec785be3d30000a22f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed4916c46d949108998764e9dec362e558fefa757bf49944512ad4ea2d6831158a7f858a34fc33ae2d2a1af05cd4ea53deacc03383243925317462e7c9260842
|
7
|
+
data.tar.gz: 003187257e62124d7ab56c6f0c5b4a11f45c6721254413b21d0d55e3764e62938c1853aa9acc83cc591e5bce0a0689cc15c454ee39f8fc1578a7befe6725eb6c
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 0.1.4
|
2
|
+
|
3
|
+
- ThisData wasn't being required properly: https://github.com/thisdata/thisdata-ruby/issues/8
|
4
|
+
- The response / failure of a request to our API wasn't being correctly logged
|
5
|
+
https://github.com/thisdata/thisdata-ruby/issues/9
|
6
|
+
- There are some new verbs with special semantic meaning which we've added
|
7
|
+
https://github.com/thisdata/thisdata-ruby/issues/12
|
8
|
+
- Tweaks to the ruby sample code, by @timhaines
|
9
|
+
https://github.com/thisdata/thisdata-ruby/pull/7
|
10
|
+
|
1
11
|
# 0.1.3
|
2
12
|
|
3
13
|
In the `ThisData::TrackRequest` module, make tracking a bit easier especially
|
data/README.md
CHANGED
@@ -27,22 +27,23 @@ http://help.thisdata.com
|
|
27
27
|
|
28
28
|
#### Configuration
|
29
29
|
|
30
|
-
|
30
|
+
An example ThisData configuration is below. See `this_data/configuration.rb` for
|
31
|
+
more options. For example, in production we recommend you turn on
|
32
|
+
the asynchronous and non-logging behaviour.
|
33
|
+
|
34
|
+
If you're using Rails, you can generate this config file by following our
|
35
|
+
[Set Up](#set-up) steps further down.
|
36
|
+
|
31
37
|
|
32
38
|
```ruby
|
39
|
+
require 'this_data'
|
33
40
|
ThisData.setup do |config|
|
34
|
-
config.api_key =
|
41
|
+
config.api_key = 'API_KEY_HERE' # Don't commit your key to source control!
|
35
42
|
config.logger = Logger.new($stdout)
|
36
43
|
config.async = false
|
37
44
|
end
|
38
45
|
```
|
39
46
|
|
40
|
-
See `this_data/configuration.rb` for more options, and some suggested
|
41
|
-
Ruby on Rails options in `this_data/generators/install_generator.rb`.
|
42
|
-
|
43
|
-
For example, in production you will probably want asynchronous and non-logging
|
44
|
-
behaviour.
|
45
|
-
|
46
47
|
#### Tracking an Event
|
47
48
|
|
48
49
|
You can then track any event by calling `ThisData.track` and passing a Hash which
|
@@ -58,7 +59,7 @@ ThisData.track(
|
|
58
59
|
user: {
|
59
60
|
id: user.id.to_s,
|
60
61
|
name: user.name,
|
61
|
-
email: user.email
|
62
|
+
email: user.email,
|
62
63
|
mobile: user.mobile
|
63
64
|
}
|
64
65
|
}
|
@@ -128,6 +129,19 @@ Note: as with many sensitive operations, taking different actions when an
|
|
128
129
|
account exists vs. when an account doesn't exist can lead to a information
|
129
130
|
disclosure through timing attacks.
|
130
131
|
|
132
|
+
### Will this break my app?
|
133
|
+
|
134
|
+
We hope not! We encourage you to use the asynchronous API call where possible
|
135
|
+
just in case our end goes down. In all cases we have error handling to capture
|
136
|
+
hard failures, but there may be edge-cases where timeouts or other bugs haven't
|
137
|
+
been properly handled.
|
138
|
+
|
139
|
+
So in your own app you could move tracking to a background job, enforce timeouts,
|
140
|
+
add threading (safely!), or employ other methods which enforce good behaviour of
|
141
|
+
third party gems.
|
142
|
+
|
143
|
+
Read more: http://help.thisdata.com/docs/how-do-you-not-break-my-app
|
144
|
+
|
131
145
|
|
132
146
|
### Stuck?
|
133
147
|
|
data/lib/this_data.rb
CHANGED
@@ -74,7 +74,8 @@ module ThisData
|
|
74
74
|
# Returns an HTTPResponse
|
75
75
|
def track_with_response(event)
|
76
76
|
response = Client.new.track(event)
|
77
|
-
|
77
|
+
success = response && response.success? # HTTParty doesn't like `.try`
|
78
|
+
if success
|
78
79
|
log("Tracked event! #{response.response.inspect}")
|
79
80
|
else
|
80
81
|
warn("Track failure! #{response.response.inspect} #{response.body}")
|
data/lib/this_data/verbs.rb
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# We use verbs to distinguish between different types of events.
|
2
|
+
# The following is a a list of verbs which hold special semantic meaning to us.
|
3
|
+
# In addition to these you can send any verb you like.
|
4
|
+
#
|
5
|
+
# Learn more about these verbs, and others, here:
|
6
|
+
# http://help.thisdata.com/docs/verbs
|
7
|
+
#
|
1
8
|
module ThisData
|
2
9
|
class Verbs
|
3
10
|
|
@@ -6,5 +13,20 @@ module ThisData
|
|
6
13
|
LOG_IN_DENIED = 'log-in-denied'
|
7
14
|
LOG_IN_CHALLENGE = 'log-in-challenge'
|
8
15
|
|
16
|
+
ACCESS = 'access'
|
17
|
+
|
18
|
+
EMAIL_UPDATE = 'email-update'
|
19
|
+
PASSWORD_UPDATE = 'password-update'
|
20
|
+
|
21
|
+
PASSWORD_RESET_REQUEST = 'password-reset-request'
|
22
|
+
PASSWORD_RESET = 'password-reset'
|
23
|
+
PASSWORD_RESET_FAIL = 'password-reset-fail'
|
24
|
+
|
25
|
+
AUTHENTICATION_CHALLENGE = 'authentication-challenge'
|
26
|
+
AUTHENTICATION_CHALLENGE_PASS = 'authentication-challenge-pass'
|
27
|
+
AUTHENTICATION_CHALLENGE_FAIL = 'authentication-challenge-fail'
|
28
|
+
|
29
|
+
TWO_FACTOR_DISABLE = 'two-factor-disable'
|
30
|
+
|
9
31
|
end
|
10
32
|
end
|
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.4
|
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-02
|
12
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|