skinny_jeans 0.5.1 → 0.5.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/VERSION +1 -1
- data/lib/skinny_jeans_string_parser.rb +12 -1
- data/skinny_jeans.gemspec +2 -2
- data/test/skinny_jeans_string_parser_test.rb +2 -2
- data/test/skinny_jeans_test.rb +1 -1
- metadata +4 -4
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.5.
|
|
1
|
+
0.5.2
|
|
@@ -45,7 +45,10 @@ class SkinnyJeansStringParser
|
|
|
45
45
|
_uri = URI.parse(URI.encode(url))
|
|
46
46
|
if _uri.query.present?
|
|
47
47
|
_cgi = CGI.parse(_uri.query)
|
|
48
|
-
|
|
48
|
+
if _cgi[param_name]
|
|
49
|
+
val = unescape_string(_cgi[param_name].to_s).strip.downcase
|
|
50
|
+
return (!val.nil? && val!='' ? val : nil)
|
|
51
|
+
end
|
|
49
52
|
end
|
|
50
53
|
return nil
|
|
51
54
|
end
|
|
@@ -56,4 +59,12 @@ class SkinnyJeansStringParser
|
|
|
56
59
|
@all_urls.empty? ? nil : @all_urls
|
|
57
60
|
end
|
|
58
61
|
|
|
62
|
+
private
|
|
63
|
+
def unescape_string(_string)
|
|
64
|
+
temp = _string.dup
|
|
65
|
+
temp = CGI.unescape(temp) while CGI.unescape(temp) != temp
|
|
66
|
+
temp
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
|
|
59
70
|
end
|
data/skinny_jeans.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{skinny_jeans}
|
|
8
|
-
s.version = "0.5.
|
|
8
|
+
s.version = "0.5.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Jonathan Otto"]
|
|
12
|
-
s.date = %q{2010-12-
|
|
12
|
+
s.date = %q{2010-12-08}
|
|
13
13
|
s.email = %q{jonathan.otto@gmail.com}
|
|
14
14
|
s.extra_rdoc_files = [
|
|
15
15
|
"README.rdoc",
|
|
@@ -20,7 +20,7 @@ class SkinnyJeansStringParserTest < Test::Unit::TestCase
|
|
|
20
20
|
http://www.bing.com/search?q=XPS+17+coupon&src={referrer:source?}
|
|
21
21
|
EOF
|
|
22
22
|
sjsp = SkinnyJeansStringParser.new(_string)
|
|
23
|
-
assert_equal "
|
|
23
|
+
assert_equal "xps 17 coupon", sjsp.get_search_keyword
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def test_return_nil_of_no_urls
|
|
@@ -38,7 +38,7 @@ class SkinnyJeansStringParserTest < Test::Unit::TestCase
|
|
|
38
38
|
98.244.200.209 - - [01/Dec/2010:11:51:26 -0800] "GET /deals/apple-ipod-touch HTTP/1.1" 200 11448 "http://www.google.com/m/search?oe=UTF-8&client=safari&hl=en&q=best+deals+for+the+4th+generation+iPod+touch+32+gb&gws_link_params=spell:1&ei=aqb2TJDBLqGutgfp862NAg&ved=0CBEQBSgA" "Mozilla/5.0 (iPod; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7" "-"
|
|
39
39
|
EOF
|
|
40
40
|
sjsp = SkinnyJeansStringParser.new(_string)
|
|
41
|
-
assert_equal "best deals for the 4th generation
|
|
41
|
+
assert_equal "best deals for the 4th generation ipod touch 32 gb", sjsp.get_search_keyword
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
end
|
data/test/skinny_jeans_test.rb
CHANGED
|
@@ -44,7 +44,7 @@ class SkinnyJeansTest < Test::Unit::TestCase
|
|
|
44
44
|
sj.execute
|
|
45
45
|
assert_equal 3, sj.pageview.find_by_path("delonghi-hhp1500-safeheat-mica-panel-radiator-heater-with-thermostat-control").pageview_count
|
|
46
46
|
assert_equal 3, sj.pageview.find_by_path("apple-ipod-touch").pageview_count
|
|
47
|
-
assert_equal 3, sj.pageview_keyword.find_by_path_and_keyword("apple-ipod-touch", "best deals for the 4th generation
|
|
47
|
+
assert_equal 3, sj.pageview_keyword.find_by_path_and_keyword("apple-ipod-touch", "best deals for the 4th generation ipod touch 32 gb").pageview_count
|
|
48
48
|
# PP.pp sj.pageview_keyword.all
|
|
49
49
|
end
|
|
50
50
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: skinny_jeans
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 15
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 5
|
|
9
|
-
-
|
|
10
|
-
version: 0.5.
|
|
9
|
+
- 2
|
|
10
|
+
version: 0.5.2
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Jonathan Otto
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2010-12-
|
|
18
|
+
date: 2010-12-08 00:00:00 -06:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|