Method to get width, height, depth and weight from item. Bump gem version

This commit is contained in:
Dan Milne
2019-10-14 11:44:55 +11:00
parent b39134bec1
commit d27409f805
3 changed files with 24 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
## 0.0.6
- Handle more date parsing failures.
- Get width, height, depth and weight from items
## 0.0.5
- Merged pull request #3 allowing options to be passed into the get_items and get_variations request

View File

@@ -122,6 +122,26 @@ module Paapi
get(%w{ItemInfo TechnicalInfo Formats DisplayValues})
end
def height
data = get(%w{ItemInfo ProductInfo ItemDimensions Height})
[data.dig('DisplayValue'), data.dig('Unit')].join(' ')
end
def length
data = get(%w{ItemInfo ProductInfo ItemDimensions Length})
[data.dig('DisplayValue'), data.dig('Unit')].join(' ')
end
def width
data = get(%w{ItemInfo ProductInfo ItemDimensions Width})
[data.dig('DisplayValue'), data.dig('Unit')].join(' ')
end
def weight
data = get(%w{ItemInfo ProductInfo ItemDimensions Weight})
[data.dig('DisplayValue'), data.dig('Unit')].join(' ')
end
def kindle?
!package.nil? && package&.include?('Kindle eBook')
end

View File

@@ -1,3 +1,3 @@
module Paapi
VERSION = '0.0.5'
VERSION = '0.0.6'
end