lib/rsqoot/deal.rb in rsqoot-0.2.2 vs lib/rsqoot/deal.rb in rsqoot-0.3.0

- old
+ new

@@ -7,24 +7,28 @@ # @param [String] location (Limit results to a particular area. We'll resolve whatever you pass us (including an IP address) to coordinates and search near there.) # @param [Integer] radius (Measured in miles. Defaults to 10.) # @param [Integer] page (Which page of result to return. Default to 1.) # @param [Integer] per_page (Number of results to return at once. Defaults to 10.) def deals(options={}) - get('deals', options) + if deals_not_latest?(options) + @rsqoot_deals = get('deals', options) || [] + @rsqoot_deals = @rsqoot_deals.deals.map(&:deal) if !@rsqoot_deals.empty? + end + @rsqoot_deals end # Retrieve a deal by id # def deal(id, options={}) - get("deals/#{id}", options) + if deal_not_latest?(id) + @rsqoot_deal = get("deals/#{id}", options) + @rsqoot_deal = @rsqoot_deal.deal if @rsqoot_deal + end + @rsqoot_deal end - def deal_click(id, options={}) - get("deals/#{id}/click", options, parse = false) - end - - def deal_impression(id, options={}) - get("deals/#{id}/image", options, parse = false) + def impression(deal_id, options={}) + url_generator("deals/#{deal_id}/image", options, require_key = true).first.to_s end end end \ No newline at end of file