touringplans 0.2.9 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +286 -117
- 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: 23b9e7a9427dc9c29f110192664421209833190bd7f2036dc44d03bbf9cee89b
|
|
4
|
+
data.tar.gz: 1fd63dfcd635132295b7914f79b41342f3c9ca1e56de5ab2d4afc56f14a54b11
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73cf31a52342039349a62edd41100d566f6012365b2a226a52289971519d86452f5c633baaf85d5e0d3bdf7f6b04778c4ebfa7959d9358a8805f3185ddfc395b
|
|
7
|
+
data.tar.gz: 89b41c5db23cf5140a5a91f98b4b3973669c9bae197e2cfa3896e8cf901a9a2163d2ab736ea3d3b1372a74cd24c3a19d86a155941cff457399c2faaa5efdf6c0
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.3.1
|
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,22 +198,20 @@ module Touringplans
|
|
|
207
198
|
else value
|
|
208
199
|
end
|
|
209
200
|
result[new_key] = new_value
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
213
203
|
|
|
214
204
|
def self.load_routes_file(routes_relative_file_path: "/routes.yml")
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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))
|
|
218
208
|
end
|
|
219
|
-
|
|
220
|
-
|
|
209
|
+
|
|
221
210
|
def self.update_file
|
|
222
211
|
# gather info into hashes
|
|
223
212
|
attractions_routes = _generate_interest_routes_hash("attractions")
|
|
224
213
|
dining_routes = _generate_interest_routes_hash("dining")
|
|
225
|
-
hotels_routes =
|
|
214
|
+
hotels_routes = _generate_interest_routes_hash("hotels")
|
|
226
215
|
updated_routes = original_routes.merge(attractions_routes, dining_routes, hotels_routes)
|
|
227
216
|
|
|
228
217
|
updated_routes_yaml = _convert_hash_to_yaml(updated_routes)
|
|
@@ -233,12 +222,13 @@ module Touringplans
|
|
|
233
222
|
|
|
234
223
|
def self._initialize_file
|
|
235
224
|
# delete old file if it exits
|
|
236
|
-
lib_dir
|
|
225
|
+
lib_dir = FileUtils.getwd + "/lib"
|
|
237
226
|
routes_file = "#{lib_dir}/routes.yml"
|
|
238
227
|
|
|
239
228
|
# ensure the file exists
|
|
240
229
|
touched_routes_file_array = FileUtils.touch(routes_file)
|
|
241
|
-
|
|
230
|
+
# we want the first string value
|
|
231
|
+
touched_routes_file_array.first
|
|
242
232
|
end
|
|
243
233
|
|
|
244
234
|
def self._generate_interest_routes_hash(interest)
|
|
@@ -246,7 +236,7 @@ module Touringplans
|
|
|
246
236
|
interest_routes = {}
|
|
247
237
|
|
|
248
238
|
interest_venues.each do |iv|
|
|
249
|
-
new_route =
|
|
239
|
+
new_route = _generate_interest_route(iv.venue_permalink, interest, iv.permalink)
|
|
250
240
|
key = new_route.keys.first
|
|
251
241
|
values = new_route[key]
|
|
252
242
|
interest_routes[key] = values
|
|
@@ -254,7 +244,7 @@ module Touringplans
|
|
|
254
244
|
|
|
255
245
|
interest_routes
|
|
256
246
|
end
|
|
257
|
-
|
|
247
|
+
|
|
258
248
|
def self._generate_interest_route(venue_permalink, interest_permalink, place_permalink)
|
|
259
249
|
# {magic_kingdom_attractions_haunted_mansion: {
|
|
260
250
|
# method: "get",
|
|
@@ -267,12 +257,8 @@ module Touringplans
|
|
|
267
257
|
method = "get"
|
|
268
258
|
format = "json"
|
|
269
259
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
hash
|
|
260
|
+
{ key => { "method".to_s => method,
|
|
261
|
+
"path".to_s => "#{path}.#{format}" } }
|
|
276
262
|
end
|
|
277
263
|
|
|
278
264
|
def self._convert_hash_to_yaml(hash)
|
|
@@ -284,13 +270,13 @@ module Touringplans
|
|
|
284
270
|
new_file.write(content)
|
|
285
271
|
new_file.close
|
|
286
272
|
end
|
|
287
|
-
|
|
273
|
+
|
|
288
274
|
def self._read_file_to_terminal(file)
|
|
289
275
|
new_file = File.open(file, "r")
|
|
290
276
|
new_file.close
|
|
291
277
|
end
|
|
292
|
-
|
|
293
278
|
end
|
|
279
|
+
|
|
294
280
|
# model with the attributes
|
|
295
281
|
class CounterServiceLocation < Dry::Struct
|
|
296
282
|
transform_keys(&:to_sym)
|
|
@@ -350,7 +336,7 @@ module Touringplans
|
|
|
350
336
|
attribute :kosher_available, Types::Params::Bool
|
|
351
337
|
attribute :dinable_id, Types::Params::Integer
|
|
352
338
|
attribute :dinable_type, Types::String.optional
|
|
353
|
-
attribute :venue_permalink, Types::String.optional
|
|
339
|
+
attribute :venue_permalink, Types::String.optional
|
|
354
340
|
end
|
|
355
341
|
|
|
356
342
|
# model with the attributes
|
|
@@ -383,11 +369,11 @@ module Touringplans
|
|
|
383
369
|
attribute :house_specialties, Types::String.optional
|
|
384
370
|
attribute :counter_quality_rating, Types::String.optional
|
|
385
371
|
attribute :counter_value_rating, Types::String.optional
|
|
386
|
-
attribute :table_quality_rating, Types::Params::
|
|
387
|
-
attribute :table_value_rating, Types::Params::
|
|
388
|
-
attribute :overall_rating, Types::Params::
|
|
389
|
-
attribute :service_rating, Types::Params::
|
|
390
|
-
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
|
|
391
377
|
attribute :adult_breakfast_menu_url, Types::String.optional
|
|
392
378
|
attribute :adult_lunch_menu_url, Types::String.optional
|
|
393
379
|
attribute :adult_dinner_menu_url, Types::String.optional
|
|
@@ -415,6 +401,70 @@ module Touringplans
|
|
|
415
401
|
attribute :venue_permalink, Types::String.optional
|
|
416
402
|
end
|
|
417
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
|
+
|
|
451
|
+
attribute :operator_id, Types::Integer
|
|
452
|
+
attribute :operator_url, Types::String.optional
|
|
453
|
+
attribute :operator_type, Types::String.optional
|
|
454
|
+
attribute :walking_time_proxy_id, Types::String.optional
|
|
455
|
+
attribute :sort_name, Types::String.optional
|
|
456
|
+
attribute :mobile_ordering, Types::Bool.optional
|
|
457
|
+
attribute :extinct_on_uncertain, Types::String.optional
|
|
458
|
+
attribute :opened_on_uncertain, Types::String.optional
|
|
459
|
+
attribute :opened_on_known, Types::String.optional
|
|
460
|
+
attribute :operational_notes, Types::String.optional
|
|
461
|
+
attribute :latitude, Types::String.optional
|
|
462
|
+
attribute :longitude, Types::String.optional
|
|
463
|
+
attribute :summary_at_top, Types::Bool.optional
|
|
464
|
+
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
|
|
418
468
|
# model with the attributes
|
|
419
469
|
class ParkAttraction < Dry::Struct
|
|
420
470
|
transform_keys(&:to_sym)
|
|
@@ -423,7 +473,91 @@ module Touringplans
|
|
|
423
473
|
attribute :short_name, Types::String
|
|
424
474
|
attribute :permalink, Types::String
|
|
425
475
|
attribute :venue_permalink, Types::String
|
|
426
|
-
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
# model with the attributes
|
|
479
|
+
class ParkAttractionFull < Dry::Struct
|
|
480
|
+
transform_keys(&:to_sym)
|
|
481
|
+
|
|
482
|
+
attribute :name, Types::String
|
|
483
|
+
attribute :fastpass_booth, Types::Bool
|
|
484
|
+
attribute :short_name, Types::String
|
|
485
|
+
attribute :created_at, Types::Params::DateTime
|
|
486
|
+
attribute :updated_at, Types::Params::DateTime
|
|
487
|
+
attribute :open_emh_morning, Types::Bool
|
|
488
|
+
attribute :open_emh_evening, Types::Bool
|
|
489
|
+
attribute :single_rider, Types::Bool
|
|
490
|
+
attribute :time_zone, Types::String
|
|
491
|
+
attribute :seasonal, Types::Bool
|
|
492
|
+
attribute :open_very_merry, Types::Bool
|
|
493
|
+
attribute :open_not_so_scary, Types::Bool
|
|
494
|
+
attribute :category_code, Types::String
|
|
495
|
+
attribute :duration, Types::Float
|
|
496
|
+
attribute :scheduled_code, Types::String.optional
|
|
497
|
+
attribute :what_it_is, Types::String
|
|
498
|
+
attribute :scope_and_scale_code, Types::String
|
|
499
|
+
attribute :when_to_go, Types::String
|
|
500
|
+
attribute :average_wait_per_hundred, Types::Float
|
|
501
|
+
attribute :average_wait_assumes, Types::String.optional
|
|
502
|
+
attribute :loading_speed, Types::String
|
|
503
|
+
attribute :probable_wait_time, Types::Float.optional
|
|
504
|
+
attribute :special_needs, Types::String.optional
|
|
505
|
+
attribute :height_restriction, Types::Float.optional
|
|
506
|
+
attribute :intense, Types::Bool
|
|
507
|
+
attribute :extinct_on, Types::Params::DateTime.optional
|
|
508
|
+
attribute :opened_on, Types::Params::DateTime.optional
|
|
509
|
+
attribute :frightening, Types::Bool
|
|
510
|
+
attribute :physical_considerations, Types::Bool
|
|
511
|
+
attribute :handheld_captioning, Types::Bool
|
|
512
|
+
attribute :video_captioning, Types::Bool
|
|
513
|
+
attribute :reflective_captioning, Types::Bool
|
|
514
|
+
attribute :assistive_listening, Types::Bool
|
|
515
|
+
attribute :audio_description, Types::Bool
|
|
516
|
+
attribute :wheelchair_transfer_code, Types::String
|
|
517
|
+
attribute :no_service_animals, Types::Bool
|
|
518
|
+
attribute :sign_language, Types::Bool
|
|
519
|
+
attribute :service_animal_check, Types::Bool
|
|
520
|
+
attribute :not_to_be_missed, Types::Bool
|
|
521
|
+
attribute :rider_swap, Types::Bool
|
|
522
|
+
attribute :ultimate_code, Types::String
|
|
523
|
+
attribute :ultimate_task, Types::String
|
|
524
|
+
attribute :park_entrance, Types::Bool
|
|
525
|
+
attribute :relative_open, Types::Bool.optional
|
|
526
|
+
attribute :relative_close, Types::Bool.optional
|
|
527
|
+
attribute :close_at_dusk, Types::Bool.optional
|
|
528
|
+
attribute :crowd_calendar_version, Types::Integer
|
|
529
|
+
attribute :match_name, Types::String
|
|
530
|
+
attribute :crazy_threshold, Types::Integer.optional
|
|
531
|
+
attribute :fastpass_only, Types::Bool
|
|
532
|
+
attribute :allow_showtimes_after_close, Types::Bool
|
|
533
|
+
attribute :disconnected_fastpass_booth, Types::Bool
|
|
534
|
+
attribute :arrive_before, Types::Bool.optional
|
|
535
|
+
attribute :arrive_before_fp, Types::Bool.optional
|
|
536
|
+
attribute :allow_time_restriction, Types::Bool
|
|
537
|
+
attribute :relative_open_to_sunset, Types::Bool.optional
|
|
538
|
+
attribute :relative_close_to_sunset, Types::Bool.optional
|
|
539
|
+
attribute :closing_round_code, Types::Bool.optional
|
|
540
|
+
attribute :walking_time_proxy_id, Types::Integer.optional
|
|
541
|
+
attribute :flexible_duration, Types::Bool
|
|
542
|
+
attribute :operator_id, Types::Integer
|
|
543
|
+
attribute :operator_type, Types::String
|
|
544
|
+
attribute :hide_app, Types::Bool
|
|
545
|
+
attribute :showtime_proxy_id, Types::Integer.optional
|
|
546
|
+
attribute :sort_name, Types::String
|
|
547
|
+
attribute :extinct_on_uncertain, Types::Bool.optional
|
|
548
|
+
attribute :opened_on_uncertain, Types::Bool.optional
|
|
549
|
+
attribute :ignore_scrapes, Types::Bool.optional
|
|
550
|
+
attribute :extra_cost, Types::Bool
|
|
551
|
+
attribute :climate_controlled, Types::Bool
|
|
552
|
+
attribute :wet, Types::Bool.optional
|
|
553
|
+
attribute :operational_notes, Types::String.optional
|
|
554
|
+
attribute :masthead_circle_x, Types::Integer
|
|
555
|
+
attribute :masthead_circle_y, Types::Integer
|
|
556
|
+
attribute :latitude, Types::String
|
|
557
|
+
attribute :longitude, Types::String
|
|
558
|
+
attribute :open_early, Types::Bool
|
|
559
|
+
attribute :themeparks_entity_id, Types::String
|
|
560
|
+
attribute :has_virtual_queue, Types::Bool
|
|
427
561
|
end
|
|
428
562
|
|
|
429
563
|
# model with the attributes
|
|
@@ -437,49 +571,78 @@ module Touringplans
|
|
|
437
571
|
attribute :venue_permalink, Types::String.optional
|
|
438
572
|
end
|
|
439
573
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
574
|
+
# model with the attributes
|
|
575
|
+
class HotelFull < Dry::Struct
|
|
576
|
+
transform_keys(&:to_sym)
|
|
577
|
+
|
|
578
|
+
attribute :name, Types::String
|
|
579
|
+
attribute :address, Types::String
|
|
580
|
+
attribute :city, Types::String
|
|
581
|
+
attribute :state_code, Types::String
|
|
582
|
+
attribute :zip_code, Types::String
|
|
583
|
+
attribute :phone_number, Types::String
|
|
584
|
+
attribute :url, Types::String
|
|
585
|
+
attribute :off_site, Types::Bool
|
|
586
|
+
attribute :water_sports, Types::Bool
|
|
587
|
+
attribute :marina, Types::Bool
|
|
588
|
+
attribute :beach, Types::Bool
|
|
589
|
+
attribute :tennis, Types::Bool
|
|
590
|
+
attribute :biking, Types::Bool
|
|
591
|
+
attribute :suites, Types::Bool
|
|
592
|
+
attribute :concierge_floor, Types::Bool
|
|
593
|
+
attribute :room_service, Types::Bool
|
|
594
|
+
attribute :wired_internet, Types::Bool
|
|
595
|
+
attribute :wireless_internet, Types::Bool
|
|
596
|
+
attribute :num_rooms, Types::Integer
|
|
597
|
+
attribute :theme, Types::String
|
|
598
|
+
attribute :cost_range, Types::String
|
|
599
|
+
attribute :shuttle_to_parks, Types::Bool
|
|
600
|
+
attribute :cost_estimate, Types::String.optional
|
|
601
|
+
attribute :lodging_area_code, Types::String
|
|
602
|
+
attribute :category_code, Types::String
|
|
603
|
+
end
|
|
604
|
+
|
|
605
|
+
PLACE_KEYS = %i[magic_kingdom
|
|
606
|
+
animal_kingdom
|
|
607
|
+
epcot
|
|
608
|
+
hollywood_studios
|
|
609
|
+
walt_disney_world].freeze
|
|
610
|
+
# {interest:"interest_type"}
|
|
611
|
+
INTERESTS = %i[counter_services
|
|
612
|
+
table_services
|
|
613
|
+
dining
|
|
614
|
+
attractions
|
|
615
|
+
hotels
|
|
616
|
+
campground
|
|
617
|
+
deluxe_hotels
|
|
618
|
+
deluxe_villas
|
|
619
|
+
moderate_hotels
|
|
620
|
+
value_hotels
|
|
621
|
+
disney_springs_resorts].freeze
|
|
622
|
+
HOTEL_CATEGORIES = %i[campground
|
|
623
|
+
deluxe_hotels
|
|
624
|
+
deluxe_villas
|
|
625
|
+
moderate_hotels
|
|
626
|
+
value_hotels
|
|
627
|
+
disney_springs_resorts].freeze
|
|
464
628
|
|
|
465
629
|
# list interest at location
|
|
466
630
|
# current interest are "counter service" "table service", and "attractions"
|
|
467
631
|
# current locations are the four parks
|
|
468
632
|
def self.list(interest, location)
|
|
469
633
|
return "The location is not on Disney property" unless PLACE_KEYS.include? _symbolize(location)
|
|
470
|
-
return "The interest is not valid"
|
|
634
|
+
return "The interest is not valid" unless INTERESTS.include? _symbolize(interest)
|
|
471
635
|
|
|
472
636
|
client = _setup_client
|
|
473
637
|
listings = []
|
|
474
638
|
interest_type = _determine_interest_type(interest)
|
|
475
|
-
route = _assemble_route(location, interest_type)
|
|
639
|
+
route = _assemble_route(location, interest_type, "list")
|
|
476
640
|
response = client.send(route).parsed_response
|
|
477
641
|
listing_hashes = _collect_listing_hashes_from_response(interest, response)
|
|
478
642
|
listing_hashes.each do |item|
|
|
479
|
-
item["venue_permalink"] =
|
|
643
|
+
item["venue_permalink"] = location.to_s.downcase.gsub(" ", "-").gsub("_", "-")
|
|
480
644
|
end
|
|
481
645
|
|
|
482
|
-
listing_hashes
|
|
483
646
|
listing_hashes.each do |hash|
|
|
484
647
|
listing = _set_model_from_hash(interest, hash)
|
|
485
648
|
listings << listing
|
|
@@ -522,22 +685,22 @@ module Touringplans
|
|
|
522
685
|
places.flatten
|
|
523
686
|
end
|
|
524
687
|
|
|
525
|
-
def self.show(interest_type,
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
places = list_all(interest_type)
|
|
688
|
+
def self.show(place, interest_type, permalink)
|
|
689
|
+
# see specs for examples
|
|
690
|
+
return "The location is not on Disney property" unless PLACE_KEYS.include? _symbolize(place)
|
|
691
|
+
return "The interest_type is not valid" unless INTERESTS.include? _symbolize(interest_type)
|
|
530
692
|
|
|
531
|
-
|
|
532
|
-
|
|
693
|
+
client = _setup_client
|
|
694
|
+
route = _assemble_route(place, interest_type, permalink)
|
|
695
|
+
response = client.send(route).parsed_response
|
|
696
|
+
_set_model_from_hash(interest_type, response)
|
|
533
697
|
end
|
|
534
698
|
|
|
535
699
|
def self._setup_client
|
|
536
700
|
connection = Connection.new
|
|
537
701
|
connection.query(key: "HowdyLen")
|
|
538
|
-
routes = Touringplans::RoutesTable.symbolize_keys(Touringplans::RoutesTable.load_routes_file)
|
|
702
|
+
routes = Touringplans::RoutesTable.symbolize_keys(Touringplans::RoutesTable.load_routes_file)
|
|
539
703
|
Client.new(connection: connection, routes: routes)
|
|
540
|
-
|
|
541
704
|
end
|
|
542
705
|
|
|
543
706
|
def self._format_location_name(location_name)
|
|
@@ -549,8 +712,7 @@ module Touringplans
|
|
|
549
712
|
|
|
550
713
|
interest_type = "dining" if interest == "counter services"
|
|
551
714
|
interest_type = "dining" if interest == "table services"
|
|
552
|
-
interest_type = "hotels" if %i[campground deluxe_hotels deluxe_villas moderate_hotels value_hotels disney_springs_resorts
|
|
553
|
-
].include? _symbolize(interest)
|
|
715
|
+
interest_type = "hotels" if %i[campground deluxe_hotels deluxe_villas moderate_hotels value_hotels disney_springs_resorts].include? _symbolize(interest)
|
|
554
716
|
|
|
555
717
|
interest_type
|
|
556
718
|
end
|
|
@@ -564,11 +726,16 @@ module Touringplans
|
|
|
564
726
|
str.to_sym
|
|
565
727
|
end
|
|
566
728
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
"
|
|
729
|
+
def self._assemble_route(collection, interest_type, venue)
|
|
730
|
+
# format route
|
|
731
|
+
collection = collection.to_s.downcase.gsub(" ", "_").gsub("-", "_")
|
|
732
|
+
interest_type = interest_type.to_s.downcase.gsub(" ", "_").gsub("-", "_")
|
|
733
|
+
venue = venue.to_s.downcase.gsub(" ", "_").gsub("-", "_")
|
|
734
|
+
|
|
735
|
+
route = [collection, interest_type, venue].join("_")
|
|
736
|
+
route = [collection, interest_type].join("_") if venue == "list"
|
|
737
|
+
|
|
738
|
+
route
|
|
572
739
|
end
|
|
573
740
|
|
|
574
741
|
def self._collect_listing_hashes_from_response(interest, response)
|
|
@@ -584,15 +751,13 @@ module Touringplans
|
|
|
584
751
|
|
|
585
752
|
listing_hashes
|
|
586
753
|
end
|
|
587
|
-
|
|
754
|
+
|
|
588
755
|
def self.list_all_hotels(response_from_touringplans_hotels_url)
|
|
589
756
|
listing_hashes = []
|
|
590
757
|
|
|
591
758
|
response_from_touringplans_hotels_url.each do |child|
|
|
592
759
|
child.each do |grandchild|
|
|
593
|
-
if
|
|
594
|
-
listing_hashes << grandchild
|
|
595
|
-
end
|
|
760
|
+
listing_hashes << grandchild if grandchild.class.to_s == "Array"
|
|
596
761
|
end
|
|
597
762
|
end
|
|
598
763
|
|
|
@@ -600,39 +765,43 @@ module Touringplans
|
|
|
600
765
|
end
|
|
601
766
|
|
|
602
767
|
# search for hotels of a category_code
|
|
603
|
-
def self.list_hotels_of_a_category(hotels, interest)
|
|
604
|
-
hotel_categories = {campground:"campground", deluxe_hotels:"deluxe",
|
|
605
|
-
|
|
606
|
-
|
|
768
|
+
def self.list_hotels_of_a_category(hotels, interest)
|
|
769
|
+
hotel_categories = { campground: "campground", deluxe_hotels: "deluxe",
|
|
770
|
+
deluxe_villas: "deluxe_villa", moderate_hotels: "moderate",
|
|
771
|
+
value_hotels: "value", disney_springs_resorts: NilClass }
|
|
607
772
|
# get a list of every hotel model
|
|
608
773
|
|
|
609
774
|
# filter by category_code
|
|
610
|
-
# disney springs category code is null. We need to find a rule for finding those that don't have any of the values of
|
|
775
|
+
# disney springs category code is null. We need to find a rule for finding those that don't have any of the values of
|
|
611
776
|
# hotel categories
|
|
612
777
|
if interest == "disney springs resorts"
|
|
613
|
-
|
|
614
|
-
|
|
778
|
+
hotels.find_all { |hotel| hotel.category_code.instance_of?(NilClass) }
|
|
779
|
+
|
|
615
780
|
else
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
end
|
|
781
|
+
hotels.find_all { |hotel| hotel.category_code == hotel_categories[_symbolize(interest)] }
|
|
619
782
|
|
|
620
|
-
|
|
783
|
+
end
|
|
621
784
|
end
|
|
622
|
-
|
|
785
|
+
|
|
623
786
|
def generate_route_table
|
|
624
787
|
# initial_routes = ROUTES
|
|
625
|
-
|
|
626
788
|
end
|
|
627
|
-
|
|
628
|
-
|
|
789
|
+
|
|
629
790
|
def self._set_model_from_hash(interest, hash)
|
|
630
791
|
hotel_categories = %i[campground deluxe_hotels deluxe_villas moderate_hotels value_hotels disney_springs_resorts hotels]
|
|
631
792
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
793
|
+
if hash["permalink"].to_s.length > 1
|
|
794
|
+
listing = CounterServiceLocation.new(hash) if interest == "counter services"
|
|
795
|
+
listing = TableServiceLocation.new(hash) if interest == "table services"
|
|
796
|
+
listing = ParkAttraction.new(hash) if interest == "attractions"
|
|
797
|
+
listing = DiningVenueFull.new(hash) if interest == "dining"
|
|
798
|
+
listing = Hotel.new(hash) if hotel_categories.include? _symbolize(interest)
|
|
799
|
+
else
|
|
800
|
+
listing = DiningVenueFull.new(hash) if interest == "dining"
|
|
801
|
+
listing = ParkAttractionFull.new(hash) if interest == "attractions"
|
|
802
|
+
listing = HotelFull.new(hash) if hotel_categories.include? _symbolize(interest)
|
|
803
|
+
end
|
|
804
|
+
|
|
636
805
|
listing
|
|
637
806
|
end
|
|
638
807
|
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.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- captproton
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-10-
|
|
11
|
+
date: 2021-10-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: awesome_print
|