snowplow-tracker 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/snowplow-tracker/emitters.rb +12 -3
- data/lib/snowplow-tracker/subject.rb +33 -0
- data/lib/snowplow-tracker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDIxM2I3N2NhOTgwZGE3NTE2Y2I1NTk0YTUxZjY1YjAxNGM2NTU3Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2Q4MTdlNmI2NzAyOWY1MTI4NTNjOGQ1MjA1OTMwNzFkZDVhMjE2ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWRlZDVmZmU1ODBiZTUxZWJiM2YyMGE0MDBjMTRmNDlhODIyNzU5OGYzZmJm
|
10
|
+
YWYxNWVjNWM5NTg4NjlhNzk2YzNlOGE0OWQ3ZTM0NjI4Njc2M2FmZjU1ZDJh
|
11
|
+
ZGMwM2JlMjNhZGVmMzliYmUwNDc5YzY2OWIzZWNmNGE0ZDQ5MWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2FlNGNmMWEzMzYyYTkzZGFlNGE5MGRmYmFhZmVlM2VlZDM0NzI2M2M5Yzdk
|
14
|
+
OWEwYTk1OGIxYWE4ODZkNWZhNjIwNTBlYjA4ZGE3ZDAzZGFiNzdiZGRiNzNl
|
15
|
+
YWU1NGM3Yzg3MmZjYmQwMzljNWM0NmM0YWJlZDQ3NjZkZjI0ZTE=
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# Copyright:: Copyright (c) 2013-2014 Snowplow Analytics Ltd
|
14
14
|
# License:: Apache License Version 2.0
|
15
15
|
|
16
|
-
require 'net/
|
16
|
+
require 'net/https'
|
17
17
|
require 'set'
|
18
18
|
require 'logger'
|
19
19
|
require 'contracts'
|
@@ -129,7 +129,7 @@ module SnowplowTracker
|
|
129
129
|
elsif @method == 'post'
|
130
130
|
if temp_buffer.size > 0
|
131
131
|
request = http_post({
|
132
|
-
'schema' => 'iglu:com.snowplowanalytics.snowplow/payload_data/1-0-
|
132
|
+
'schema' => 'iglu:com.snowplowanalytics.snowplow/payload_data/1-0-1',
|
133
133
|
'data' => temp_buffer
|
134
134
|
})
|
135
135
|
|
@@ -156,7 +156,12 @@ module SnowplowTracker
|
|
156
156
|
destination = URI(@collector_uri + '?' + URI.encode_www_form(payload))
|
157
157
|
LOGGER.info("Sending GET request to #{@collector_uri}...")
|
158
158
|
LOGGER.debug("Payload: #{payload}")
|
159
|
-
|
159
|
+
http = Net::HTTP.new(destination.host, destination.port)
|
160
|
+
request = Net::HTTP::Get.new(destination.request_uri)
|
161
|
+
if destination.scheme == 'https'
|
162
|
+
http.use_ssl = true
|
163
|
+
end
|
164
|
+
response = http.request(request)
|
160
165
|
LOGGER.add(response.code == '200' ? Logger::INFO : Logger::WARN) {
|
161
166
|
"GET request to #{@collector_uri} finished with status code #{response.code}"
|
162
167
|
}
|
@@ -173,6 +178,10 @@ module SnowplowTracker
|
|
173
178
|
destination = URI(@collector_uri)
|
174
179
|
http = Net::HTTP.new(destination.host, destination.port)
|
175
180
|
request = Net::HTTP::Post.new(destination)
|
181
|
+
request = Net::HTTP::Post.new(destination.request_uri)
|
182
|
+
if destination.scheme == 'https'
|
183
|
+
http.use_ssl = true
|
184
|
+
end
|
176
185
|
request.form_data = payload
|
177
186
|
request.set_content_type('application/json; charset=utf-8')
|
178
187
|
response = http.request(request)
|
@@ -92,6 +92,39 @@ module SnowplowTracker
|
|
92
92
|
self
|
93
93
|
end
|
94
94
|
|
95
|
+
# Set the domain user ID
|
96
|
+
#
|
97
|
+
Contract String => Subject
|
98
|
+
def set_domain_user_id(duid)
|
99
|
+
@standard_nv_pairs['duid'] = duid
|
100
|
+
self
|
101
|
+
end
|
102
|
+
|
103
|
+
# Set the IP address field
|
104
|
+
#
|
105
|
+
Contract String => Subject
|
106
|
+
def set_ip_address(ip)
|
107
|
+
@standard_nv_pairs['ip'] = ip
|
108
|
+
self
|
109
|
+
end
|
110
|
+
|
111
|
+
# Set the user agent
|
112
|
+
#
|
113
|
+
Contract String => Subject
|
114
|
+
def set_useragent(ua)
|
115
|
+
@standard_nv_pairs['ua'] = ua
|
116
|
+
self
|
117
|
+
end
|
118
|
+
|
119
|
+
# Set the network user ID field
|
120
|
+
# This overwrites the nuid field set by the collector
|
121
|
+
#
|
122
|
+
Contract String => Subject
|
123
|
+
def set_network_user_id(nuid)
|
124
|
+
@standard_nv_pairs['tnuid'] = nuid
|
125
|
+
self
|
126
|
+
end
|
127
|
+
|
95
128
|
end
|
96
129
|
|
97
130
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snowplow-tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Dean
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: contracts
|