Closed chibaye closed 7 years ago
i haven't used the search-bins functionality, so i don't have a real opinion on how to expose them via the gem.
the amazon api uses another result-element to return the bins (see xml example below), because of that they are not included what asin returns for search
calls.
maybe you can come up with idea or pseudo-code for how you would like to use them.
<?xml version="1.0" ?>
<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<OperationRequest>
<RequestId>2d1eadbc-62c6-4da0-8548-32c8594dfca8</RequestId>
<Arguments>
<Argument Name="AWSAccessKeyId" Value="AKIAIBNLWSCV5OXMPD6A"/>
<Argument Name="AssociateTag" Value="phoet-20"/>
<Argument Name="Keywords" Value="pants"/>
<Argument Name="Operation" Value="ItemSearch"/>
<Argument Name="ResponseGroup" Value="SearchBins"/>
<Argument Name="SearchIndex" Value="Baby"/>
<Argument Name="Service" Value="AWSECommerceService"/>
<Argument Name="Timestamp" Value="2016-01-20T14:02:00Z"/>
<Argument Name="Version" Value="2011-08-01"/>
<Argument Name="Signature" Value="YnYS6jkfYhrAuXuOuJL3UCXNB5y0cZ3dZaW15YRtjco="/>
</Arguments>
<RequestProcessingTime>0.3296750000000000</RequestProcessingTime>
</OperationRequest>
<Items>
<Request>
<IsValid>True</IsValid>
<ItemSearchRequest>
<Keywords>pants</Keywords>
<ResponseGroup>SearchBins</ResponseGroup>
<SearchIndex>Baby</SearchIndex>
</ItemSearchRequest>
</Request>
<TotalResults>46864</TotalResults>
<TotalPages>4687</TotalPages>
<MoreSearchResultsUrl>http://www.amazon.com/gp/redirect.html?linkCode=xm2&SubscriptionId=AKIAIBNLWSCV5OXMPD6A&location=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fsearch%3Fkeywords%3Dpants%26url%3Dsearch-alias%253Dbaby-products&tag=phoet-20&creative=386001&camp=2025</MoreSearchResultsUrl>
<Item>
<ASIN>B016YZGI5K</ASIN>
<ParentASIN>B00UZRKZTE</ParentASIN>
</Item>
<Item>
<ASIN>B00XZ19MS2</ASIN>
<ParentASIN>B00YFD0SGE</ParentASIN>
</Item>
<Item>
<ASIN>B0133JD07Y</ASIN>
<ParentASIN>B0133JAE8W</ParentASIN>
</Item>
<Item>
<ASIN>B012TV6920</ASIN>
<ParentASIN>B00JABR8KA</ParentASIN>
</Item>
<Item>
<ASIN>B00PZVDFDI</ASIN>
<ParentASIN>B00PZVCI8Q</ParentASIN>
</Item>
<Item>
<ASIN>B017NT1UQ8</ASIN>
<ParentASIN>B017NT1F72</ParentASIN>
</Item>
<Item>
<ASIN>B017NT1U6S</ASIN>
<ParentASIN>B017NT1FCC</ParentASIN>
</Item>
<Item>
<ASIN>B017NT2314</ASIN>
<ParentASIN>B017NT1HBG</ParentASIN>
</Item>
<Item>
<ASIN>B017NT1U40</ASIN>
<ParentASIN>B017NT1F4A</ParentASIN>
</Item>
<Item>
<ASIN>B017NT234G</ASIN>
<ParentASIN>B017NT1HH0</ParentASIN>
</Item>
<SearchBinSets>
<SearchBinSet NarrowBy="Subject">
<Bin>
<BinName>Potty Training</BinName>
<BinItemCount>2385</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>166887011</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Diapering</BinName>
<BinItemCount>1703</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>166764011</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Bathing & Skin Care</BinName>
<BinItemCount>967</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>166736011</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Baby & Toddler Toys</BinName>
<BinItemCount>1172</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>196601011</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Car Seats & Accessories</BinName>
<BinItemCount>21</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>166835011</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Nursery</BinName>
<BinItemCount>251</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>695338011</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Health & Baby Care</BinName>
<BinItemCount>144</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>166856011</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Gear</BinName>
<BinItemCount>24</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>166828011</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Feeding</BinName>
<BinItemCount>278</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>166777011</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Gifts</BinName>
<BinItemCount>5354</BinItemCount>
<BinParameter>
<Name>BrowseNode</Name>
<Value>239226011</Value>
</BinParameter>
</Bin>
</SearchBinSet>
<SearchBinSet NarrowBy="BrandName">
<Bin>
<BinName>Luvable Friends</BinName>
<BinItemCount>68</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>Luvable Friends</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Carter's</BinName>
<BinItemCount>3755</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>Carter's</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Gerber</BinName>
<BinItemCount>177</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>Gerber</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Disney</BinName>
<BinItemCount>939</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>Disney</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Handcraft</BinName>
<BinItemCount>1</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>Handcraft</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Nickelodeon</BinName>
<BinItemCount>162</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>Nickelodeon</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Gerber Graduates</BinName>
<BinItemCount>12</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>Gerber Graduates</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Betty Boop</BinName>
<BinItemCount>1</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>Betty Boop</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>The Children's Place</BinName>
<BinItemCount>178</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>The Children's Place</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>Pampers</BinName>
<BinItemCount>53</BinItemCount>
<BinParameter>
<Name>Brand</Name>
<Value>Pampers</Value>
</BinParameter>
</Bin>
</SearchBinSet>
<SearchBinSet NarrowBy="PriceRange">
<Bin>
<BinName>Under $25</BinName>
<BinItemCount>24744</BinItemCount>
<BinParameter>
<Name>MaximumPrice</Name>
<Value>2500</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>$25 to $50</BinName>
<BinItemCount>14307</BinItemCount>
<BinParameter>
<Name>MinimumPrice</Name>
<Value>2500</Value>
</BinParameter>
<BinParameter>
<Name>MaximumPrice</Name>
<Value>5000</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>$50 to $100</BinName>
<BinItemCount>6411</BinItemCount>
<BinParameter>
<Name>MinimumPrice</Name>
<Value>5000</Value>
</BinParameter>
<BinParameter>
<Name>MaximumPrice</Name>
<Value>10000</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>$100 to $200</BinName>
<BinItemCount>1158</BinItemCount>
<BinParameter>
<Name>MinimumPrice</Name>
<Value>10000</Value>
</BinParameter>
<BinParameter>
<Name>MaximumPrice</Name>
<Value>20000</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>$200 & Above</BinName>
<BinItemCount>427</BinItemCount>
<BinParameter>
<Name>MinimumPrice</Name>
<Value>20000</Value>
</BinParameter>
</Bin>
</SearchBinSet>
<SearchBinSet NarrowBy="PercentageOff">
<Bin>
<BinName>10% Off or More</BinName>
<BinItemCount>28397</BinItemCount>
<BinParameter>
<Name>MinPercentageOff</Name>
<Value>10</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>25% Off or More</BinName>
<BinItemCount>25503</BinItemCount>
<BinParameter>
<Name>MinPercentageOff</Name>
<Value>25</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>50% Off or More</BinName>
<BinItemCount>7833</BinItemCount>
<BinParameter>
<Name>MinPercentageOff</Name>
<Value>50</Value>
</BinParameter>
</Bin>
<Bin>
<BinName>70% Off or More</BinName>
<BinItemCount>2000</BinItemCount>
<BinParameter>
<Name>MinPercentageOff</Name>
<Value>70</Value>
</BinParameter>
</Bin>
</SearchBinSet>
</SearchBinSets>
</Items>
</ItemSearchResponse>
No just thought I let you know. Great work on the Gem by the way.
@welpre thx. in case you want to provide a pull-request or have any other feedback, please feel free to open another issue.
I like the ASIN gem return a ruby object which saves me the trouble of having to create my ow parser. also makes it easy to loop though the attributes, in situations were I want to display a list of product variants. But displaying a list of brands is difficult without Search Bins. The Vacuum gem does return search bins, maybe you should have a look at the code to see how they did it. Once again good work.
@welpre i don't think that i can make time to implement this at the moment. if you want to open a pull request, please go ahead and try to implement it yourself.
Adding SearchBins Response Group return only ASINS and PARENT_ASINS but not Search Bins.
For example request: @search = @client.search SearchIndex: :Baby, Keywords: 'pants', ResponseGroup: :SearchBins
Response: [{"asin":"B016YZGI5K","parent_asin":"B00UZRKZTE"},{"asin":"B00XZ19MS2","parent_asin":"B00YFD0SGE"},{"asin":"B0133JD07Y","parent_asin":"B0133JAE8W"},{"asin":"B017NT1UFY","parent_asin":"B017NT1F4A"},{"asin":"B00PZVDFDI","parent_asin":"B00PZVCI8Q"},{"asin":"B012TV6920","parent_asin":"B00JABR8KA"},{"asin":"B017NT234G","parent_asin":"B017NT1HH0"},{"asin":"B017NT1U6S","parent_asin":"B017NT1FCC"},{"asin":"B0133JEGO0","parent_asin":"B00LAYTVJQ"},{"asin":"B012U6XCV0","parent_asin":"B00JABR8LO"}]