Class: Destinations::TravelDestinationsLists

Inherits:
Object
  • Object
show all
Defined in:
lib/destinations/travel_destinations.rb

Class Method Summary collapse

Class Method Details

.puts_citiesObject



35
36
37
38
39
# File 'lib/destinations/travel_destinations.rb', line 35

def self.puts_cities
  self.scrape_cities.css(".marketing-article__header h1").each do |lists|
    puts lists.text
  end
end

.puts_countriesObject



29
30
31
32
33
# File 'lib/destinations/travel_destinations.rb', line 29

def self.puts_countries
  self.scrape_countries.css(".marketing-article__header h1").each do |lists|
    puts lists.text
  end
end

.puts_regionsObject



41
42
43
44
45
# File 'lib/destinations/travel_destinations.rb', line 41

def self.puts_regions
  self.scrape_regions.css(".marketing-article__header h1").each do |lists|
  puts lists.text
  end
end

.puts_valueObject



48
49
50
51
52
# File 'lib/destinations/travel_destinations.rb', line 48

def self.puts_value
  self.scrape_value.css(".marketing-article__header h1").each do |lists|
    puts lists.text
  end
end

.scrape_citiesObject



16
17
18
# File 'lib/destinations/travel_destinations.rb', line 16

def self.scrape_cities
   Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/cities")).css(".marketing-article")
end

.scrape_countriesObject



12
13
14
# File 'lib/destinations/travel_destinations.rb', line 12

def self.scrape_countries
  Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/countries")).css(".marketing-article")
end

.scrape_listObject



5
6
7
8
9
10
# File 'lib/destinations/travel_destinations.rb', line 5

def self.scrape_list
  Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/")).css("a.js-page-navigation-spot span").each_with_index do |list, index|
    puts "#{index+1}. #{list.text}"
  end
  puts "5. List of All Destinations"
end

.scrape_regionsObject



20
21
22
# File 'lib/destinations/travel_destinations.rb', line 20

def self.scrape_regions
  Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/regions")).css(".marketing-article")
end

.scrape_valueObject



24
25
26
# File 'lib/destinations/travel_destinations.rb', line 24

def self.scrape_value
  Nokogiri::HTML(open("https://www.lonelyplanet.com/best-in-travel/value")).css(".marketing-article")
end