Project

jaleb

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Easily fetch product information from third party websites such as Amazon, Souq, eBay, etc.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 10.0
~> 3.0
 Project Readme

Jaleb

Jaleb is a cross-website product information fetcher by a product's url.

Features

  • No third-party API access required (good for websites that don't even have API access)
  • Uses nokogiri for data parsing

Supported Websites

Installation

Add this line to your application's Gemfile:

gem 'jaleb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jaleb

Usage

API

require "jaleb"

product  = Jaleb.fetch "http://www.amazon.com/Avenir-Deluxe-Unicycle-20-Inch-Wheel/dp/B00165Q9F8"

product.name # => "Avenir Deluxe Unicycle (20-Inch Wheel)"

product.description # => "A wonderful unicycle"

product.images.count # => 1
product.image # => {:src => "http://ecx.images-amazon.com/images/I/41b3TNb3uCL._SL500_AA300_.jpg", :alt => "Picture of Unicycle"}
product.image.src # => "http://ecx.images-amazon.com/images/I/41b3TNb3uCL._SL500_AA300_.jpg"

product.price # => #<Money cents:500 currency:USD>
product.price.to_f # => 5.0
product.price.format # => "$5.00"  
product.price.currency.symbol # => "$"

# Get Raw Nokogiri Document
product.doc.class.name # => Nokogiri::HTML::Document

# Get list of supported websites/services
Jaleb.models # => [:amazon, :ebay, :etsy, :thinkgeek, ...]

Attributes

The following attributes/method are available for a product:

  • name - (String) The name of the product
  • description - (String) The product's description
  • price - (Money) A Money object representing the product's price. This makes converting exchange rates and math functionality easy to use.
  • image - (Hash) The main image of the product, if available. This is a hash containing standard HTML attributes: src, alt, width, height, etc.
  • images - (Array) An array of product images.
  • doc - The raw Nokogiri::HTML::Document object for the product. You can use this to pull other stuff from the product's page.

Contributing

If you make any changes to fletcher, be sure to run the test suite before creating any pull requests.

bundle install
bundle exec rspec spec/

License

The gem is available as open source under the terms of the MIT License.