Class: NytJourneys::Data_Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/nyt_journeys/data_generator.rb

Constant Summary collapse

BASE_URL =
"http://www.nytimes.com/times-journeys/trip-type/"

Instance Method Summary collapse

Instance Method Details

#make_journeysObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/nyt_journeys/data_generator.rb', line 4

def make_journeys
  type_array = NytJourneys::Scraper.scrape_type_summary_page(BASE_URL)

  trip_array = type_array.collect do |type|
    NytJourneys::Scraper.scrape_type_detail_page(type)
  end
  trip_array.flatten!

  NytJourneys::Journeys.create_from_collection(trip_array)
end