def best_offer(quantity = 1)
      prices = []
      offers.each do |offer|
        p = offer.prices.select { |p| p[0] <= quantity }.last
        prices << { sku: offer.sku, price: p[1] } if p
      end
      best = prices.min_by { |p| p[:price] }
      offers.find { |offer| offer.sku == best[:sku] }
    end
def best_offer(quantity = 1)
      prices = []
      offers.each do |offer|
        p = offer.prices.select { |p| p[0] <= quantity }.last
        prices << { sku: offer.sku, price: p[1] } if p
      end
      best = prices.min_by { |p| p[:price] }
      offers.find { |offer| offer.sku == best[:sku] }
    end
Public: Returns the offer with the lowest price for the quantity
 requested

 Examples

   part = Octopart::Part.find(39619421)
   # => #<Octopart::Part >

   part.best_offer
   # => #<Hashie::Mash >

   part.best_offer.prices
   # => [[1, 14.67, "USD"], [10, 13.69, "USD"], [30, 12.84, "USD"]]