Some more helpers

This commit is contained in:
Dan Milne
2019-10-03 15:14:40 +10:00
parent b09d895ff2
commit fa814046c8
2 changed files with 13 additions and 1 deletions

View File

@@ -105,6 +105,14 @@ module Paapi
get(%w{ItemInfo TechnicalInfo Formats DisplayValues})
end
def part_number
get(%w{ItemInfo ManufactureInfo ItemPartNumber})
end
def model
get(%w{ItemInfo ManufactureInfo Model})
end
def kindle?
!package.nil? && package&.include?('Kindle eBook')
end

View File

@@ -19,6 +19,10 @@ module Paapi
end
def result_count
@json.dig('SearchResult', 'TotalResultCount')
end
def snake_case(s)
return s.downcase if s.match(/\A[A-Z]+\z/)