Skip to content

Instantly share code, notes, and snippets.

@mcculloughsean
Created June 23, 2010 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcculloughsean/450234 to your computer and use it in GitHub Desktop.
Save mcculloughsean/450234 to your computer and use it in GitHub Desktop.
title = XPath.first( coupon, '//property[@type="Offer"]' ).text
copy = XPath.first( coupon, '//property[@type="Restrictions"]' )
copy = copy.nil? ? 'Special offer' : copy.text
expiration = XPath.first( coupon, '//property[@type="Expiration"]' )
expiration = expiration.nil? ? 1.month.from_now : Time.parse( expiration.text )
@coupon = {
:title => title,
:copy => copy,
:to_date => expiration,
:from_date => 1.month.ago,
:source_id => listing_id,
:advertiser_id => Advertiser.find_by_email(SITE_CONFIG['yellow_book_advertiser_email']).id
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment