Class: LonelyPlanetScrape::LonelyPlanetTours

Inherits:
Object
  • Object
show all
Defined in:
lib/taiwan_tours/lonelyplanet_scrap.rb

Direct Known Subclasses

LonelyPlanetToursTest

Constant Summary collapse

LONELYPLANET_URL =

Define constants needed for scraping Please if the test for uri fails replace contant manually

'http://www.lonelyplanet.com'
TOUR_RELATIVE_DIR =
'taiwan/tours'
TOUR_XPATH_CARD =
"//article[contains(@class,'card')]"
".//img[contains(@class,'card__figure__img')]/@src"
CARD_TITLE_XPATH =
'.//h1'
CARD_CONTENT_XPATH =
".//div[contains(@class,'card__content__desc')]//p"
".//div[contains(@class,'card__mask')]//a"
CARD_LOCATION_XPATH =
".//div[contains(@class,'card__footer__locale')]"
CARD_PRICE_CURRENCY_XPATH =
".//span[contains(@class,'js-currency')]"
CARD_PRICE_AMOUNT_XPATH =
".//span[contains(@class,'js-price')]"

Instance Method Summary collapse

Constructor Details

#initializeLonelyPlanetTours



22
23
24
# File 'lib/taiwan_tours/lonelyplanet_scrap.rb', line 22

def initialize
  parse_html
end

Instance Method Details

#toursObject



26
27
28
# File 'lib/taiwan_tours/lonelyplanet_scrap.rb', line 26

def tours
  @tours ||= extract_tours
end