Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for product value/type params

  • Loading branch information...
commit 2c3192d375bf159cc88bfd1e0e143408d4450a60 1 parent 081b7ce
@mayokechu authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/rebay/shopping.rb
View
9 lib/rebay/shopping.rb
@@ -5,7 +5,14 @@ class Shopping < Rebay::Api
#http://developer.ebay.com/DevZone/shopping/docs/CallRef/FindProducts.html
def find_products(params)
- raise ArgumentError unless params[:categoryId] or params[:productId] or params[:queryKeywords]
+ unless params[:categoryId] or params[:productId] or params[:queryKeywords] or ( params["ProductID.value"] and params["ProductID.type"] )
+ raise ArgumentError, "Please provide a valid query for a product"
+ end
+
+ if product_id = params.delete(:productId)
+ params.merge("ProductID.value" => product_id, "ProductID.type" => "Reference")
+ end
+
response = get_json_response(build_request_url('FindProducts', params))
if response.response.has_key?('Product')
response.results = response.response['Product']

0 comments on commit 2c3192d

Please sign in to comment.
Something went wrong with that request. Please try again.