sms-logparser 0.10.2 → 0.10.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/sms-logparser/parser.rb +9 -13
- data/lib/sms-logparser/version.rb +1 -1
- data/spec/parser_spec.rb +8 -0
- 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: ac70f98c406ad07e45f6da1db8370f9951f79c3a
|
|
4
|
+
data.tar.gz: 8460bd5b56670c07c94923959d39cd1c1ca82f97
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5cac1b91c12c7ab723fc0b4df8ac6cca670aadb3d22e50b527b9eecf7c62bc4f3fe7d0e241d8765b59169176dfc0bec86386c6d4cdb1c476730e9f46661ce7aa
|
|
7
|
+
data.tar.gz: 270c6f2c3779d2a8274f68de91271d0112f6ada9b0ef0cd9548d0c18d1fd3ccbd8ab2cf3b7d210ae8335ae4985609ebcce961903c9bca89c62468d7f1604b3e6
|
data/lib/sms-logparser/parser.rb
CHANGED
|
@@ -42,27 +42,23 @@ module SmsLogparser
|
|
|
42
42
|
def self.get_traffic_type(user_agent)
|
|
43
43
|
case user_agent
|
|
44
44
|
when /.*(iTunes).*/
|
|
45
|
-
|
|
45
|
+
'TRAFFIC_PODCAST'
|
|
46
46
|
when /.*(Mobi|IEMobile|Mobile Safari|iPhone|iPod|iPad|Android|BlackBerry|Opera Mini).*/
|
|
47
|
-
|
|
47
|
+
'TRAFFIC_MOBILE'
|
|
48
48
|
else
|
|
49
|
-
|
|
49
|
+
'TRAFFIC_WEBCAST'
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def self.get_visitor_type(traffic_type, file)
|
|
54
|
-
return
|
|
54
|
+
return 'VISITORS_MOBILE' if File.extname(file) == '.m3u8'
|
|
55
55
|
case traffic_type
|
|
56
|
-
when
|
|
57
|
-
|
|
58
|
-
when
|
|
59
|
-
|
|
60
|
-
"VISITORS_MOBILE"
|
|
61
|
-
else
|
|
62
|
-
nil
|
|
63
|
-
end
|
|
56
|
+
when 'TRAFFIC_PODCAST'
|
|
57
|
+
'VISITORS_PODCAST'
|
|
58
|
+
when 'TRAFFIC_MOBILE'
|
|
59
|
+
File.extname(file) != '.ts' ? 'VISITORS_MOBILE' : nil
|
|
64
60
|
else
|
|
65
|
-
|
|
61
|
+
'VISITORS_WEBCAST'
|
|
66
62
|
end
|
|
67
63
|
end
|
|
68
64
|
|
data/spec/parser_spec.rb
CHANGED
|
@@ -63,6 +63,14 @@ describe SmsLogparser::Parser do
|
|
|
63
63
|
end
|
|
64
64
|
end
|
|
65
65
|
|
|
66
|
+
[
|
|
67
|
+
'127.0.0.1 - - [13/Apr/2014:05:33:23 +0200] "GET /content/51/52/42481/simvid_1.mp4 HTTP/1.1" 206 7865189 "-" "iTunes/11.1.5 (Windows; Microsoft Windows 7 Home Premium Edition Service Pack 1 (Build 7601)) AppleWebKit/537.60.11"'
|
|
68
|
+
].each do |podcast_agent|
|
|
69
|
+
it "traffic type for mobile user agents is TRAFFIC_PODCAST (#{podcast_agent})" do
|
|
70
|
+
SmsLogparser::Parser.get_traffic_type(podcast_agent).must_equal "TRAFFIC_PODCAST"
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
66
74
|
it "should set visitor_type to VISITORS_MOBILE for index.m3u8 files" do
|
|
67
75
|
SmsLogparser::Parser.get_visitor_type(
|
|
68
76
|
"TRAFFIC_PODCAST", "index.m3u8"
|