Created
June 23, 2010 17:27
-
-
Save mcculloughsean/450249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def extract_location | |
# <addresses> | |
# <address addressId="1" phone="708-636-5911" address1="5043 West 111th St" address2="" city="Alsip" state="IL" zip="60803-6074" /> | |
# </addresses> | |
location = XPath.first @listing, '//address' | |
address_1 = location.attributes['address1'] | |
address_2 = location.attributes['address2'] | |
city = location.attributes['city'] | |
state = location.attributes['state'] | |
zip = location.attributes['zip'] | |
phone = location.attributes['phone'] | |
# <listing listingId="1821828028" advId="1261712" listingType="topPlacementListing" name="Bruno B's Sandwiches Pizza And Catering"> | |
name = @listing.attributes['name'] | |
@location = { | |
:name => name, | |
:address => address_1, | |
:city => city, | |
:state => state, | |
:zip => zip, | |
:phone => phone, | |
: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