sms-logparser 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc8a425498b303382b4302dd6ec294d543a31a14
4
- data.tar.gz: ac79460ac92c400cb38712fcd1e98e66d277c946
3
+ metadata.gz: ac70f98c406ad07e45f6da1db8370f9951f79c3a
4
+ data.tar.gz: 8460bd5b56670c07c94923959d39cd1c1ca82f97
5
5
  SHA512:
6
- metadata.gz: 1d7bd167f84981dd127e89baa9aa5591707cb4148e6de407ba684932ddc304975bfa96230fa5b72b8353ea8df6e5d79b3e878959d65a832f3f602a626ecd8f2e
7
- data.tar.gz: 06a279954747f3091c2c856cd982f199b17df74d2ff01189a99bc4dcf26b6a6ea1a0a6e50a6836eabb68e9f4c75f56059451d6bb70790c7a87ee22501d595ffc
6
+ metadata.gz: 5cac1b91c12c7ab723fc0b4df8ac6cca670aadb3d22e50b527b9eecf7c62bc4f3fe7d0e241d8765b59169176dfc0bec86386c6d4cdb1c476730e9f46661ce7aa
7
+ data.tar.gz: 270c6f2c3779d2a8274f68de91271d0112f6ada9b0ef0cd9548d0c18d1fd3ccbd8ab2cf3b7d210ae8335ae4985609ebcce961903c9bca89c62468d7f1604b3e6
@@ -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
- "TRAFFIC_PODCAST"
45
+ 'TRAFFIC_PODCAST'
46
46
  when /.*(Mobi|IEMobile|Mobile Safari|iPhone|iPod|iPad|Android|BlackBerry|Opera Mini).*/
47
- "TRAFFIC_MOBILE"
47
+ 'TRAFFIC_MOBILE'
48
48
  else
49
- "TRAFFIC_WEBCAST"
49
+ 'TRAFFIC_WEBCAST'
50
50
  end
51
51
  end
52
52
 
53
53
  def self.get_visitor_type(traffic_type, file)
54
- return "VISITORS_MOBILE" if file == 'index.m3u8'
54
+ return 'VISITORS_MOBILE' if File.extname(file) == '.m3u8'
55
55
  case traffic_type
56
- when "TRAFFIC_PODCAST"
57
- "VISITORS_PODCAST"
58
- when "TRAFFIC_MOBILE"
59
- if File.extname(file) != ".ts"
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
- "VISITORS_WEBCAST"
61
+ 'VISITORS_WEBCAST'
66
62
  end
67
63
  end
68
64
 
@@ -1,3 +1,3 @@
1
1
  module SmsLogparser
2
- VERSION = "0.10.2"
2
+ VERSION = "0.10.3"
3
3
  end
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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sms-logparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - niwo