Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

new methods for easier access of various fields

  • Loading branch information...
1 parent 45daee7 commit 38d86720a702c3a384e2e47ce68d6197b1771089 @jackdempsey committed
Showing with 21 additions and 0 deletions.
  1. +21 −0 lib/asin/item.rb
21 lib/asin/item.rb
@@ -16,9 +16,30 @@ def initialize(hash)
@raw =
+ def asin
+ @raw.ASIN
+ end
def title
+ def cents
+ price_container = @raw.ItemAttributes.ListPrice ||
+ @raw.OfferSummary.LowestUsedPrice
+ if amount = price_container.Amount
+ amount.to_i
+ end
+ end
+ def url
+ @raw.DetailPageURL
+ end
+ def description
+ (@raw.EditorialReviews.EditorialReview.Content rescue nil) ||
+ (@raw.ItemAttributes.Feature.join('.') rescue nil)
+ end

5 comments on commit 38d8672


i am currently working on a way to configure the item class in ASIN. if you are interested have a look at the latest commit



Awesome, that will definitely come in handy. I also started looking at using foo!.bar!.bam calls with Hashie so things don't blow up "no bar method on nil" if something doesn't quite work right.

Thanks, will come back to this in a bit and take a look at the new code when ready!


it would be great if you open a pull request, so that your commits can be merged into the project


I'd be happy to--I've just been working on this fork with my own needs in mind, and it seems that your recent changes are designed to help people do this sort of thing more on their, if there's a commit range you'd like to merge in, I'm happy to help make it happen!


exactly. i want to provide a simple way to exchange the returned result-classes for item and cart.

as i already stated, just open a pull request, i will cherypick the changes that make sense to me for general usage.

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