razsell 0.0.5 → 0.0.6
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 -1
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/docs/feed sample.txt +15 -0
- data/docs/item sample.txt +36 -0
- data/lib/razsell/engine.rb +0 -10
- data/lib/razsell/item.rb +1 -1
- data/razsell.gemspec +8 -12
- metadata +6 -11
- data/features/product_lines.feature +0 -13
- data/features/step_definitions/product_line_steps.rb +0 -28
- data/lib/razsell/product_line.rb +0 -14
- data/lib/razsell/product_line_parser.rb +0 -19
- data/test/fixtures/productlines.htm +0 -960
- data/test/product_line_parser_test.rb +0 -33
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -6,13 +6,14 @@ begin
|
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "razsell"
|
8
8
|
gem.summary = %Q{A gem for getting info about products on a website that has a similar name}
|
9
|
+
gem.description = %Q{Queries Zazzle RSS feed for data.}
|
9
10
|
gem.email = "jamal.hansen@gmail.com"
|
10
11
|
gem.homepage = "http://github.com/rubyyot/razsell"
|
11
12
|
gem.authors = ["Jamal Hansen"]
|
12
13
|
gem.add_dependency('hpricot', '>= 0.8.1')
|
13
14
|
gem.add_development_dependency('cucumber', '>= 0.3.11')
|
14
15
|
gem.add_development_dependency('mocha')
|
15
|
-
gem.add_development_dependency('
|
16
|
+
gem.add_development_dependency('shoulda')
|
16
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
18
|
end
|
18
19
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<rss version="2.0" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:media="http://search.yahoo.com/mrss/">
|
2
|
+
<channel>
|
3
|
+
<title>Kung Fu Tees: Zazzle.com Gallery: Products </title>
|
4
|
+
<link>http://feed.zazzle.com/z.2/api/find.aspx?ft=rss&ch=kungfutees&ou=/kungfutees/rss</link>
|
5
|
+
<description></description>
|
6
|
+
<language>en-us</language>
|
7
|
+
<pubDate>Sat, 13 Feb 2010 06:58:44 GMT</pubDate>
|
8
|
+
<ttl>60</ttl>
|
9
|
+
<opensearch:totalResults>3</opensearch:totalResults>
|
10
|
+
<opensearch:startIndex>1</opensearch:startIndex>
|
11
|
+
<opensearch:itemsPerPage>15</opensearch:itemsPerPage>
|
12
|
+
<opensearch:Query role="request" searchTerms="" />
|
13
|
+
<!--... items ... -->
|
14
|
+
</channel>
|
15
|
+
</rss>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<item>
|
2
|
+
<guid isPermaLink="false">http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees</guid>
|
3
|
+
<pubDate>Sat, 02 May 2009 13:09:16 GMT</pubDate>
|
4
|
+
<title><![CDATA[Rockstar Coder Mug]]></title>
|
5
|
+
<link>http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees</link>
|
6
|
+
<author>kungfutees</author>
|
7
|
+
<description><![CDATA[
|
8
|
+
><div class="gridCell " id="_assetCell1">
|
9
|
+
<div style="position:relative" class="clearfix">
|
10
|
+
<a href="http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees" id="_assetCell1-imageLink" class="realviewLink"
|
11
|
+
><img id="_assetCell1-preview" src="http://rlv.zcache.com/rockstar_coder_mug-p1684279865268856352obaq_152.jpg" alt="Rockstar Coder Mug" title="Rockstar Coder Mug by kungfutees" class="realviewImage"
|
12
|
+
/></a>
|
13
|
+
<div id="_assetCell1-productTypeIcon" class="mugIcon"></div>
|
14
|
+
<a href="javascript://" id="_assetCell1-nextviewLink" class="nextviewLink"></a>
|
15
|
+
</div>
|
16
|
+
<div class="gridCellInfo" id="_assetCell1-info">
|
17
|
+
<a
|
18
|
+
href="http://www.zazzle.com/rockstar_coder_mug-168427986526885635?gl=kungfutees"
|
19
|
+
id="_assetCell1-title"
|
20
|
+
class="productTitle" title="Rockstar Coder Mug"
|
21
|
+
>Rockstar Coder Mug</a><br />
|
22
|
+
<span class="byLine">by <a href="javascript://" id="_assetCell1-contributorLink">kungfutees</a><br /></span>
|
23
|
+
<span class="extraInfo">
|
24
|
+
<br />
|
25
|
+
|
26
|
+
</span>
|
27
|
+
</div>
|
28
|
+
</div>]]>
|
29
|
+
</description>
|
30
|
+
<media:title><![CDATA[Rockstar Coder Mug]]></media:title>
|
31
|
+
<media:description><![CDATA[Want to show your inner rockstar in the break room? Here is the perfect way.]]></media:description>
|
32
|
+
<media:thumbnail url="http://rlv.zcache.com/rockstar_coder_mug-p1684279865268856352obaq_125.jpg" />
|
33
|
+
<media:content url="http://rlv.zcache.com/rockstar_coder_mug-p1684279865268856352obaq_500.jpg" />
|
34
|
+
<media:keywords>rockstar, coder, ror, ruby, on, rails</media:keywords>
|
35
|
+
<media:rating scheme="urn:mpaa">g</media:rating>
|
36
|
+
</item>
|
data/lib/razsell/engine.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'razsell/http_service'
|
2
|
-
require 'razsell/product_line_parser'
|
3
2
|
|
4
3
|
module Razsell
|
5
4
|
class Engine
|
@@ -19,15 +18,6 @@ module Razsell
|
|
19
18
|
results
|
20
19
|
end
|
21
20
|
|
22
|
-
def product_lines_for artist
|
23
|
-
url = "http://www.zazzle.com/#{artist}?src=razsell"
|
24
|
-
|
25
|
-
document = @http_service.get url
|
26
|
-
|
27
|
-
parser = ProductLineParser.new
|
28
|
-
parser.parse document
|
29
|
-
end
|
30
|
-
|
31
21
|
def get_http_service opts
|
32
22
|
opts[:http_service] ? opts[:http_service] : Razsell::HttpService.new
|
33
23
|
end
|
data/lib/razsell/item.rb
CHANGED
data/razsell.gemspec
CHANGED
@@ -5,11 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{razsell}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jamal Hansen"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-02-13}
|
13
|
+
s.description = %q{Queries Zazzle RSS feed for data.}
|
13
14
|
s.email = %q{jamal.hansen@gmail.com}
|
14
15
|
s.extra_rdoc_files = [
|
15
16
|
"LICENSE",
|
@@ -23,9 +24,9 @@ Gem::Specification.new do |s|
|
|
23
24
|
"Rakefile",
|
24
25
|
"VERSION",
|
25
26
|
"docs/RSSGuide1.02.pdf",
|
26
|
-
"
|
27
|
+
"docs/feed sample.txt",
|
28
|
+
"docs/item sample.txt",
|
27
29
|
"features/razsell.feature",
|
28
|
-
"features/step_definitions/product_line_steps.rb",
|
29
30
|
"features/step_definitions/razsell_steps.rb",
|
30
31
|
"features/support/env.rb",
|
31
32
|
"features/support/razsell_mixed_in.rb",
|
@@ -38,8 +39,6 @@ Gem::Specification.new do |s|
|
|
38
39
|
"lib/razsell/engine.rb",
|
39
40
|
"lib/razsell/http_service.rb",
|
40
41
|
"lib/razsell/item.rb",
|
41
|
-
"lib/razsell/product_line.rb",
|
42
|
-
"lib/razsell/product_line_parser.rb",
|
43
42
|
"lib/razsell/query.rb",
|
44
43
|
"lib/razsell/results.rb",
|
45
44
|
"razsell.gemspec",
|
@@ -47,9 +46,7 @@ Gem::Specification.new do |s|
|
|
47
46
|
"test/fixtures.rb",
|
48
47
|
"test/fixtures/page_1.rss",
|
49
48
|
"test/fixtures/page_2.rss",
|
50
|
-
"test/fixtures/productlines.htm",
|
51
49
|
"test/fixtures/rockstar.rss",
|
52
|
-
"test/product_line_parser_test.rb",
|
53
50
|
"test/product_types_test.rb",
|
54
51
|
"test/query_test.rb",
|
55
52
|
"test/razsell_test.rb",
|
@@ -66,7 +63,6 @@ Gem::Specification.new do |s|
|
|
66
63
|
"test/fixtures.rb",
|
67
64
|
"test/test_helper.rb",
|
68
65
|
"test/results_test.rb",
|
69
|
-
"test/product_line_parser_test.rb",
|
70
66
|
"test/razsell_test.rb",
|
71
67
|
"test/query_test.rb",
|
72
68
|
"test/engine_test.rb"
|
@@ -80,18 +76,18 @@ Gem::Specification.new do |s|
|
|
80
76
|
s.add_runtime_dependency(%q<hpricot>, [">= 0.8.1"])
|
81
77
|
s.add_development_dependency(%q<cucumber>, [">= 0.3.11"])
|
82
78
|
s.add_development_dependency(%q<mocha>, [">= 0"])
|
83
|
-
s.add_development_dependency(%q<
|
79
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
84
80
|
else
|
85
81
|
s.add_dependency(%q<hpricot>, [">= 0.8.1"])
|
86
82
|
s.add_dependency(%q<cucumber>, [">= 0.3.11"])
|
87
83
|
s.add_dependency(%q<mocha>, [">= 0"])
|
88
|
-
s.add_dependency(%q<
|
84
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
89
85
|
end
|
90
86
|
else
|
91
87
|
s.add_dependency(%q<hpricot>, [">= 0.8.1"])
|
92
88
|
s.add_dependency(%q<cucumber>, [">= 0.3.11"])
|
93
89
|
s.add_dependency(%q<mocha>, [">= 0"])
|
94
|
-
s.add_dependency(%q<
|
90
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
95
91
|
end
|
96
92
|
end
|
97
93
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: razsell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamal Hansen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-13 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: "0"
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
|
-
name:
|
46
|
+
name: shoulda
|
47
47
|
type: :development
|
48
48
|
version_requirement:
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: "0"
|
54
54
|
version:
|
55
|
-
description:
|
55
|
+
description: Queries Zazzle RSS feed for data.
|
56
56
|
email: jamal.hansen@gmail.com
|
57
57
|
executables: []
|
58
58
|
|
@@ -69,9 +69,9 @@ files:
|
|
69
69
|
- Rakefile
|
70
70
|
- VERSION
|
71
71
|
- docs/RSSGuide1.02.pdf
|
72
|
-
-
|
72
|
+
- docs/feed sample.txt
|
73
|
+
- docs/item sample.txt
|
73
74
|
- features/razsell.feature
|
74
|
-
- features/step_definitions/product_line_steps.rb
|
75
75
|
- features/step_definitions/razsell_steps.rb
|
76
76
|
- features/support/env.rb
|
77
77
|
- features/support/razsell_mixed_in.rb
|
@@ -84,8 +84,6 @@ files:
|
|
84
84
|
- lib/razsell/engine.rb
|
85
85
|
- lib/razsell/http_service.rb
|
86
86
|
- lib/razsell/item.rb
|
87
|
-
- lib/razsell/product_line.rb
|
88
|
-
- lib/razsell/product_line_parser.rb
|
89
87
|
- lib/razsell/query.rb
|
90
88
|
- lib/razsell/results.rb
|
91
89
|
- razsell.gemspec
|
@@ -93,9 +91,7 @@ files:
|
|
93
91
|
- test/fixtures.rb
|
94
92
|
- test/fixtures/page_1.rss
|
95
93
|
- test/fixtures/page_2.rss
|
96
|
-
- test/fixtures/productlines.htm
|
97
94
|
- test/fixtures/rockstar.rss
|
98
|
-
- test/product_line_parser_test.rb
|
99
95
|
- test/product_types_test.rb
|
100
96
|
- test/query_test.rb
|
101
97
|
- test/razsell_test.rb
|
@@ -134,7 +130,6 @@ test_files:
|
|
134
130
|
- test/fixtures.rb
|
135
131
|
- test/test_helper.rb
|
136
132
|
- test/results_test.rb
|
137
|
-
- test/product_line_parser_test.rb
|
138
133
|
- test/razsell_test.rb
|
139
134
|
- test/query_test.rb
|
140
135
|
- test/engine_test.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Feature: Get Product Lines
|
2
|
-
In order to better organize my products
|
3
|
-
A user of razsell
|
4
|
-
Will ask for a list of product lines
|
5
|
-
|
6
|
-
Scenario: Getting all product lines for a user
|
7
|
-
Given the artist "KungFuTees" on Zazzle
|
8
|
-
When I ask for a list of the artists product lines
|
9
|
-
Then I should get 3 lines
|
10
|
-
And one should be named "Cheeze" with an id of "196854021783912655"
|
11
|
-
And one should be named "New Products" with an id of "196596454716712290"
|
12
|
-
And one should be named "Smim" with an id of "196983228798280961"
|
13
|
-
|
@@ -1,28 +0,0 @@
|
|
1
|
-
|
2
|
-
Given /^the artist "([^\"]*)" on Zazzle$/ do |artist|
|
3
|
-
@artist = artist
|
4
|
-
@sut = RazsellMixedIn.new
|
5
|
-
end
|
6
|
-
|
7
|
-
When /^I ask for a list of the artists product lines$/ do
|
8
|
-
http_service = Razsell::HttpService.new
|
9
|
-
http_service.expects(:get).once.returns(feed("productlines"))
|
10
|
-
|
11
|
-
@product_lines = @sut.product_lines_for(@artist, :http_service => http_service)
|
12
|
-
end
|
13
|
-
|
14
|
-
Then /^I should get 3 lines$/ do
|
15
|
-
assert_equal 3, @product_lines.length
|
16
|
-
end
|
17
|
-
|
18
|
-
Then /^one should be named "([^\"]*)" with an id of "([^\"]*)"$/ do |name, id|
|
19
|
-
@found = false
|
20
|
-
|
21
|
-
@product_lines.each do |line|
|
22
|
-
if line.id == id && line.name == name
|
23
|
-
@found = true
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
assert @found
|
28
|
-
end
|
data/lib/razsell/product_line.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'hpricot'
|
2
|
-
require 'razsell/product_line'
|
3
|
-
|
4
|
-
module Razsell
|
5
|
-
class ProductLineParser
|
6
|
-
def parse document
|
7
|
-
return [] unless document
|
8
|
-
|
9
|
-
elements = get_elements document
|
10
|
-
elements.map { |e| Razsell::ProductLine.new(e.attributes['href'] , e.inner_html) }
|
11
|
-
end
|
12
|
-
|
13
|
-
def get_elements document
|
14
|
-
doc = Hpricot(document)
|
15
|
-
|
16
|
-
(doc/"#page_module8/ul/li/a")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|