pwnalytics_client 0.1.1 → 0.1.2
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.
- data/README.rdoc +1 -0
- data/VERSION +1 -1
- data/lib/pwnalytics_client/event.rb +3 -0
- data/pwnalytics_client.gemspec +1 -1
- data/spec/lib/pwnalytics_client/client_spec.rb +15 -1
- data/spec/lib/pwnalytics_client/event_spec.rb +4 -0
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -35,6 +35,7 @@ Finally, get the logged events for that site:
|
|
35
35
|
Events have the same data as in the JSON output.
|
36
36
|
|
37
37
|
event.name # "page"
|
38
|
+
event.visitor # "12f49459540.11faa9b963f5c4f0"
|
38
39
|
event.ip # "127.0.0.1"
|
39
40
|
event.browser_ua # "Mozilla/5.0 ..."
|
40
41
|
event.url # <URI::HTTP:0x7f6750505078 URL:http://localhost>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -18,6 +18,7 @@ class Event
|
|
18
18
|
@name = json_data['name']
|
19
19
|
@url = self.class.parse_url json_data['page']
|
20
20
|
@ref = self.class.parse_url json_data['referrer']
|
21
|
+
@visitor = json_data['visitor'] && json_data['visitor']['uid']
|
21
22
|
if json_data['browser'] && json_data['browser']['time']
|
22
23
|
@time = Time.at(json_data['browser']['time'] / 1000.0)
|
23
24
|
else
|
@@ -38,6 +39,8 @@ class Event
|
|
38
39
|
attr_reader :url
|
39
40
|
# Referer URL for the page where the event was triggerred.
|
40
41
|
attr_reader :ref
|
42
|
+
# UID for the visitor that triggered the event.
|
43
|
+
attr_reader :visitor
|
41
44
|
# When the event was triggerred.
|
42
45
|
attr_reader :time
|
43
46
|
# IP of the computer where the event was triggered (e.g., "127.0.0.1").
|
data/pwnalytics_client.gemspec
CHANGED
@@ -93,5 +93,19 @@ describe PwnalyticsClient do
|
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
96
|
-
|
96
|
+
describe 'site' do
|
97
|
+
let(:client) { PwnalyticsClient.new integration_server_data }
|
98
|
+
|
99
|
+
let(:site) do
|
100
|
+
client.should_receive(:request).with('/web_properties/AA123456.json').
|
101
|
+
and_return({'uid' => 'AA123456', 'name' => 'Pwnalytics itself'})
|
102
|
+
client.site 'AA123456'
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'should parse the response correctly' do
|
106
|
+
site.client.should == client
|
107
|
+
site.uid.should == 'AA123456'
|
108
|
+
site.name.should == 'Pwnalytics itself'
|
109
|
+
end
|
110
|
+
end
|
97
111
|
end
|
@@ -33,6 +33,10 @@ describe PwnalyticsClient::Event do
|
|
33
33
|
merge('page' => nil)).url.should == nil
|
34
34
|
end
|
35
35
|
|
36
|
+
it 'should parse out the visitor ID' do
|
37
|
+
event.visitor.should == '12f49459540.11faa9b963f5c4f0'
|
38
|
+
end
|
39
|
+
|
36
40
|
it 'should parse out the time' do
|
37
41
|
event.time.gmtime.to_s.should == "Wed Apr 13 08:10:42 UTC 2011"
|
38
42
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pwnalytics_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Victor Costan
|