taiwan_tours 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,38 @@
1
+ require 'minitest/autorun'
2
+ # require 'minitest/rg'
3
+ require 'oga'
4
+ require 'open-uri'
5
+ require 'yaml'
6
+ require 'json'
7
+ require 'vcr'
8
+ require 'webmock/minitest'
9
+ require './lib/taiwan_tours/lonelyplanet_scrap'
10
+ require './spec/support/vcr_setup'
11
+
12
+ tours_from_file = YAML.load(File.read('./spec/tours.yml'))
13
+
14
+ VCR.use_cassette('taiwan_tours') do
15
+ obj = LonelyPlanetScrape::LonelyPlanetTours.new
16
+ tours_found = JSON.parse(obj.tours) if !obj.tours.nil?
17
+
18
+ describe 'Check for difference between returned results and actual data and possibly HTML structure changes' do
19
+
20
+ it 'check if the number of taiwan tours has changed' do
21
+ tours_found.size.must_equal tours_from_file.size
22
+ end
23
+
24
+ 0.upto(tours_from_file.length - 1) do |index|
25
+ it 'check for price changes' do
26
+ tours_from_file[index]['price'].must_equal tours_found[index]['price']
27
+ end
28
+
29
+ it 'check for title changes' do
30
+ tours_from_file[index]['title'].must_equal tours_found[index]['title']
31
+ end
32
+
33
+ it 'check for description changes' do
34
+ tours_from_file[index]['content'].must_equal tours_found[index]['content']
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,4 @@
1
+ VCR.configure do |config|
2
+ config.cassette_library_dir = './spec/fixtures/vcr_cassettes'
3
+ config.hook_into :webmock
4
+ end
data/spec/tours.yml ADDED
@@ -0,0 +1,116 @@
1
+ ---
2
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/3071/SITours/5-day-best-of-taiwan-tour-from-taipei-sun-moon-lake-taroko-gorge-in-taipei-118569.jpg
3
+ title: '5-Day Best of Taiwan Tour from Taipei: Sun Moon Lake, Taroko Gorge, Kaohsiung
4
+ and Taitung'
5
+ content: This 5-day Taiwan tour will take you around the whole island, opening your
6
+ eyes to the country’s diverse, astounding beauty and culture...
7
+ location: Taiwan
8
+ price_currency: "$"
9
+ price: '582'
10
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/3071/SITours/4-day-taiwan-tour-from-taipei-sun-moon-lake-taroko-gorge-kenting-in-taipei-119083.jpg
11
+ title: '4-Day Taiwan Tour from Taipei: Sun Moon Lake, Taroko Gorge, Kenting National
12
+ Park and Hualien'
13
+ content: Enjoy an amazing 4-day experience of Taiwan on this tour from Taipei...
14
+ location: Taiwan
15
+ price_currency: "$"
16
+ price: '608'
17
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/3071/SITours/4-day-tour-of-central-and-southern-taiwan-from-taipei-including-in-taipei-118283.jpg
18
+ title: 4-Day Tour of Central and Southern Taiwan from Taipei Including Kaohsiung
19
+ and Sun Moon Lake
20
+ content: Explore central and southern Taiwan and discover the beautiful countryside
21
+ scenery on this 4-day tour from Taipei...
22
+ location: Taiwan
23
+ price_currency: "$"
24
+ price: '483'
25
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/3071/SITours/3-day-tour-of-sun-moon-lake-puli-lukang-and-alishan-national-scenic-in-taipei-115196.jpg
26
+ title: 3-Day Tour of Sun Moon Lake, Puli, Lukang and Alishan National Scenic Area
27
+ from Taipei
28
+ content: Explore Taiwan’s countryside and discover its beautiful scenery on this
29
+ 3-day tour from Taipei...
30
+ location: Taiwan
31
+ price_currency: "$"
32
+ price: '431'
33
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/3071/SITours/2-day-tour-of-sun-moon-lake-puli-and-lukang-from-taipei-in-taipei-113098.jpg
34
+ title: 2-Day Tour of Sun Moon Lake, Puli and Lukang from Taipei
35
+ content: Enjoy the sights of Taiwan’s must-see destinations on this bus tour from
36
+ Taipei. As you are comfortably seated inside a tour bus, listen to your guide’s
37
+ interesting stories about the sites you pass...
38
+ location: Taiwan
39
+ price_currency: "$"
40
+ price: '228'
41
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/3071/SITours/2-day-kenting-national-park-and-kaohsiung-city-tour-with-high-speed-in-taipei-113096.jpg
42
+ title: 2-Day Kenting National Park and Kaohsiung City Tour with High-Speed Train
43
+ Experience
44
+ content: See the best of southwestern Taiwan on this 2-day sightseeing bus tour
45
+ of Kaohsiung and Kenting National Park from Taipei. Your friendly, expert guide
46
+ will provide interesting commentary about all the places you pass...
47
+ location: Taiwan
48
+ price_currency: "$"
49
+ price: '362'
50
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/3071/SITours/private-5-day-best-of-taiwan-tour-from-taipei-sun-moon-lake-taroko-in-taipei-177311.jpg
51
+ title: 'Private 5-Day Best of Taiwan Tour from Taipei: Sun Moon Lake, Taroko Gorge,
52
+ Kaohsiung and Taitung'
53
+ content: Travel around the entirety of Taiwan on this private 5-day tour of the
54
+ island...
55
+ location: Taiwan
56
+ price_currency: "$"
57
+ price: '1099'
58
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/3071/SITours/3-day-atayal-culture-tour-of-wufeng-and-jianshi-township-from-taipei-in-taipei-196621.jpg
59
+ title: 3-Day Atayal Culture Tour of Wufeng and Jianshi Township From Taipei
60
+ content: Experiencing Taiwan’s Atayal culture by going to rural and indigenous areas...
61
+ location: Taiwan
62
+ price_currency: "$"
63
+ price: '1819'
64
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/3071/SITours/7-day-southern-and-eastern-coast-of-taiwan-tour-in-taipei-196629.jpg
65
+ title: 7-Day Southern and Eastern Coast of Taiwan Tour
66
+ content: Taiwan is a small, advanced island nation. Many of Taiwan’s indigenous
67
+ communities are located in somewhat remote areas, but all can be reached by paved
68
+ roads...
69
+ location: Taiwan
70
+ price_currency: "$"
71
+ price: '5000'
72
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/5972/SITours/2-day-private-taroko-gorge-trip-from-taipei-in-taipei-152903.jpg
73
+ title: 2-Day Private Taroko Gorge Trip from Taipei
74
+ content: Ride a train along Taiwan’s mountainous eastern coastline to Taroko Gorge
75
+ National Park and spend two days exploring Hualien County with a knowledgeable
76
+ private guide...
77
+ location: Taiwan
78
+ price_currency: "$"
79
+ price: '340'
80
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/5972/SITours/experience-beijing-opera-private-makeup-session-and-show-at-taipeieye-in-taipei-170230.jpg
81
+ title: 'Experience Beijing Opera: Private Makeup Session and Show at TaipeiEYE'
82
+ content: You'll feel like a Chinese opera star during this 2-hour session with a
83
+ professional makeup artist...
84
+ location: Taiwan
85
+ price_currency: "$"
86
+ price: '177'
87
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/5972/SITours/2-day-private-yilan-trip-from-taipei-in-taipei-156503.jpg
88
+ title: 2-Day Private Yilan Trip from Taipei
89
+ content: Experience the scenic farms, rustic walking paths and folk culture of Yilan,
90
+ one of the most breathtaking regions outside Taipei...
91
+ location: Taiwan
92
+ price_currency: "$"
93
+ price: '233'
94
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/6279/SITours/3-day-east-coast-and-hualien-tour-from-taipei-in-taipei-164762.jpg
95
+ title: 3-Day East Coast and Hualien Tour from Taipei
96
+ content: Experience the breathtaking beauty of Taiwan’s east coast on a 3-day small-group
97
+ tour from Taipei...
98
+ location: Taiwan
99
+ price_currency: "$"
100
+ price: '395'
101
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/6279/SITours/3-day-taroko-gorge-adventure-from-taipei-hiking-night-market-and-in-taipei-159737.jpg
102
+ title: '3-Day Taroko Gorge Adventure from Taipei: Hiking, Night Market and Shrimp
103
+ Fishing'
104
+ content: Experience the breathtaking beauty of Taroko Gorge, including guided day
105
+ hikes along the Shakadang Trail and the steep Jhuilu Old Trail...
106
+ location: Taiwan
107
+ price_currency: "$"
108
+ price: '395'
109
+ - img: http://cache-graphicslib.viator.com/graphicslib/thumbs674x446/7326/SITours/taiwan-5-day-cycling-escapade-tour-in-taipei-201712.jpg
110
+ title: Taiwan 5-Day Cycling Escapade Tour
111
+ content: What better way to explore Taiwan than on a stimulating bicycle ride? Join
112
+ us on this exuberant journey as we guide you along the beautiful terrains of the
113
+ eastern coastline...
114
+ location: Taiwan
115
+ price_currency: "$"
116
+ price: '2990'
@@ -0,0 +1,23 @@
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
+ require 'taiwan_tours/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'taiwan_tours'
6
+ s.version = LonelyPlanetScrape::VERSION
7
+ s.date = LonelyPlanetScrape::DATE
8
+ s.executables << 'taiwan_tours'
9
+ s.summary = 'The lonelyplanet web scraper service traverses details of Taiwan tour packages'
10
+ s.description = 'Get deatils of taiwan tours packages'
11
+ s.authors = ['Bayardo Salgado', 'Cesar Ordoñez','Eduardo Salazar','Nicole Weatherburne']
12
+ s.email = ['bayardo_salgado@yahoo.com','cesar','esalazar922@gmail.com','nikkiweat@gmail.com']
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files spec/*`.split("\n")
15
+ s.homepage = 'https://github.com/ZhongMeiZhou/scraper_project'
16
+ s.license = 'MIT'
17
+
18
+ s.add_development_dependency 'minitest'
19
+ s.add_development_dependency 'vcr'
20
+ s.add_development_dependency 'webmock'
21
+ s.add_runtime_dependency 'oga'
22
+ s.add_runtime_dependency 'json'
23
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: taiwan_tours
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bayardo Salgado
8
+ - Cesar Ordoñez
9
+ - Eduardo Salazar
10
+ - Nicole Weatherburne
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2015-10-16 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: minitest
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: vcr
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ - !ruby/object:Gem::Dependency
45
+ name: webmock
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ - !ruby/object:Gem::Dependency
59
+ name: oga
60
+ requirement: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ type: :runtime
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ - !ruby/object:Gem::Dependency
73
+ name: json
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ description: Get deatils of taiwan tours packages
87
+ email:
88
+ - bayardo_salgado@yahoo.com
89
+ - cesar
90
+ - esalazar922@gmail.com
91
+ - nikkiweat@gmail.com
92
+ executables:
93
+ - taiwan_tours
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - ".gitignore"
98
+ - ".travis.yml"
99
+ - Gemfile
100
+ - LICENSE.txt
101
+ - README.md
102
+ - Rakefile
103
+ - bin/taiwan_tours
104
+ - lib/.DS_Store
105
+ - lib/lonelyplanet_scrap_test.rb
106
+ - lib/taiwan_tours.rb
107
+ - lib/taiwan_tours/lonelyplanet_scrap.rb
108
+ - lib/taiwan_tours/version.rb
109
+ - spec/fixtures/vcr_cassettes/taiwan_tours.yml
110
+ - spec/lonelyplanet_spec.rb
111
+ - spec/support/vcr_setup.rb
112
+ - spec/tours.yml
113
+ - taiwan_tours.gemspec
114
+ homepage: https://github.com/ZhongMeiZhou/scraper_project
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.4.6
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: The lonelyplanet web scraper service traverses details of Taiwan tour packages
138
+ test_files:
139
+ - spec/fixtures/vcr_cassettes/taiwan_tours.yml
140
+ - spec/lonelyplanet_spec.rb
141
+ - spec/support/vcr_setup.rb
142
+ - spec/tours.yml