razsell 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/razsell.gemspec ADDED
@@ -0,0 +1,97 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{razsell}
8
+ s.version = "0.0.4"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jamal Hansen"]
12
+ s.date = %q{2009-12-22}
13
+ s.email = %q{jamal.hansen@gmail.com}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".document",
20
+ ".gitignore",
21
+ "LICENSE",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "docs/RSSGuide1.02.pdf",
26
+ "features/product_lines.feature",
27
+ "features/razsell.feature",
28
+ "features/step_definitions/product_line_steps.rb",
29
+ "features/step_definitions/razsell_steps.rb",
30
+ "features/support/env.rb",
31
+ "features/support/razsell_mixed_in.rb",
32
+ "lib/constants.rb",
33
+ "lib/constants/image_sizes.rb",
34
+ "lib/constants/product_types.rb",
35
+ "lib/constants/sort_methods.rb",
36
+ "lib/constants/sort_periods.rb",
37
+ "lib/engine.rb",
38
+ "lib/http_service.rb",
39
+ "lib/item.rb",
40
+ "lib/product_line.rb",
41
+ "lib/product_line_parser.rb",
42
+ "lib/query.rb",
43
+ "lib/razsell.rb",
44
+ "lib/results.rb",
45
+ "razsell.gemspec",
46
+ "test/engine_test.rb",
47
+ "test/fixtures.rb",
48
+ "test/fixtures/page_1.rss",
49
+ "test/fixtures/page_2.rss",
50
+ "test/fixtures/productlines.htm",
51
+ "test/fixtures/rockstar.rss",
52
+ "test/product_line_parser_test.rb",
53
+ "test/product_types_test.rb",
54
+ "test/query_test.rb",
55
+ "test/razsell_test.rb",
56
+ "test/results_test.rb",
57
+ "test/test_helper.rb"
58
+ ]
59
+ s.homepage = %q{http://github.com/rubyyot/razsell}
60
+ s.rdoc_options = ["--charset=UTF-8"]
61
+ s.require_paths = ["lib"]
62
+ s.rubygems_version = %q{1.3.5}
63
+ s.summary = %q{A gem for getting info about products on a website that has a similar name}
64
+ s.test_files = [
65
+ "test/product_types_test.rb",
66
+ "test/fixtures.rb",
67
+ "test/test_helper.rb",
68
+ "test/results_test.rb",
69
+ "test/product_line_parser_test.rb",
70
+ "test/razsell_test.rb",
71
+ "test/query_test.rb",
72
+ "test/engine_test.rb"
73
+ ]
74
+
75
+ if s.respond_to? :specification_version then
76
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
77
+ s.specification_version = 3
78
+
79
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
80
+ s.add_runtime_dependency(%q<hpricot>, [">= 0.8.1"])
81
+ s.add_development_dependency(%q<cucumber>, [">= 0.3.11"])
82
+ s.add_development_dependency(%q<mocha>, [">= 0"])
83
+ s.add_development_dependency(%q<technicalpickles-shoulda>, [">= 0"])
84
+ else
85
+ s.add_dependency(%q<hpricot>, [">= 0.8.1"])
86
+ s.add_dependency(%q<cucumber>, [">= 0.3.11"])
87
+ s.add_dependency(%q<mocha>, [">= 0"])
88
+ s.add_dependency(%q<technicalpickles-shoulda>, [">= 0"])
89
+ end
90
+ else
91
+ s.add_dependency(%q<hpricot>, [">= 0.8.1"])
92
+ s.add_dependency(%q<cucumber>, [">= 0.3.11"])
93
+ s.add_dependency(%q<mocha>, [">= 0"])
94
+ s.add_dependency(%q<technicalpickles-shoulda>, [">= 0"])
95
+ end
96
+ end
97
+
@@ -0,0 +1,55 @@
1
+ require 'test_helper'
2
+ require 'engine'
3
+ require 'http_service'
4
+
5
+ module Razsell
6
+ class EngineTest < Test::Unit::TestCase
7
+ context "basic operations" do
8
+ should "initialize without parameters" do
9
+ engine = Razsell::Engine.new
10
+ end
11
+
12
+ should "accept http_service" do
13
+ http_service = Razsell::HttpService.new
14
+ http_service.expects(:get).once.returns("")
15
+
16
+ engine = Razsell::Engine.new :http_service => http_service
17
+ query = Razsell::Query.new
18
+
19
+ engine.request query
20
+ end
21
+
22
+ context "getting results" do
23
+ setup do
24
+ http_service = Razsell::HttpService.new
25
+ http_service.expects(:get).once.returns(feed("rockstar"))
26
+
27
+ engine = Razsell::Engine.new :http_service => http_service
28
+ query = Razsell::Query.new
29
+
30
+ @result = engine.request query
31
+ end
32
+
33
+ should "have total item count" do
34
+ assert_equal 3, @result.item_count
35
+ end
36
+ end
37
+
38
+ context "Getting multiple pages of results" do
39
+ setup do
40
+ http_service = Razsell::HttpService.new
41
+ http_service.expects(:get).twice.returns(feed("page_1"), feed("page_2"))
42
+
43
+ engine = Razsell::Engine.new :http_service => http_service
44
+ query = Razsell::Query.new
45
+
46
+ @result = engine.request query
47
+ end
48
+
49
+ should "have total item count" do
50
+ assert_equal 5, @result.item_count
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,125 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <rss version="2.0" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:media="http://search.yahoo.com/mrss/">
3
+ <channel><title>Kung Fu Tees: Zazzle.com Gallery: Products Matching "rockstar"</title>
4
+ <link>http://feed.zazzle.com/z.2/api/find.aspx?ft=rss&amp;bg=FFFFFF&amp;ch=kungfutees&amp;ft=rss&amp;isz=large&amp;opensearch=1&amp;ou=/kungfutees/rss?bg=FFFFFF&amp;ft=rss&amp;isz=large&amp;opensearch=1&amp;pg=1&amp;qs=rockstar&amp;ps=50&amp;src=razsell&amp;st=popularity&amp;pg=1&amp;ps=50&amp;qs=rockstar&amp;src=razsell&amp;st=popularity</link>
5
+
6
+ <description></description>
7
+ <language>en-us</language>
8
+ <pubDate>Tue, 30 Jun 2009 02:23:26 GMT</pubDate>
9
+ <ttl>60</ttl>
10
+ <opensearch:totalResults>5</opensearch:totalResults>
11
+ <opensearch:startIndex>1</opensearch:startIndex>
12
+
13
+ <opensearch:itemsPerPage>3</opensearch:itemsPerPage>
14
+ <opensearch:Query role="request" searchTerms="rockstar" />
15
+ <item>
16
+ <guid isPermaLink="false">http://www.zazzle.com/ladies_rockstar_tshirt-235898004129790991?gl=kungfutees</guid>
17
+ <pubDate>Sat, 02 May 2009 13:06:08 GMT</pubDate>
18
+ <title><![CDATA[Ladies Rockstar TShirt]]></title>
19
+ <link>http://www.zazzle.com/ladies_rockstar_tshirt-235898004129790991?gl=kungfutees</link>
20
+ <author>kungfutees</author>
21
+ <description>
22
+ <![CDATA[<div class="gridCell " id="_assetCell1">
23
+ <div style="position:relative" class="clearfix">
24
+ <a href="http://www.zazzle.com/ladies_rockstar_tshirt-235898004129790991?gl=kungfutees" id="_assetCell1-imageLink" class="realviewLink"><img id="_assetCell1-preview" src="http://rlv.zcache.com/ladies_rockstar_tshirt-p235898004129790991ojnq_210.jpg" alt="Ladies Rockstar TShirt" title="Ladies Rockstar TShirt by kungfutees" class="realviewImage"/></a>
25
+ <div id="_assetCell1-productTypeIcon" class="shirtIcon"></div>
26
+ <a href="javascript://" id="_assetCell1-nextviewLink" class="nextviewLink"></a>
27
+ </div>
28
+ <div class="gridCellInfo" id="_assetCell1-info">
29
+ <a
30
+ href="http://www.zazzle.com/ladies_rockstar_tshirt-235898004129790991?gl=kungfutees"
31
+ id="_assetCell1-title"
32
+ class="productTitle" title="Ladies Rockstar TShirt"
33
+ >Ladies Rockstar TShirt</a><br />
34
+ <span class="byLine">by <a href="http://www.zazzle.com/kungfutees" id="_assetCell1-contributorLink" rel="nofollow">kungfutees</a><br /></span>
35
+ <span class="extraInfo">
36
+ <br />
37
+
38
+ </span>
39
+ </div>
40
+ </div>]]>
41
+ </description>
42
+ <media:title><![CDATA[Ladies Rockstar TShirt]]></media:title>
43
+ <media:description><![CDATA[Ladies are Rockstar Coders too!]]></media:description>
44
+ <media:thumbnail url="http://rlv.zcache.com/ladies_rockstar_tshirt-p235898004129790991ojnq_125.jpg" />
45
+ <media:content url="http://rlv.zcache.com/ladies_rockstar_tshirt-p235898004129790991ojnq_500.jpg" />
46
+ <media:keywords>rockstar, coder, ror, ruby, on, rails</media:keywords>
47
+ <media:rating scheme="urn:mpaa">g</media:rating>
48
+ </item>
49
+ <item>
50
+ <guid isPermaLink="false">http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees</guid>
51
+ <pubDate>Sat, 02 May 2009 13:09:16 GMT</pubDate>
52
+ <title><![CDATA[Rockstar Coder Mug]]></title>
53
+ <link>http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees</link>
54
+ <author>kungfutees</author>
55
+ <description>
56
+ <![CDATA[
57
+ <div class="gridCell " id="_assetCell2">
58
+ <div style="position:relative" class="clearfix">
59
+ <a href="http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees" id="_assetCell2-imageLink" class="realviewLink"
60
+ ><img id="_assetCell2-preview" src="http://rlv.zcache.com/rockstar_coder_mug-p168427986526885635tda5_210.jpg" alt="Rockstar Coder Mug" title="Rockstar Coder Mug by kungfutees" class="realviewImage"
61
+ /></a>
62
+ <div id="_assetCell2-productTypeIcon" class="mugIcon"></div>
63
+ <a href="javascript://" id="_assetCell2-nextviewLink" class="nextviewLink"></a>
64
+ </div>
65
+ <div class="gridCellInfo" id="_assetCell2-info">
66
+ <a
67
+ href="http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees"
68
+ id="_assetCell2-title"
69
+ class="productTitle" title="Rockstar Coder Mug"
70
+ >Rockstar Coder Mug</a><br />
71
+ <span class="byLine">by <a href="http://www.zazzle.com/kungfutees" id="_assetCell2-contributorLink" rel="nofollow">kungfutees</a><br /></span>
72
+ <span class="extraInfo">
73
+ <br />
74
+
75
+ </span>
76
+ </div>
77
+ </div>]]>
78
+ </description>
79
+ <media:title><![CDATA[Rockstar Coder Mug]]></media:title>
80
+ <media:description><![CDATA[Want to show your inner rockstar in the break room? Here is the perfect way.]]></media:description>
81
+ <media:thumbnail url="http://rlv.zcache.com/rockstar_coder_mug-p168427986526885635tda5_125.jpg" />
82
+ <media:content url="http://rlv.zcache.com/rockstar_coder_mug-p168427986526885635tda5_500.jpg" />
83
+ <media:keywords>rockstar, coder, ror, ruby, on, rails</media:keywords>
84
+ <media:rating scheme="urn:mpaa">g</media:rating>
85
+ </item>
86
+
87
+ <item>
88
+ <guid isPermaLink="false">http://www.zazzle.com/rockstar_coder_tshirt-235670521587248636?gl=kungfutees</guid>
89
+ <pubDate>Sat, 02 May 2009 04:43:47 GMT</pubDate>
90
+ <title><![CDATA[Rockstar Coder]]></title>
91
+ <link>http://www.zazzle.com/rockstar_coder_tshirt-235670521587248636?gl=kungfutees</link>
92
+ <author>kungfutees</author>
93
+ <description>
94
+ <![CDATA[
95
+ <div class="gridCell " id="_assetCell3">
96
+ <div style="position:relative" class="clearfix">
97
+ <a href="http://www.zazzle.com/rockstar_coder_tshirt-235670521587248636?gl=kungfutees" id="_assetCell3-imageLink" class="realviewLink"
98
+ ><img id="_assetCell3-preview" src="http://rlv.zcache.com/rockstar_coder_tshirt-p235670521587248636cxhe_210.jpg" alt="Rockstar Coder t-shirts" title="Rockstar Coder t-shirts by kungfutees" class="realviewImage"
99
+ /></a>
100
+ <div id="_assetCell3-productTypeIcon" class="shirtIcon"></div>
101
+ <a href="javascript://" id="_assetCell3-nextviewLink" class="nextviewLink"></a>
102
+ </div>
103
+ <div class="gridCellInfo" id="_assetCell3-info">
104
+ <a
105
+ href="http://www.zazzle.com/rockstar_coder_tshirt-235670521587248636?gl=kungfutees"
106
+ id="_assetCell3-title"
107
+ class="productTitle" title="Rockstar Coder"
108
+ >Rockstar Coder</a><br />
109
+ <span class="byLine">by <a href="http://www.zazzle.com/kungfutees" id="_assetCell3-contributorLink" rel="nofollow">kungfutees</a><br /></span>
110
+ <span class="extraInfo">
111
+ <br />
112
+
113
+ </span>
114
+ </div>
115
+ </div>]]>
116
+ </description>
117
+ <media:title><![CDATA[Rockstar Coder]]></media:title>
118
+ <media:description><![CDATA[Want to show the world that you are a Rockstar Coder? What better way than a Nutritional Information label. Shirt is blank on front, with Rockstar Coder pattern on the back.]]>
119
+ </media:description><media:thumbnail url="http://rlv.zcache.com/rockstar_coder_tshirt-p235670521587248636cxhe_125.jpg" />
120
+ <media:content url="http://rlv.zcache.com/rockstar_coder_tshirt-p235670521587248636cxhe_500.jpg" />
121
+ <media:keywords>ruby, rockstar, coder, ruby, on, rails</media:keywords>
122
+ <media:rating scheme="urn:mpaa">g</media:rating>
123
+ </item>
124
+ </channel>
125
+ </rss>
@@ -0,0 +1,87 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <rss version="2.0" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:media="http://search.yahoo.com/mrss/">
3
+ <channel><title>Kung Fu Tees: Zazzle.com Gallery: Products Matching "rockstar"</title>
4
+ <link>http://feed.zazzle.com/z.2/api/find.aspx?ft=rss&amp;bg=FFFFFF&amp;ch=kungfutees&amp;ft=rss&amp;isz=large&amp;opensearch=1&amp;ou=/kungfutees/rss?bg=FFFFFF&amp;ft=rss&amp;isz=large&amp;opensearch=1&amp;pg=1&amp;qs=rockstar&amp;ps=50&amp;src=razsell&amp;st=popularity&amp;pg=1&amp;ps=50&amp;qs=rockstar&amp;src=razsell&amp;st=popularity</link>
5
+
6
+ <description></description>
7
+ <language>en-us</language>
8
+ <pubDate>Tue, 30 Jun 2009 02:23:26 GMT</pubDate>
9
+ <ttl>60</ttl>
10
+ <opensearch:totalResults>5</opensearch:totalResults>
11
+ <opensearch:startIndex>4</opensearch:startIndex>
12
+
13
+ <opensearch:itemsPerPage>3</opensearch:itemsPerPage>
14
+ <opensearch:Query role="request" searchTerms="rockstar" />
15
+ <item>
16
+ <guid isPermaLink="false">http://www.zazzle.com/ladies_rockstar_tshirt2-235898004129790991?gl=kungfutees</guid>
17
+ <pubDate>Sat, 02 May 2009 13:06:08 GMT</pubDate>
18
+ <title><![CDATA[Ladies Rockstar TShirt2]]></title>
19
+ <link>http://www.zazzle.com/ladies_rockstar_tshirt2-235898004129790991?gl=kungfutees</link>
20
+ <author>kungfutees</author>
21
+ <description>
22
+ <![CDATA[<div class="gridCell " id="_assetCell1">
23
+ <div style="position:relative" class="clearfix">
24
+ <a href="http://www.zazzle.com/ladies_rockstar_tshirt-235898004129790991?gl=kungfutees" id="_assetCell1-imageLink" class="realviewLink"><img id="_assetCell1-preview" src="http://rlv.zcache.com/ladies_rockstar_tshirt-p235898004129790991ojnq_210.jpg" alt="Ladies Rockstar TShirt" title="Ladies Rockstar TShirt by kungfutees" class="realviewImage"/></a>
25
+ <div id="_assetCell1-productTypeIcon" class="shirtIcon"></div>
26
+ <a href="javascript://" id="_assetCell1-nextviewLink" class="nextviewLink"></a>
27
+ </div>
28
+ <div class="gridCellInfo" id="_assetCell1-info">
29
+ <a
30
+ href="http://www.zazzle.com/ladies_rockstar_tshirt-235898004129790991?gl=kungfutees"
31
+ id="_assetCell1-title"
32
+ class="productTitle" title="Ladies Rockstar TShirt"
33
+ >Ladies Rockstar TShirt</a><br />
34
+ <span class="byLine">by <a href="http://www.zazzle.com/kungfutees" id="_assetCell1-contributorLink" rel="nofollow">kungfutees</a><br /></span>
35
+ <span class="extraInfo">
36
+ <br />
37
+
38
+ </span>
39
+ </div>
40
+ </div>]]>
41
+ </description>
42
+ <media:title><![CDATA[Ladies Rockstar TShirt 2]]></media:title>
43
+ <media:description><![CDATA[Ladies are Rockstar Coders too! 2]]></media:description>
44
+ <media:thumbnail url="http://rlv.zcache.com/ladies_rockstar_tshirt-p235898004129790991ojnq_125.jpg" />
45
+ <media:content url="http://rlv.zcache.com/ladies_rockstar_tshirt-p235898004129790991ojnq_500.jpg" />
46
+ <media:keywords>rockstar, coder, ror, ruby, on, rails</media:keywords>
47
+ <media:rating scheme="urn:mpaa">g</media:rating>
48
+ </item>
49
+ <item>
50
+ <guid isPermaLink="false">http://www.zazzle.com/rockstar_coder_mug2-168427986526885635?gl=kungfutees</guid>
51
+ <pubDate>Sat, 02 May 2009 13:09:16 GMT</pubDate>
52
+ <title><![CDATA[Rockstar Coder Mug 2]]></title>
53
+ <link>http://www.zazzle.com/rockstar_coder_mug2-168427986526885635?gl=kungfutees</link>
54
+ <author>kungfutees</author>
55
+ <description>
56
+ <![CDATA[
57
+ <div class="gridCell " id="_assetCell2">
58
+ <div style="position:relative" class="clearfix">
59
+ <a href="http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees" id="_assetCell2-imageLink" class="realviewLink"
60
+ ><img id="_assetCell2-preview" src="http://rlv.zcache.com/rockstar_coder_mug-p168427986526885635tda5_210.jpg" alt="Rockstar Coder Mug" title="Rockstar Coder Mug by kungfutees" class="realviewImage"
61
+ /></a>
62
+ <div id="_assetCell2-productTypeIcon" class="mugIcon"></div>
63
+ <a href="javascript://" id="_assetCell2-nextviewLink" class="nextviewLink"></a>
64
+ </div>
65
+ <div class="gridCellInfo" id="_assetCell2-info">
66
+ <a
67
+ href="http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees"
68
+ id="_assetCell2-title"
69
+ class="productTitle" title="Rockstar Coder Mug"
70
+ >Rockstar Coder Mug</a><br />
71
+ <span class="byLine">by <a href="http://www.zazzle.com/kungfutees" id="_assetCell2-contributorLink" rel="nofollow">kungfutees</a><br /></span>
72
+ <span class="extraInfo">
73
+ <br />
74
+
75
+ </span>
76
+ </div>
77
+ </div>]]>
78
+ </description>
79
+ <media:title><![CDATA[Rockstar Coder Mug 2]]></media:title>
80
+ <media:description><![CDATA[Want to show your inner rockstar in the break room? Here is the perfect way.]]></media:description>
81
+ <media:thumbnail url="http://rlv.zcache.com/rockstar_coder_mug-p168427986526885635tda5_125.jpg" />
82
+ <media:content url="http://rlv.zcache.com/rockstar_coder_mug-p168427986526885635tda5_500.jpg" />
83
+ <media:keywords>rockstar, coder, ror, ruby, on, rails</media:keywords>
84
+ <media:rating scheme="urn:mpaa">g</media:rating>
85
+ </item>
86
+ </channel>
87
+ </rss>