fletcher 0.5.0 → 0.5.1

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.
@@ -1,6 +1,6 @@
1
1
  rvm: # list all the Rubies you want to test against
2
2
  - 1.8.7
3
- - 1.9.2
3
+ #- 1.9.2
4
4
  - 1.9.3
5
5
  #- jruby
6
6
  - ree
data/README.md CHANGED
@@ -19,6 +19,7 @@ Fletcher is a cross-website product/model information fetcher. Give fletcher a p
19
19
  * [Google Shopping](http://www.google.com/products/)
20
20
  * [play.com](http://www.play.com)
21
21
  * [ThinkGeek](http://www.thinkgeek.com)
22
+ * [Steam](http://store.steampowered.com)
22
23
 
23
24
  ## Installation
24
25
 
@@ -37,8 +38,8 @@ model.name # => "Avenir Deluxe Unicycle (20-Inch Wheel)"
37
38
 
38
39
  model.description # => "A wonderful unicycle"
39
40
 
41
+ model.images.count # => 1
40
42
  model.image # => {:url => "http://ecx.images-amazon.com/images/I/41b3TNb3uCL._SL500_AA300_.jpg", :alt => "Picture of Unicycle"}
41
-
42
43
  model.image.url # => "http://ecx.images-amazon.com/images/I/41b3TNb3uCL._SL500_AA300_.jpg"
43
44
 
44
45
  model.price # => #<Money cents:500 currency:USD>
@@ -50,7 +51,7 @@ model.price.currency.symbol # => "$"
50
51
  model.doc.class.name # => Nokogiri::HTML::Document
51
52
 
52
53
  # Get list of supported websites/services
53
- Fletcher.models # => [:amazon, :ebay, :etsy, :thinkgeek]
54
+ Fletcher.models # => [:amazon, :ebay, :etsy, :thinkgeek, ...]
54
55
  ```
55
56
 
56
57
  ## Attributes
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "fletcher"
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dave Hulihan", "Hulihan Applications"]
12
- s.date = "2012-10-14"
12
+ s.date = "2012-10-24"
13
13
  s.description = "Easily fetch product/model information from third party websites such as Amazon, eBay, etc."
14
14
  s.email = "dave@hulihanapplications.com"
15
15
  s.extra_rdoc_files = [
@@ -19,7 +19,7 @@ module Fletcher
19
19
  self.description = doc.xpath("//meta[@property='og:description']/@content").first_string
20
20
 
21
21
  # Get Price
22
- parse_price(doc.xpath("//form[@id='buy']/h3").first_string)
22
+ parse_price(doc.xpath("//form[@id='buy']/h3").first_string) rescue nil
23
23
 
24
24
  # Get Images
25
25
  self.images = [{:url => doc.xpath("//meta[@property='og:image']/@content").first_string}]
@@ -35,6 +35,11 @@ FactoryGirl.define do
35
35
  url "http://www.thinkgeek.com/geektoys/plush/e7f8/"
36
36
  end
37
37
 
38
+ # ThinkGeek Product with hyphenated price range
39
+ factory :thinkgeek_with_price_range, :parent => :base do
40
+ url "http://www.thinkgeek.com/product/f131/?pfm=tshirts-apparel_newest_f131_1"
41
+ end
42
+
38
43
  factory :etsy, :parent => :base do
39
44
  url "http://www.etsy.com/listing/78608690/farm-fresh-125-x-19-in-pick-your-color"
40
45
  end
@@ -1,5 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Fletcher, :vcr do
4
+ describe :fetch, :vcr do
5
+ it "should fetch amazon product" do
6
+ item = described_class.fetch(Factory(:amazon).url)
7
+ item.should_not be_nil
8
+ item.name.should_not be_nil
9
+ item.description.should_not be_nil
10
+ end
11
+ end
12
+ end
13
+
3
14
  describe Fletcher::Model::Amazon do
4
15
  describe "parse", :vcr do
5
16
  context "with valid data" do
@@ -1,5 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Fletcher, :vcr do
4
+ describe :fetch, :vcr do
5
+ # Force use of ebay cassette since auctions always end
6
+ it "should fetch ebay product", :vcr => { :cassette_name => "ebay_fetch" } do
7
+ item = described_class.fetch(Factory(:ebay).url)
8
+ item.should_not be_nil
9
+ item.name.should_not be_nil
10
+ end
11
+ end
12
+ end
13
+
3
14
  describe Fletcher::Model::Ebay, :vcr => { :cassette_name => "ebay_model" } do
4
15
  describe "parse" do
5
16
  context "with valid data" do
@@ -1,5 +1,17 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Fletcher, :vcr do
4
+ describe :fetch, :vcr do
5
+ it "should fetch etsy product" do
6
+ item = described_class.fetch(Factory(:etsy).url)
7
+ item.should_not be_nil
8
+ item.name.should_not be_nil
9
+ item.description.should_not be_nil
10
+ end
11
+ end
12
+ end
13
+
14
+
3
15
  describe Fletcher::Model::Etsy, :vcr do
4
16
  describe "parse" do
5
17
  context "with valid data" do
@@ -1,5 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Fletcher, :vcr do
4
+ describe :fetch, :vcr do
5
+ it "should fetch gamecouk product" do
6
+ item = described_class.fetch(Factory(:gamecouk).url)
7
+ item.should_not be_nil
8
+ item.name.should_not be_nil
9
+ item.description.should_not be_nil
10
+ end
11
+ end
12
+ end
13
+
3
14
  describe Fletcher::Model::Gamecouk, :vcr do
4
15
  describe "parse" do
5
16
  context "with valid data" do
@@ -1,5 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Fletcher, :vcr do
4
+ describe :fetch, :vcr do
5
+ it "should fetch googleshopping product" do
6
+ item = described_class.fetch(Factory(:googleshopping).url)
7
+ item.should_not be_nil
8
+ item.name.should_not be_nil
9
+ item.description.should_not be_nil
10
+ end
11
+ end
12
+ end
13
+
3
14
  describe Fletcher::Model::Googleshopping, :vcr do
4
15
  describe "parse" do
5
16
  context "with valid data" do
@@ -1,5 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Fletcher, :vcr do
4
+ describe :fetch, :vcr do
5
+ it "should fetch playcom product" do
6
+ item = described_class.fetch(Factory(:playcom).url)
7
+ item.should_not be_nil
8
+ item.name.should_not be_nil
9
+ item.description.should_not be_nil
10
+ end
11
+ end
12
+ end
13
+
3
14
  describe Fletcher::Model::Playcom, :vcr do
4
15
  describe "parse" do
5
16
  context "with valid data" do
@@ -1,5 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Fletcher, :vcr do
4
+ describe :fetch, :vcr do
5
+
6
+ end
7
+ end
8
+
3
9
  describe Fletcher::Model::Steam, :vcr do
4
10
  describe "parse" do
5
11
  context "with valid data" do
@@ -1,5 +1,29 @@
1
1
  require 'spec_helper'
2
2
 
3
+ describe Fletcher, :vcr do
4
+ describe :fetch, :vcr do
5
+
6
+ end
7
+ end
8
+
9
+ describe Fletcher, :vcr do
10
+ describe :fetch, :vcr do
11
+ it "should fetch a thinkgeek product's information" do
12
+ item = Fletcher.fetch(Factory(:thinkgeek).url)
13
+ item.should_not be_nil
14
+ item.name.should_not be_nil
15
+ item.description.should_not be_nil
16
+ end
17
+
18
+ it "should fetch a thinkgeek product with price range" do
19
+ item = Fletcher.fetch(Factory(:thinkgeek_with_price_range).url)
20
+ item.should_not be_nil
21
+ item.name.should_not be_nil
22
+ item.description.should_not be_nil
23
+ end
24
+ end
25
+ end
26
+
3
27
  describe Fletcher::Model::Thinkgeek, :vcr do
4
28
  describe "parse" do
5
29
  context "with valid data" do
@@ -23,55 +23,6 @@ describe Fletcher, :vcr do
23
23
  # item.description.should_not be_nil if model == :amazon
24
24
  # end
25
25
  # end
26
-
27
- it "should fetch amazon product" do
28
- item = described_class.fetch(Factory(:amazon).url)
29
- item.should_not be_nil
30
- item.name.should_not be_nil
31
- item.description.should_not be_nil
32
- end
33
-
34
- # Disable ebay fetch test, since auctions always end
35
- it "should fetch ebay product", :vcr => { :cassette_name => "ebay_fetch" } do
36
- item = described_class.fetch(Factory(:ebay).url)
37
- item.should_not be_nil
38
- item.name.should_not be_nil
39
- end
40
-
41
- it "should fetch etsy product" do
42
- item = described_class.fetch(Factory(:etsy).url)
43
- item.should_not be_nil
44
- item.name.should_not be_nil
45
- item.description.should_not be_nil
46
- end
47
-
48
- it "should fetch gamecouk product" do
49
- item = described_class.fetch(Factory(:gamecouk).url)
50
- item.should_not be_nil
51
- item.name.should_not be_nil
52
- item.description.should_not be_nil
53
- end
54
-
55
- it "should fetch googleshopping product" do
56
- item = described_class.fetch(Factory(:googleshopping).url)
57
- item.should_not be_nil
58
- item.name.should_not be_nil
59
- item.description.should_not be_nil
60
- end
61
-
62
- it "should fetch playcom product" do
63
- item = described_class.fetch(Factory(:playcom).url)
64
- item.should_not be_nil
65
- item.name.should_not be_nil
66
- item.description.should_not be_nil
67
- end
68
-
69
- it "should fetch thinkgeek product" do
70
- item = described_class.fetch(Factory(:thinkgeek).url)
71
- item.should_not be_nil
72
- item.name.should_not be_nil
73
- item.description.should_not be_nil
74
- end
75
26
  end
76
27
  end
77
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fletcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-14 00:00:00.000000000 Z
13
+ date: 2012-10-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hashie
@@ -270,7 +270,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
270
270
  version: '0'
271
271
  segments:
272
272
  - 0
273
- hash: 2622826679390727848
273
+ hash: 1654336260587893613
274
274
  required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  none: false
276
276
  requirements: