rubyforgood / playtime

Supporting children and families experiencing homelessness in Washington, DC. Live app - https://wishlist.playtimeproject.org Organization Website:
http://www.playtimeproject.org/
MIT License
89 stars 52 forks source link

Add Amazon Product API "ItemLookup" endpoint #173

Closed leesharma closed 6 years ago

leesharma commented 6 years ago

Works towards #62 (part 1/3) Resolves #56 (bonus!)

Description

I broke #62 into three PRs for easier review: this is part 1.

This issue requires us to look up an Amazon item by its ASIN, so the first step is to add a new endpoint.

This PR starts with extracting the search-endpoint-specific logic out of the HTTPClient class and into a new ItemSearchEndpoint class. The HTTPClient is now responsible for routing between the different endpoints; each endpoint class is responsible for building/performing the actual queries.

This PR involves a lot of code duplication between endpoints; the next PR is focused on cleaning that up.

Type of change

How Has This Been Tested?

Specs are in spec/lib/amazon_product_api/*_endpoint_spec.rb, and the test suite is green.

Nothing else is needed to verify these changes.

leesharma commented 6 years ago

This is ready for review!

I updated this PR to match master and followed Chris's naming suggestions. As a bonus, one of the rubocop fixes resolved #56 (apostrophes broke the amazon search).

Sorry about all the churn here. Let me know if you've got any questions/comments!

leesharma commented 6 years ago

Hah, thanks, flattery's always appreciated. 🙂 I found a bug and pushed a new commit to fix it.

Since you hit "approve", I'm going to go ahead and self-merge. 😬