top-travel-destinations-cli-gem 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c167184e079fd1edbb91337517f3c8ec5a99baa
|
4
|
+
data.tar.gz: 5f7a2196bc883f0422a2298fb3fabdd2ef5ec3af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66b494f86784d0793d87915df9cbd1d1450f1fbd86ff693baebcff99730e23be6d09e2644e5978c7792db28fdc3281aae927a609c034b86908d7ea9e09d6989e
|
7
|
+
data.tar.gz: 876d0613d1d69357a066d8bd20cb7fbdd501b57d184e25a3c7e089bbc65aad7172a0683b467c57b4b056d8061f2ad088b54e89a0097a0c9a1f51f505f902723a
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
35
35
|
|
36
36
|
## Contributing
|
37
37
|
|
38
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
38
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/agdavid/top-travel-destinations-cli-gem. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
39
39
|
|
40
40
|
|
41
41
|
## License
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class TopTravelDestinations::CLI
|
2
|
-
BASE_URL = "
|
2
|
+
BASE_URL = "https://www.tripadvisor.com/TravelersChoice-Destinations"
|
3
3
|
|
4
4
|
def call
|
5
5
|
welcome_screen
|
@@ -48,7 +48,7 @@ class TopTravelDestinations::CLI
|
|
48
48
|
while input != "exit"
|
49
49
|
puts "\n"
|
50
50
|
puts "Enter the number of the region for which you would like the Top Travel Destinations."
|
51
|
-
puts "Enter 'list' to see the regions again
|
51
|
+
puts "Enter 'list' to see the regions again OR type 'exit'."
|
52
52
|
input = gets.strip.downcase
|
53
53
|
if (1..TopTravelDestinations::Region.all.count).to_a.include?(input.to_i)
|
54
54
|
index_value = input.to_i-1
|
@@ -65,10 +65,12 @@ class TopTravelDestinations::CLI
|
|
65
65
|
end #end method
|
66
66
|
|
67
67
|
def show_top_destinations(index_value)
|
68
|
+
#refactored calling the specific region and set equal to local variable 'region_instance'
|
69
|
+
region_instance = TopTravelDestinations::Region.all[index_value]
|
68
70
|
puts "\n"
|
69
|
-
puts "The Top Destinations For the #{
|
71
|
+
puts "The Top Destinations For the #{region_instance.name} region are:"
|
70
72
|
counter = 1
|
71
|
-
|
73
|
+
region_instance.destinations.each do |destination|
|
72
74
|
puts "#{counter}. #{destination}"
|
73
75
|
counter +=1
|
74
76
|
end
|
@@ -6,12 +6,12 @@ class TopTravelDestinations::Scraper
|
|
6
6
|
|
7
7
|
region_array = []
|
8
8
|
|
9
|
-
doc.search("#tcRegions .tocContainer a").
|
9
|
+
doc.search("#tcRegions .tocContainer a").collect do |regionnode|
|
10
10
|
name = regionnode.text
|
11
11
|
sub_url = regionnode.attribute("href").value
|
12
12
|
region_array << {
|
13
13
|
:name => name,
|
14
|
-
:region_url => "
|
14
|
+
:region_url => "https://www.tripadvisor.com#{sub_url}"
|
15
15
|
}
|
16
16
|
end #end iterator
|
17
17
|
region_array
|
@@ -23,11 +23,11 @@ class TopTravelDestinations::Scraper
|
|
23
23
|
|
24
24
|
destinations_array = []
|
25
25
|
|
26
|
-
doc.search("div.winnerName div.mainName a").
|
26
|
+
doc.search("div.winnerName div.mainName a").collect do |destination|
|
27
27
|
name = destination.text
|
28
28
|
destinations_array << name
|
29
29
|
end#end iterator
|
30
30
|
destinations_array
|
31
|
-
end
|
31
|
+
end#end method
|
32
32
|
|
33
33
|
end #end Class
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: top-travel-destinations-cli-gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antonio David
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- lib/top_travel_destinations/region.rb
|
102
102
|
- lib/top_travel_destinations/scraper.rb
|
103
103
|
- lib/top_travel_destinations/version.rb
|
104
|
+
- top-travel-destinations-cli-gem-1.0.0.gem
|
104
105
|
- top_travel_destinations.gemspec
|
105
106
|
homepage: https://github.com/agdavid/top-travel-destinations-cli-gem
|
106
107
|
licenses:
|