0.02
No commit activity in last 3 years
No release in over 3 years
Ruby implementation for Walmart Open API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 1.6
>= 0
~> 3.0.0.beta2
~> 0.7
~> 1.17.0

Runtime

>= 3.0.0
~> 0.10
 Project Readme

Walmart Open

Walmart Open is Walmart's official products search API.

Products API

To use the Products API, you must register for a Walmart Open account and obtain an API key. You can also make API calls from their interacive API tool. For documentation can be found here: https://developer.walmartlabs.com/docs.

Installation

Add this line to your application's Gemfile:

gem 'walmart_open'

And then execute:

$ bundle

Or install it yourself as:

$ gem install walmart_open

Usage

Configuring the Client

require "walmart_open"

client = WalmartOpen::Client.new do |config|
  ## Product API
  config.product_api_key = "GggS6aPxDteRCyRxYnqz9bPp"

  # This value defaults to 5.
  config.product_calls_per_second = 4

  # Set this to true for development mode.
  config.debug = true
end

Making Product API Calls

# Search
res = client.search("ipod")
#=> SearchResults
# example of res
# res.query = "ipod"
# res.total = 53259
# res.start = 1
# res.page = ?
# res.items = [ Item_1, Item_2 ....]

# Lookup (by item id)
item = client.lookup(15076191)
#=> item is of class WalmartOpen::Item, see WalmartOpen::Item section for detail
# When item not found, an error of class WalmartOpen::ItemNotFoundError is thrown,
  eg: {"errors"=>[{"code"=>4002, "message"=>"Invalid itemId"}]}
  When walmart api is down, an error of class WalmartOpen::ServerError is thrown,
  eg: {"errors"=>[{"code"=>504, "message"=>"Gateway Timeout"}]}

# Taxonomy
taxonomies = client.taxonomy
#=> Array
# when success, example of one of taxonomies
# taxonomies.categories = {"id"=>"5438", "name"=>"Apparel", "path"=>"Apparel", "children"=>[{"id"=>"5438_426265",
  "name"=>"Accessories", "path"=>"Apparel/Accessories", "children"=>[{"id"=>"5438_426265_1043621",
  "name"=>"Bandanas", "path"=>"Apparel/Accessories/Bandanas"}, ...]]}

# Search special feeds (by feed type, category id)
# Feed type can be :preorder, :bestsellers, :rollback, :clearance, :specialbuy
# For :preorder case, you do not need to pass param category_id
items = client.feed(:bestsellers, category_id)
#=> Array
# when success: items is an array of WalmartOpen::Item items

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request