thisdata 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/this_data.rb +10 -9
- data/lib/this_data/client.rb +2 -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: d774e01e39a759a187a0a6978ab3d5e9e07b7d77
|
4
|
+
data.tar.gz: b341f0c6c4746df21ae5f1cd82e98c2a02160239
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 646823cf8b5a1a51b06e0b61ad796c1a06096dfd7dc7558fcd47dbc55ff495c322df6eecff7f1117d65814a5fe2a9313ede58751f95bc032a68377dfe02a41ea
|
7
|
+
data.tar.gz: c4b4d3696498067e835262cd36a00bf553a936bca2e6b767d2c5f284b9696fa9c5750366ea395425efe8a4d3180dba726ab91ecba54312acafb19eaa323b5619
|
data/lib/this_data.rb
CHANGED
@@ -49,11 +49,11 @@ module ThisData
|
|
49
49
|
# - event (Required: Hash) a Hash containing details about the event.
|
50
50
|
# See http://help.thisdata.com/v1.0/docs/apiv1events for a
|
51
51
|
# full & current list of available options.
|
52
|
-
def track(event)
|
52
|
+
def track(event, query: {})
|
53
53
|
if ThisData.configuration.async
|
54
|
-
track_async(event)
|
54
|
+
track_async(event, query: query)
|
55
55
|
else
|
56
|
-
track_with_response(event)
|
56
|
+
track_with_response(event, query: query)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -69,10 +69,11 @@ module ThisData
|
|
69
69
|
# full & current list of available options.
|
70
70
|
#
|
71
71
|
# Returns a Hash
|
72
|
-
def verify(params)
|
72
|
+
def verify(params, query: {})
|
73
73
|
response = Client.new.post(
|
74
74
|
ThisData::VERIFY_ENDPOINT,
|
75
|
-
body: JSON.generate(params)
|
75
|
+
body: JSON.generate(params),
|
76
|
+
query: query
|
76
77
|
)
|
77
78
|
response.parsed_response
|
78
79
|
end
|
@@ -109,8 +110,8 @@ module ThisData
|
|
109
110
|
# Event must be a Hash.
|
110
111
|
# Rescues and logs all exceptions.
|
111
112
|
# Returns an HTTPResponse
|
112
|
-
def track_with_response(event)
|
113
|
-
response = Client.new.track(event)
|
113
|
+
def track_with_response(event, query: {})
|
114
|
+
response = Client.new.track(event, query: query)
|
114
115
|
success = response && response.success? # HTTParty doesn't like `.try`
|
115
116
|
if success
|
116
117
|
log("Tracked event! #{response.response.inspect}")
|
@@ -129,9 +130,9 @@ module ThisData
|
|
129
130
|
|
130
131
|
# Performs the track function within a new Thread, so it is non blocking.
|
131
132
|
# Returns the Thread created
|
132
|
-
def track_async(event)
|
133
|
+
def track_async(event, query: {})
|
133
134
|
Thread.new do
|
134
|
-
track_with_response(event)
|
135
|
+
track_with_response(event, query: query)
|
135
136
|
end
|
136
137
|
rescue => e
|
137
138
|
ThisData.error("Cannot create Thread: #{e.inspect}")
|
data/lib/this_data/client.rb
CHANGED
@@ -30,8 +30,8 @@ module ThisData
|
|
30
30
|
# - event (Required: Hash) a Hash containing details about the event.
|
31
31
|
# See http://help.thisdata.com/v1.0/docs/apiv1events for a
|
32
32
|
# full & current list of available options.
|
33
|
-
def track(event)
|
34
|
-
post(ThisData::EVENTS_ENDPOINT, body: JSON.generate(event))
|
33
|
+
def track(event, query: {})
|
34
|
+
post(ThisData::EVENTS_ENDPOINT, query: query, body: JSON.generate(event))
|
35
35
|
end
|
36
36
|
|
37
37
|
# Perform a GET request against the ThisData API, with the API key
|
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.2.
|
4
|
+
version: 0.2.2
|
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: 2017-
|
12
|
+
date: 2017-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|