touringplans 0.2.8 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/lib/routes.yml +117 -0
- data/lib/touringplans/version.rb +1 -1
- data/lib/touringplans.rb +287 -122
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9faa64dfb3990694d6e1df2f3960204f06259b8a351a6c0b8f903cddecab837
|
4
|
+
data.tar.gz: 51cc48038a1a405813c10887afd48a95aa2a39511dfefbcf3b31188a4e5e3a25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a891f6f431e1f7eedd8296ad8b27f51e6245ad71d9c794ff84967b656b61d3bd280931b67a5e6dd91f8b07f2c7cdcc3feb2ecfecef8b29fe3fdd8cd17e31e7c6
|
7
|
+
data.tar.gz: e7db10e55f39302e8d882632891a9e073c807a150278f8ba06827c3e0cbc91187a563c423fae951125747a130323b397f5cd9c3e32c8f2d82c12a9bc17455ba1
|
data/.version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.6
|
data/lib/routes.yml
CHANGED
@@ -419,6 +419,9 @@ epcot_attractions_mission_space_orange:
|
|
419
419
|
epcot_attractions_reflections_of_china:
|
420
420
|
method: get
|
421
421
|
path: "/epcot/attractions/reflections-of-china.json"
|
422
|
+
epcot_attractions_remys_ratatouille_adventure:
|
423
|
+
method: get
|
424
|
+
path: "/epcot/attractions/remys-ratatouille-adventure.json"
|
422
425
|
epcot_attractions_the_seas_main_tank_and_exhibits:
|
423
426
|
method: get
|
424
427
|
path: "/epcot/attractions/the-seas-main-tank-and-exhibits.json"
|
@@ -800,3 +803,117 @@ hollywood_studios_dining_roundup_rodeo_bbq:
|
|
800
803
|
hollywood_studios_dining_scifi_dine_in_theater_restaurant:
|
801
804
|
method: get
|
802
805
|
path: "/hollywood-studios/dining/scifi-dine-in-theater-restaurant.json"
|
806
|
+
walt_disney_world_hotels_fort_wilderness_campsites:
|
807
|
+
method: get
|
808
|
+
path: "/walt-disney-world/hotels/fort-wilderness-campsites.json"
|
809
|
+
walt_disney_world_hotels_disneys_animal_kingdom_lodge:
|
810
|
+
method: get
|
811
|
+
path: "/walt-disney-world/hotels/disneys-animal-kingdom-lodge.json"
|
812
|
+
walt_disney_world_hotels_disneys_beach_club_resort:
|
813
|
+
method: get
|
814
|
+
path: "/walt-disney-world/hotels/disneys-beach-club-resort.json"
|
815
|
+
walt_disney_world_hotels_disneys_boardwalk_inn:
|
816
|
+
method: get
|
817
|
+
path: "/walt-disney-world/hotels/disneys-boardwalk-inn.json"
|
818
|
+
walt_disney_world_hotels_disneys_contemporary_resort:
|
819
|
+
method: get
|
820
|
+
path: "/walt-disney-world/hotels/disneys-contemporary-resort.json"
|
821
|
+
walt_disney_world_hotels_disneys_grand_floridian_resort:
|
822
|
+
method: get
|
823
|
+
path: "/walt-disney-world/hotels/disneys-grand-floridian-resort.json"
|
824
|
+
walt_disney_world_hotels_disneys_polynesian_resort:
|
825
|
+
method: get
|
826
|
+
path: "/walt-disney-world/hotels/disneys-polynesian-resort.json"
|
827
|
+
walt_disney_world_hotels_disneys_wilderness_lodge:
|
828
|
+
method: get
|
829
|
+
path: "/walt-disney-world/hotels/disneys-wilderness-lodge.json"
|
830
|
+
walt_disney_world_hotels_disneys_yacht_club_resort:
|
831
|
+
method: get
|
832
|
+
path: "/walt-disney-world/hotels/disneys-yacht-club-resort.json"
|
833
|
+
walt_disney_world_hotels_shades_of_green_at_walt_disney_world:
|
834
|
+
method: get
|
835
|
+
path: "/walt-disney-world/hotels/shades-of-green-at-walt-disney-world.json"
|
836
|
+
walt_disney_world_hotels_star_wars_galactic_starcruiser:
|
837
|
+
method: get
|
838
|
+
path: "/walt-disney-world/hotels/star-wars-galactic-starcruiser.json"
|
839
|
+
walt_disney_world_hotels_dolphin_at_walt_disney_world:
|
840
|
+
method: get
|
841
|
+
path: "/walt-disney-world/hotels/dolphin-at-walt-disney-world.json"
|
842
|
+
walt_disney_world_hotels_swan_at_walt_disney_world:
|
843
|
+
method: get
|
844
|
+
path: "/walt-disney-world/hotels/swan-at-walt-disney-world.json"
|
845
|
+
walt_disney_world_hotels_disney_world_swan_reserve:
|
846
|
+
method: get
|
847
|
+
path: "/walt-disney-world/hotels/disney-world-swan-reserve.json"
|
848
|
+
walt_disney_world_hotels_bay_lake_tower_at_disneys_contemporary_resort:
|
849
|
+
method: get
|
850
|
+
path: "/walt-disney-world/hotels/bay-lake-tower-at-disneys-contemporary-resort.json"
|
851
|
+
walt_disney_world_hotels_disneys_wilderness_lodge_villas:
|
852
|
+
method: get
|
853
|
+
path: "/walt-disney-world/hotels/disneys-wilderness-lodge-villas.json"
|
854
|
+
walt_disney_world_hotels_copper_creek_villas:
|
855
|
+
method: get
|
856
|
+
path: "/walt-disney-world/hotels/copper-creek-villas.json"
|
857
|
+
walt_disney_world_hotels_animal_kingdom_villas_jambo:
|
858
|
+
method: get
|
859
|
+
path: "/walt-disney-world/hotels/animal-kingdom-villas-jambo.json"
|
860
|
+
walt_disney_world_hotels_disneys_animal_kingdom_villas:
|
861
|
+
method: get
|
862
|
+
path: "/walt-disney-world/hotels/disneys-animal-kingdom-villas.json"
|
863
|
+
walt_disney_world_hotels_disneys_beach_club_villas:
|
864
|
+
method: get
|
865
|
+
path: "/walt-disney-world/hotels/disneys-beach-club-villas.json"
|
866
|
+
walt_disney_world_hotels_disneys_boardwalk_villas:
|
867
|
+
method: get
|
868
|
+
path: "/walt-disney-world/hotels/disneys-boardwalk-villas.json"
|
869
|
+
walt_disney_world_hotels_disneys_old_key_west_resort:
|
870
|
+
method: get
|
871
|
+
path: "/walt-disney-world/hotels/disneys-old-key-west-resort.json"
|
872
|
+
walt_disney_world_hotels_disneys_polynesian_villas_bungalows:
|
873
|
+
method: get
|
874
|
+
path: "/walt-disney-world/hotels/disneys-polynesian-villas-bungalows.json"
|
875
|
+
walt_disney_world_hotels_disneys_riviera_resort:
|
876
|
+
method: get
|
877
|
+
path: "/walt-disney-world/hotels/disneys-riviera-resort.json"
|
878
|
+
walt_disney_world_hotels_disneys_saratoga_springs_resort_spa:
|
879
|
+
method: get
|
880
|
+
path: "/walt-disney-world/hotels/disneys-saratoga-springs-resort-spa.json"
|
881
|
+
walt_disney_world_hotels_disney_reflections:
|
882
|
+
method: get
|
883
|
+
path: "/walt-disney-world/hotels/disney-reflections.json"
|
884
|
+
walt_disney_world_hotels_the_villas_at_disneys_grand_floridian_resort_and_spa:
|
885
|
+
method: get
|
886
|
+
path: "/walt-disney-world/hotels/the-villas-at-disneys-grand-floridian-resort-and-spa.json"
|
887
|
+
walt_disney_world_hotels_treehouse_villas_at_disneys_saratoga_springs_resort:
|
888
|
+
method: get
|
889
|
+
path: "/walt-disney-world/hotels/treehouse-villas-at-disneys-saratoga-springs-resort.json"
|
890
|
+
walt_disney_world_hotels_disneys_caribbean_beach_resort:
|
891
|
+
method: get
|
892
|
+
path: "/walt-disney-world/hotels/disneys-caribbean-beach-resort.json"
|
893
|
+
walt_disney_world_hotels_disneys_coronado_springs_resort:
|
894
|
+
method: get
|
895
|
+
path: "/walt-disney-world/hotels/disneys-coronado-springs-resort.json"
|
896
|
+
walt_disney_world_hotels_disneys_port_orleans_resort_french_quarter:
|
897
|
+
method: get
|
898
|
+
path: "/walt-disney-world/hotels/disneys-port-orleans-resort-french-quarter.json"
|
899
|
+
walt_disney_world_hotels_disneys_port_orleans_resort_riverside:
|
900
|
+
method: get
|
901
|
+
path: "/walt-disney-world/hotels/disneys-port-orleans-resort-riverside.json"
|
902
|
+
walt_disney_world_hotels_fort_wilderness_resort_cabins:
|
903
|
+
method: get
|
904
|
+
path: "/walt-disney-world/hotels/fort-wilderness-resort-cabins.json"
|
905
|
+
walt_disney_world_hotels_disneys_all_star_movies_resort:
|
906
|
+
method: get
|
907
|
+
path: "/walt-disney-world/hotels/disneys-all-star-movies-resort.json"
|
908
|
+
walt_disney_world_hotels_disneys_all_star_music_resort:
|
909
|
+
method: get
|
910
|
+
path: "/walt-disney-world/hotels/disneys-all-star-music-resort.json"
|
911
|
+
walt_disney_world_hotels_disneys_all_star_sports_resort:
|
912
|
+
method: get
|
913
|
+
path: "/walt-disney-world/hotels/disneys-all-star-sports-resort.json"
|
914
|
+
walt_disney_world_hotels_disneys_art_of_animation_resort:
|
915
|
+
method: get
|
916
|
+
path: "/walt-disney-world/hotels/disneys-art-of-animation-resort.json"
|
917
|
+
walt_disney_world_hotels_disneys_pop_century_resort:
|
918
|
+
method: get
|
919
|
+
path: "/walt-disney-world/hotels/disneys-pop-century-resort.json"
|
data/lib/touringplans/version.rb
CHANGED
data/lib/touringplans.rb
CHANGED
@@ -12,16 +12,6 @@ module Touringplans
|
|
12
12
|
include Dry.Types()
|
13
13
|
end
|
14
14
|
|
15
|
-
GEM_ROOT = File.expand_path("../", __FILE__)
|
16
|
-
|
17
|
-
include HTTParty
|
18
|
-
# currently Touring Plans has no verision in its API
|
19
|
-
DEFAULT_API_VERSION = "1"
|
20
|
-
DEFAULT_BASE_URI = "https://touringplans.com/"
|
21
|
-
DEFAULT_QUERY = {}
|
22
|
-
|
23
|
-
base_uri DEFAULT_BASE_URI
|
24
|
-
|
25
15
|
ROUTES = {
|
26
16
|
magic_kingdom_dining: {
|
27
17
|
method: "get",
|
@@ -82,13 +72,13 @@ module Touringplans
|
|
82
72
|
walt_disney_world_disney_springs_resorts: {
|
83
73
|
method: "get",
|
84
74
|
path: "/walt-disney-world/hotels.json"
|
85
|
-
}
|
86
|
-
}
|
75
|
+
}
|
76
|
+
}.freeze
|
87
77
|
|
88
78
|
def self.routes
|
89
79
|
ROUTES
|
90
80
|
end
|
91
|
-
|
81
|
+
|
92
82
|
# deals solely with how to create access to the resource, the lock of "lock & key"
|
93
83
|
class Connection
|
94
84
|
# concerned only on where it gets the info it needs
|
@@ -98,6 +88,7 @@ module Touringplans
|
|
98
88
|
# currently Touring Plans has no verision in its API
|
99
89
|
DEFAULT_API_VERSION = "1"
|
100
90
|
DEFAULT_BASE_URI = "https://touringplans.com/"
|
91
|
+
# do not freeze DEFAULT_QUERY
|
101
92
|
DEFAULT_QUERY = {}
|
102
93
|
|
103
94
|
base_uri DEFAULT_BASE_URI
|
@@ -160,12 +151,13 @@ module Touringplans
|
|
160
151
|
end
|
161
152
|
end
|
162
153
|
|
154
|
+
# Generates and updates routes for all types of venues in a YAML document.
|
163
155
|
class RoutesTable
|
164
|
-
require
|
165
|
-
def initialize(filename: "routes_table.yml")
|
166
|
-
@filename
|
156
|
+
require "fileutils"
|
157
|
+
def initialize(filename: "routes_table.yml")
|
158
|
+
@filename = filename
|
167
159
|
end
|
168
|
-
|
160
|
+
|
169
161
|
def self.original_routes
|
170
162
|
# this method exists so that we can create a yaml file of routes
|
171
163
|
tpr = Touringplans.routes
|
@@ -179,9 +171,9 @@ module Touringplans
|
|
179
171
|
# # create new hash with string keys
|
180
172
|
# string_keys.zip(rt_values).to_h
|
181
173
|
end
|
182
|
-
|
174
|
+
|
183
175
|
def self.symbolize_keys(hash)
|
184
|
-
hash.
|
176
|
+
hash.each_with_object({}) do |(key, value), result|
|
185
177
|
new_key = case key
|
186
178
|
when String then key.to_sym
|
187
179
|
else key
|
@@ -191,13 +183,12 @@ module Touringplans
|
|
191
183
|
else value
|
192
184
|
end
|
193
185
|
result[new_key] = new_value
|
194
|
-
|
195
|
-
}
|
186
|
+
end
|
196
187
|
end
|
197
188
|
|
198
189
|
def self.stringify_keys(hash)
|
199
190
|
# inspired by https://avdi.codes/recursively-symbolize-keys/
|
200
|
-
hash.
|
191
|
+
hash.each_with_object({}) do |(key, value), result|
|
201
192
|
new_key = case key
|
202
193
|
when Symbol then key.to_s
|
203
194
|
else key
|
@@ -207,25 +198,20 @@ module Touringplans
|
|
207
198
|
else value
|
208
199
|
end
|
209
200
|
result[new_key] = new_value
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
tp_path.pop
|
218
|
-
tp_path = tp_path.join("/")
|
219
|
-
routes_file = "#{tp_path}#{routes_relative_file_path}"
|
220
|
-
YAML.load(File.read(routes_file))
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def self.load_routes_file(routes_relative_file_path: "/routes.yml")
|
205
|
+
tp_path = $LOAD_PATH.grep(/touringplans/).last
|
206
|
+
routes_file = "#{tp_path}#{routes_relative_file_path}"
|
207
|
+
YAML.safe_load(File.read(routes_file))
|
221
208
|
end
|
222
|
-
|
223
|
-
|
209
|
+
|
224
210
|
def self.update_file
|
225
211
|
# gather info into hashes
|
226
212
|
attractions_routes = _generate_interest_routes_hash("attractions")
|
227
213
|
dining_routes = _generate_interest_routes_hash("dining")
|
228
|
-
hotels_routes =
|
214
|
+
hotels_routes = _generate_interest_routes_hash("hotels")
|
229
215
|
updated_routes = original_routes.merge(attractions_routes, dining_routes, hotels_routes)
|
230
216
|
|
231
217
|
updated_routes_yaml = _convert_hash_to_yaml(updated_routes)
|
@@ -236,12 +222,13 @@ module Touringplans
|
|
236
222
|
|
237
223
|
def self._initialize_file
|
238
224
|
# delete old file if it exits
|
239
|
-
lib_dir
|
225
|
+
lib_dir = FileUtils.getwd + "/lib"
|
240
226
|
routes_file = "#{lib_dir}/routes.yml"
|
241
227
|
|
242
228
|
# ensure the file exists
|
243
229
|
touched_routes_file_array = FileUtils.touch(routes_file)
|
244
|
-
|
230
|
+
# we want the first string value
|
231
|
+
touched_routes_file_array.first
|
245
232
|
end
|
246
233
|
|
247
234
|
def self._generate_interest_routes_hash(interest)
|
@@ -249,7 +236,7 @@ module Touringplans
|
|
249
236
|
interest_routes = {}
|
250
237
|
|
251
238
|
interest_venues.each do |iv|
|
252
|
-
new_route =
|
239
|
+
new_route = _generate_interest_route(iv.venue_permalink, interest, iv.permalink)
|
253
240
|
key = new_route.keys.first
|
254
241
|
values = new_route[key]
|
255
242
|
interest_routes[key] = values
|
@@ -257,7 +244,7 @@ module Touringplans
|
|
257
244
|
|
258
245
|
interest_routes
|
259
246
|
end
|
260
|
-
|
247
|
+
|
261
248
|
def self._generate_interest_route(venue_permalink, interest_permalink, place_permalink)
|
262
249
|
# {magic_kingdom_attractions_haunted_mansion: {
|
263
250
|
# method: "get",
|
@@ -270,12 +257,8 @@ module Touringplans
|
|
270
257
|
method = "get"
|
271
258
|
format = "json"
|
272
259
|
|
273
|
-
|
274
|
-
|
275
|
-
}
|
276
|
-
}
|
277
|
-
|
278
|
-
hash
|
260
|
+
{ key => { "method".to_s => method,
|
261
|
+
"path".to_s => "#{path}.#{format}" } }
|
279
262
|
end
|
280
263
|
|
281
264
|
def self._convert_hash_to_yaml(hash)
|
@@ -287,13 +270,13 @@ module Touringplans
|
|
287
270
|
new_file.write(content)
|
288
271
|
new_file.close
|
289
272
|
end
|
290
|
-
|
273
|
+
|
291
274
|
def self._read_file_to_terminal(file)
|
292
275
|
new_file = File.open(file, "r")
|
293
276
|
new_file.close
|
294
277
|
end
|
295
|
-
|
296
278
|
end
|
279
|
+
|
297
280
|
# model with the attributes
|
298
281
|
class CounterServiceLocation < Dry::Struct
|
299
282
|
transform_keys(&:to_sym)
|
@@ -353,7 +336,7 @@ module Touringplans
|
|
353
336
|
attribute :kosher_available, Types::Params::Bool
|
354
337
|
attribute :dinable_id, Types::Params::Integer
|
355
338
|
attribute :dinable_type, Types::String.optional
|
356
|
-
attribute :venue_permalink, Types::String.optional
|
339
|
+
attribute :venue_permalink, Types::String.optional
|
357
340
|
end
|
358
341
|
|
359
342
|
# model with the attributes
|
@@ -386,11 +369,11 @@ module Touringplans
|
|
386
369
|
attribute :house_specialties, Types::String.optional
|
387
370
|
attribute :counter_quality_rating, Types::String.optional
|
388
371
|
attribute :counter_value_rating, Types::String.optional
|
389
|
-
attribute :table_quality_rating, Types::Params::
|
390
|
-
attribute :table_value_rating, Types::Params::
|
391
|
-
attribute :overall_rating, Types::Params::
|
392
|
-
attribute :service_rating, Types::Params::
|
393
|
-
attribute :friendliness_rating, Types::Params::
|
372
|
+
attribute :table_quality_rating, Types::Params::Float.optional
|
373
|
+
attribute :table_value_rating, Types::Params::Float.optional
|
374
|
+
attribute :overall_rating, Types::Params::Float.optional
|
375
|
+
attribute :service_rating, Types::Params::Float.optional
|
376
|
+
attribute :friendliness_rating, Types::Params::Float.optional
|
394
377
|
attribute :adult_breakfast_menu_url, Types::String.optional
|
395
378
|
attribute :adult_lunch_menu_url, Types::String.optional
|
396
379
|
attribute :adult_dinner_menu_url, Types::String.optional
|
@@ -418,6 +401,69 @@ module Touringplans
|
|
418
401
|
attribute :venue_permalink, Types::String.optional
|
419
402
|
end
|
420
403
|
|
404
|
+
# model with the attributes
|
405
|
+
class DiningVenueFull < Dry::Struct
|
406
|
+
transform_keys(&:to_sym)
|
407
|
+
|
408
|
+
attribute :name, Types::String
|
409
|
+
attribute :permalink, Types::String
|
410
|
+
attribute :category_code, Types::String
|
411
|
+
attribute :portion_size, Types::String.optional
|
412
|
+
attribute :cost_code, Types::String.optional
|
413
|
+
attribute :cuisine, Types::String
|
414
|
+
attribute :phone_number, Types::String.optional
|
415
|
+
attribute :entree_range, Types::String.optional
|
416
|
+
attribute :when_to_go, Types::String.optional
|
417
|
+
attribute :parking, Types::String.optional
|
418
|
+
attribute :bar, Types::String.optional
|
419
|
+
attribute :wine_list, Types::String.optional
|
420
|
+
attribute :dress, Types::String.optional
|
421
|
+
attribute :awards, Types::String.optional
|
422
|
+
attribute :breakfast_hours, Types::String.optional
|
423
|
+
attribute :lunch_hours, Types::String.optional
|
424
|
+
attribute :dinner_hours, Types::String.optional
|
425
|
+
attribute :house_specialties, Types::String.optional
|
426
|
+
attribute :counter_quality_rating, Types::String.optional
|
427
|
+
attribute :counter_value_rating, Types::String.optional
|
428
|
+
attribute :table_quality_rating, Types::Float.optional
|
429
|
+
attribute :table_value_rating, Types::Float.optional
|
430
|
+
attribute :overall_rating, Types::Float.optional
|
431
|
+
attribute :service_rating, Types::Float.optional
|
432
|
+
attribute :friendliness_rating, Types::Float.optional
|
433
|
+
attribute :adult_breakfast_menu_url, Types::String.optional
|
434
|
+
attribute :adult_lunch_menu_url, Types::String.optional
|
435
|
+
attribute :adult_dinner_menu_url, Types::String.optional
|
436
|
+
attribute :child_breakfast_menu_url, Types::String.optional
|
437
|
+
attribute :child_lunch_menu_url, Types::String.optional
|
438
|
+
attribute :child_dinner_menu_url, Types::String.optional
|
439
|
+
attribute :requires_credit_card, Types::Params::Bool
|
440
|
+
attribute :requires_pre_payment, Types::Params::Bool
|
441
|
+
attribute :created_at, Types::Params::DateTime
|
442
|
+
attribute :updated_at, Types::Params::DateTime
|
443
|
+
attribute :extinct_on, Types::Params::DateTime.optional
|
444
|
+
attribute :opened_on, Types::Params::DateTime.optional
|
445
|
+
attribute :disney_permalink, Types::String.optional
|
446
|
+
attribute :code, Types::String.optional
|
447
|
+
attribute :short_name, Types::String.optional
|
448
|
+
attribute :accepts_reservations, Types::Params::Bool
|
449
|
+
attribute :kosher_available, Types::Params::Bool
|
450
|
+
attribute :operator_id, Types::Coercible::Integer.optional
|
451
|
+
attribute :operator_url, Types::String.optional
|
452
|
+
attribute :operator_type, Types::String.optional
|
453
|
+
attribute :walking_time_proxy_id, Types::Integer.optional
|
454
|
+
attribute :sort_name, Types::String.optional
|
455
|
+
attribute :mobile_ordering, Types::Bool.optional
|
456
|
+
attribute :extinct_on_uncertain, Types::String.optional
|
457
|
+
attribute :opened_on_uncertain, Types::String.optional
|
458
|
+
attribute :opened_on_known, Types::String.optional
|
459
|
+
attribute :operational_notes, Types::String.optional
|
460
|
+
attribute :latitude, Types::String.optional
|
461
|
+
attribute :longitude, Types::String.optional
|
462
|
+
attribute :summary_at_top, Types::Bool.optional
|
463
|
+
|
464
|
+
end
|
465
|
+
|
466
|
+
|
421
467
|
# model with the attributes
|
422
468
|
class ParkAttraction < Dry::Struct
|
423
469
|
transform_keys(&:to_sym)
|
@@ -426,7 +472,91 @@ module Touringplans
|
|
426
472
|
attribute :short_name, Types::String
|
427
473
|
attribute :permalink, Types::String
|
428
474
|
attribute :venue_permalink, Types::String
|
429
|
-
|
475
|
+
end
|
476
|
+
|
477
|
+
# model with the attributes
|
478
|
+
class ParkAttractionFull < Dry::Struct
|
479
|
+
transform_keys(&:to_sym)
|
480
|
+
|
481
|
+
attribute :name, Types::String
|
482
|
+
attribute :fastpass_booth, Types::Bool
|
483
|
+
attribute :short_name, Types::String.optional
|
484
|
+
attribute :created_at, Types::Params::DateTime
|
485
|
+
attribute :updated_at, Types::Params::DateTime
|
486
|
+
attribute :open_emh_morning, Types::Bool
|
487
|
+
attribute :open_emh_evening, Types::Bool
|
488
|
+
attribute :single_rider, Types::Bool
|
489
|
+
attribute :time_zone, Types::String.optional
|
490
|
+
attribute :seasonal, Types::Bool
|
491
|
+
attribute :open_very_merry, Types::Bool
|
492
|
+
attribute :open_not_so_scary, Types::Bool
|
493
|
+
attribute :category_code, Types::String.optional
|
494
|
+
attribute :duration, Types::Float.optional
|
495
|
+
attribute :scheduled_code, Types::String.optional
|
496
|
+
attribute :what_it_is, Types::String.optional
|
497
|
+
attribute :scope_and_scale_code, Types::String.optional
|
498
|
+
attribute :when_to_go, Types::String.optional
|
499
|
+
attribute :average_wait_per_hundred, Types::Float.optional
|
500
|
+
attribute :average_wait_assumes, Types::String.optional
|
501
|
+
attribute :loading_speed, Types::String.optional
|
502
|
+
attribute :probable_wait_time, Types::String.optional
|
503
|
+
attribute :special_needs, Types::String.optional
|
504
|
+
attribute :height_restriction, Types::Coercible::Integer.optional
|
505
|
+
attribute :intense, Types::Bool
|
506
|
+
attribute :extinct_on, Types::Params::DateTime.optional
|
507
|
+
attribute :opened_on, Types::Params::DateTime.optional
|
508
|
+
attribute :frightening, Types::Bool
|
509
|
+
attribute :physical_considerations, Types::Bool
|
510
|
+
attribute :handheld_captioning, Types::Bool
|
511
|
+
attribute :video_captioning, Types::Bool
|
512
|
+
attribute :reflective_captioning, Types::Bool
|
513
|
+
attribute :assistive_listening, Types::Bool
|
514
|
+
attribute :audio_description, Types::Bool
|
515
|
+
attribute :wheelchair_transfer_code, Types::String.optional
|
516
|
+
attribute :no_service_animals, Types::Bool
|
517
|
+
attribute :sign_language, Types::Bool
|
518
|
+
attribute :service_animal_check, Types::Bool
|
519
|
+
attribute :not_to_be_missed, Types::Bool
|
520
|
+
attribute :rider_swap, Types::Bool
|
521
|
+
attribute :ultimate_code, Types::String.optional
|
522
|
+
attribute :ultimate_task, Types::String.optional
|
523
|
+
attribute :park_entrance, Types::Bool
|
524
|
+
# attribute :relative_open, Types::Float.optional
|
525
|
+
# attribute :relative_close, Types::Bool.optional
|
526
|
+
attribute :close_at_dusk, Types::Bool.optional
|
527
|
+
attribute :crowd_calendar_version, Types::Integer
|
528
|
+
attribute :match_name, Types::String.optional
|
529
|
+
attribute :crazy_threshold, Types::Integer.optional
|
530
|
+
attribute :fastpass_only, Types::Bool
|
531
|
+
attribute :allow_showtimes_after_close, Types::Bool
|
532
|
+
attribute :disconnected_fastpass_booth, Types::Bool
|
533
|
+
attribute :arrive_before, Types::Integer.optional
|
534
|
+
attribute :arrive_before_fp, Types::Integer.optional
|
535
|
+
attribute :allow_time_restriction, Types::Bool
|
536
|
+
attribute :relative_open_to_sunset, Types::Integer.optional
|
537
|
+
attribute :relative_close_to_sunset, Types::Integer.optional
|
538
|
+
attribute :closing_round_code, Types::String.optional
|
539
|
+
attribute :walking_time_proxy_id, Types::Integer.optional
|
540
|
+
# attribute :flexible_duration, Types::Bool
|
541
|
+
attribute :operator_id, Types::Coercible::Integer.optional
|
542
|
+
attribute :operator_type, Types::String.optional
|
543
|
+
attribute :hide_app, Types::Bool
|
544
|
+
attribute :showtime_proxy_id, Types::Integer.optional
|
545
|
+
attribute :sort_name, Types::String
|
546
|
+
attribute :extinct_on_uncertain, Types::Bool.optional
|
547
|
+
attribute :opened_on_uncertain, Types::Bool.optional
|
548
|
+
attribute :ignore_scrapes, Types::Bool.optional
|
549
|
+
attribute :extra_cost, Types::Bool
|
550
|
+
attribute :climate_controlled, Types::Bool
|
551
|
+
attribute :wet, Types::Bool.optional
|
552
|
+
attribute :operational_notes, Types::String.optional
|
553
|
+
# attribute :masthead_circle_x, Types::Integer
|
554
|
+
# attribute :masthead_circle_y, Types::Integer
|
555
|
+
attribute :latitude, Types::String.optional
|
556
|
+
attribute :longitude, Types::String.optional
|
557
|
+
attribute :open_early, Types::Bool
|
558
|
+
attribute :themeparks_id, Types::String.optional
|
559
|
+
attribute :has_virtual_queue, Types::Bool
|
430
560
|
end
|
431
561
|
|
432
562
|
# model with the attributes
|
@@ -440,49 +570,78 @@ module Touringplans
|
|
440
570
|
attribute :venue_permalink, Types::String.optional
|
441
571
|
end
|
442
572
|
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
573
|
+
# model with the attributes
|
574
|
+
class HotelFull < Dry::Struct
|
575
|
+
transform_keys(&:to_sym)
|
576
|
+
|
577
|
+
attribute :name, Types::Coercible::String
|
578
|
+
attribute :address, Types::Coercible::String.optional
|
579
|
+
attribute :city, Types::Coercible::String.optional
|
580
|
+
attribute :state_code, Types::Coercible::String.optional
|
581
|
+
attribute :zip_code, Types::Coercible::String.optional
|
582
|
+
attribute :phone_number, Types::Coercible::String.optional
|
583
|
+
attribute :url, Types::Coercible::String.optional
|
584
|
+
attribute :off_site, Types::Bool
|
585
|
+
attribute :water_sports, Types::Bool
|
586
|
+
attribute :marina, Types::Bool
|
587
|
+
attribute :beach, Types::Bool
|
588
|
+
attribute :tennis, Types::Bool
|
589
|
+
attribute :biking, Types::Bool
|
590
|
+
attribute :suites, Types::Bool
|
591
|
+
attribute :concierge_floor, Types::Bool
|
592
|
+
attribute :room_service, Types::Bool
|
593
|
+
attribute :wired_internet, Types::Bool
|
594
|
+
attribute :wireless_internet, Types::Bool
|
595
|
+
attribute :num_rooms, Types::Coercible::Integer
|
596
|
+
attribute :theme, Types::Coercible::String.optional
|
597
|
+
attribute :cost_range, Types::Coercible::String.optional
|
598
|
+
attribute :shuttle_to_parks, Types::Bool
|
599
|
+
attribute :cost_estimate, Types::Coercible::String.optional
|
600
|
+
attribute :lodging_area_code, Types::Coercible::String.optional
|
601
|
+
attribute :category_code, Types::Coercible::String.optional
|
602
|
+
end
|
603
|
+
|
604
|
+
PLACE_KEYS = %i[magic_kingdom
|
605
|
+
animal_kingdom
|
606
|
+
epcot
|
607
|
+
hollywood_studios
|
608
|
+
walt_disney_world].freeze
|
609
|
+
# {interest:"interest_type"}
|
610
|
+
INTERESTS = %i[counter_services
|
611
|
+
table_services
|
612
|
+
dining
|
613
|
+
attractions
|
614
|
+
hotels
|
615
|
+
campground
|
616
|
+
deluxe_hotels
|
617
|
+
deluxe_villas
|
618
|
+
moderate_hotels
|
619
|
+
value_hotels
|
620
|
+
disney_springs_resorts].freeze
|
621
|
+
HOTEL_CATEGORIES = %i[campground
|
622
|
+
deluxe_hotels
|
623
|
+
deluxe_villas
|
624
|
+
moderate_hotels
|
625
|
+
value_hotels
|
626
|
+
disney_springs_resorts].freeze
|
467
627
|
|
468
628
|
# list interest at location
|
469
629
|
# current interest are "counter service" "table service", and "attractions"
|
470
630
|
# current locations are the four parks
|
471
631
|
def self.list(interest, location)
|
472
632
|
return "The location is not on Disney property" unless PLACE_KEYS.include? _symbolize(location)
|
473
|
-
return "The interest is not valid"
|
633
|
+
return "The interest is not valid" unless INTERESTS.include? _symbolize(interest)
|
474
634
|
|
475
635
|
client = _setup_client
|
476
636
|
listings = []
|
477
637
|
interest_type = _determine_interest_type(interest)
|
478
|
-
route = _assemble_route(location, interest_type)
|
638
|
+
route = _assemble_route(location, interest_type, "list")
|
479
639
|
response = client.send(route).parsed_response
|
480
640
|
listing_hashes = _collect_listing_hashes_from_response(interest, response)
|
481
641
|
listing_hashes.each do |item|
|
482
|
-
item["venue_permalink"] =
|
642
|
+
item["venue_permalink"] = location.to_s.downcase.gsub(" ", "-").gsub("_", "-")
|
483
643
|
end
|
484
644
|
|
485
|
-
listing_hashes
|
486
645
|
listing_hashes.each do |hash|
|
487
646
|
listing = _set_model_from_hash(interest, hash)
|
488
647
|
listings << listing
|
@@ -525,22 +684,22 @@ module Touringplans
|
|
525
684
|
places.flatten
|
526
685
|
end
|
527
686
|
|
528
|
-
def self.show(interest_type,
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
places = list_all(interest_type)
|
687
|
+
def self.show(place, interest_type, permalink)
|
688
|
+
# see specs for examples
|
689
|
+
return "The location is not on Disney property" unless PLACE_KEYS.include? _symbolize(place)
|
690
|
+
return "The interest_type is not valid" unless INTERESTS.include? _symbolize(interest_type)
|
533
691
|
|
534
|
-
|
535
|
-
|
692
|
+
client = _setup_client
|
693
|
+
route = _assemble_route(place, interest_type, permalink)
|
694
|
+
response = client.send(route).parsed_response
|
695
|
+
_set_model_from_hash(interest_type, response)
|
536
696
|
end
|
537
697
|
|
538
698
|
def self._setup_client
|
539
699
|
connection = Connection.new
|
540
700
|
connection.query(key: "HowdyLen")
|
541
|
-
routes = Touringplans::RoutesTable.symbolize_keys(Touringplans::RoutesTable.load_routes_file)
|
701
|
+
routes = Touringplans::RoutesTable.symbolize_keys(Touringplans::RoutesTable.load_routes_file)
|
542
702
|
Client.new(connection: connection, routes: routes)
|
543
|
-
|
544
703
|
end
|
545
704
|
|
546
705
|
def self._format_location_name(location_name)
|
@@ -552,8 +711,7 @@ module Touringplans
|
|
552
711
|
|
553
712
|
interest_type = "dining" if interest == "counter services"
|
554
713
|
interest_type = "dining" if interest == "table services"
|
555
|
-
interest_type = "hotels" if %i[campground deluxe_hotels deluxe_villas moderate_hotels value_hotels disney_springs_resorts
|
556
|
-
].include? _symbolize(interest)
|
714
|
+
interest_type = "hotels" if %i[campground deluxe_hotels deluxe_villas moderate_hotels value_hotels disney_springs_resorts].include? _symbolize(interest)
|
557
715
|
|
558
716
|
interest_type
|
559
717
|
end
|
@@ -567,11 +725,16 @@ module Touringplans
|
|
567
725
|
str.to_sym
|
568
726
|
end
|
569
727
|
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
"
|
728
|
+
def self._assemble_route(collection, interest_type, venue)
|
729
|
+
# format route
|
730
|
+
collection = collection.to_s.downcase.gsub(" ", "_").gsub("-", "_")
|
731
|
+
interest_type = interest_type.to_s.downcase.gsub(" ", "_").gsub("-", "_")
|
732
|
+
venue = venue.to_s.downcase.gsub(" ", "_").gsub("-", "_")
|
733
|
+
|
734
|
+
route = [collection, interest_type, venue].join("_")
|
735
|
+
route = [collection, interest_type].join("_") if venue == "list"
|
736
|
+
|
737
|
+
route
|
575
738
|
end
|
576
739
|
|
577
740
|
def self._collect_listing_hashes_from_response(interest, response)
|
@@ -587,15 +750,13 @@ module Touringplans
|
|
587
750
|
|
588
751
|
listing_hashes
|
589
752
|
end
|
590
|
-
|
753
|
+
|
591
754
|
def self.list_all_hotels(response_from_touringplans_hotels_url)
|
592
755
|
listing_hashes = []
|
593
756
|
|
594
757
|
response_from_touringplans_hotels_url.each do |child|
|
595
758
|
child.each do |grandchild|
|
596
|
-
if
|
597
|
-
listing_hashes << grandchild
|
598
|
-
end
|
759
|
+
listing_hashes << grandchild if grandchild.class.to_s == "Array"
|
599
760
|
end
|
600
761
|
end
|
601
762
|
|
@@ -603,39 +764,43 @@ module Touringplans
|
|
603
764
|
end
|
604
765
|
|
605
766
|
# search for hotels of a category_code
|
606
|
-
def self.list_hotels_of_a_category(hotels, interest)
|
607
|
-
hotel_categories = {campground:"campground", deluxe_hotels:"deluxe",
|
608
|
-
|
609
|
-
|
767
|
+
def self.list_hotels_of_a_category(hotels, interest)
|
768
|
+
hotel_categories = { campground: "campground", deluxe_hotels: "deluxe",
|
769
|
+
deluxe_villas: "deluxe_villa", moderate_hotels: "moderate",
|
770
|
+
value_hotels: "value", disney_springs_resorts: NilClass }
|
610
771
|
# get a list of every hotel model
|
611
772
|
|
612
773
|
# filter by category_code
|
613
|
-
# disney springs category code is null. We need to find a rule for finding those that don't have any of the values of
|
774
|
+
# disney springs category code is null. We need to find a rule for finding those that don't have any of the values of
|
614
775
|
# hotel categories
|
615
776
|
if interest == "disney springs resorts"
|
616
|
-
|
617
|
-
|
777
|
+
hotels.find_all { |hotel| hotel.category_code.instance_of?(NilClass) }
|
778
|
+
|
618
779
|
else
|
619
|
-
|
620
|
-
|
621
|
-
end
|
780
|
+
hotels.find_all { |hotel| hotel.category_code == hotel_categories[_symbolize(interest)] }
|
622
781
|
|
623
|
-
|
782
|
+
end
|
624
783
|
end
|
625
|
-
|
784
|
+
|
626
785
|
def generate_route_table
|
627
786
|
# initial_routes = ROUTES
|
628
|
-
|
629
787
|
end
|
630
|
-
|
631
|
-
|
788
|
+
|
632
789
|
def self._set_model_from_hash(interest, hash)
|
633
790
|
hotel_categories = %i[campground deluxe_hotels deluxe_villas moderate_hotels value_hotels disney_springs_resorts hotels]
|
634
791
|
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
792
|
+
if hash["permalink"].to_s.length > 1
|
793
|
+
listing = CounterServiceLocation.new(hash) if interest == "counter services"
|
794
|
+
listing = TableServiceLocation.new(hash) if interest == "table services"
|
795
|
+
listing = ParkAttraction.new(hash) if interest == "attractions"
|
796
|
+
listing = DiningVenueFull.new(hash) if interest == "dining"
|
797
|
+
listing = Hotel.new(hash) if hotel_categories.include? _symbolize(interest)
|
798
|
+
else
|
799
|
+
listing = DiningVenueFull.new(hash) if interest == "dining"
|
800
|
+
listing = ParkAttractionFull.new(hash) if interest == "attractions"
|
801
|
+
listing = HotelFull.new(hash) if hotel_categories.include? _symbolize(interest)
|
802
|
+
end
|
803
|
+
|
639
804
|
listing
|
640
805
|
end
|
641
806
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: touringplans
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- captproton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|