thisdata 0.2.2 → 0.2.3
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/lib/this_data.rb +9 -9
- data/lib/this_data/client.rb +2 -2
- data/lib/this_data/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56d376bdcb3b963ff85f5b8120a92b18444263fa
|
4
|
+
data.tar.gz: 84a70ced5519fd281c4f347d0f3ffbe86580e815
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b96311361b9a8de98e116ffc23308701ca49b8ec3e8f3ffd730df8434e53982a1315f0bf94e4c69b4c4e18b9f7f06c9f5251f650a5e53b62bb39bf4c6926fd9
|
7
|
+
data.tar.gz: f18a61f9f99903cc54d1981d40e70716170b3775e187d0091af943c2ed45fb3d5c03d1f1aeb0580a02833d9a5cc88e0daa86b17e907f8203ac71d0f05528a89e
|
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, options={})
|
53
53
|
if ThisData.configuration.async
|
54
|
-
track_async(event,
|
54
|
+
track_async(event, options)
|
55
55
|
else
|
56
|
-
track_with_response(event,
|
56
|
+
track_with_response(event, options)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -69,11 +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, options={})
|
73
73
|
response = Client.new.post(
|
74
74
|
ThisData::VERIFY_ENDPOINT,
|
75
75
|
body: JSON.generate(params),
|
76
|
-
query:
|
76
|
+
query: options
|
77
77
|
)
|
78
78
|
response.parsed_response
|
79
79
|
end
|
@@ -110,8 +110,8 @@ module ThisData
|
|
110
110
|
# Event must be a Hash.
|
111
111
|
# Rescues and logs all exceptions.
|
112
112
|
# Returns an HTTPResponse
|
113
|
-
def track_with_response(event,
|
114
|
-
response = Client.new.track(event,
|
113
|
+
def track_with_response(event, options={})
|
114
|
+
response = Client.new.track(event, options)
|
115
115
|
success = response && response.success? # HTTParty doesn't like `.try`
|
116
116
|
if success
|
117
117
|
log("Tracked event! #{response.response.inspect}")
|
@@ -130,9 +130,9 @@ module ThisData
|
|
130
130
|
|
131
131
|
# Performs the track function within a new Thread, so it is non blocking.
|
132
132
|
# Returns the Thread created
|
133
|
-
def track_async(event,
|
133
|
+
def track_async(event, options={})
|
134
134
|
Thread.new do
|
135
|
-
track_with_response(event,
|
135
|
+
track_with_response(event, options)
|
136
136
|
end
|
137
137
|
rescue => e
|
138
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, query:
|
33
|
+
def track(event, options={})
|
34
|
+
post(ThisData::EVENTS_ENDPOINT, query: options, 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