sears-api
A somewhat simple wrapper on the Sears Developer API developer.sears.com/apis
Installation
gem install sears-api
Usage
require 'sears-api'
SearsApi::Configuration.key = '<your-api-key>'
re0 = SearsApi::Client.product_search_by_keyword('craftsman')
re1 = SearsApi::Client.product_details(re0.first.part_number)
re1.main_image_url #=> "http://s.shld.net/is/image/Sears/00935255000
re1.description_name #=> "255 pc. Mechanics Tool Set with Lift Top Storage Chest
# etc.
store methods
There are two ways to search a given store (The default is Sears).
-
you can call with at store attribute e.g. SearsApi::Client.product_search_by_keyword(‘craftsman’, :store => ‘Kmart’)
-
but there are convenience methods SearsApi::Client.kmart_product_search_by_keyword(‘craftsman’)
Method Missing and Delegation
Should do the right thing ™ in most cases. You should be able to use the underscored versions of method names correlate to the tags/nodes returned by the Sears API XML. Mostly I’ve chosen the delegate to be the node you likely want but if you want to you can access the HTTParty response directly with SearsApi::Response#resp
Contributing to sears-api
-
Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
-
Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
-
Fork the project
-
Start a feature/bugfix branch
-
Commit and push until you are happy with your contribution
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright
Copyright © 2012 rjspotter. See LICENSE.txt for further details.