MouseTools 4.1.0__tar.gz → 4.2.0__tar.gz
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.
- {mousetools-4.1.0 → mousetools-4.2.0}/PKG-INFO +1 -1
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/api/menu.py +121 -140
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/channels/__init__.py +10 -1
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/channels/calendar/__init__.py +30 -62
- mousetools-4.2.0/mousetools/channels/characters/__init__.py +167 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/channels/enums.py +5 -5
- mousetools-4.2.0/mousetools/channels/facilities/__init__.py +812 -0
- mousetools-4.2.0/mousetools/channels/facilitystatus/__init__.py +214 -0
- mousetools-4.2.0/mousetools/channels/forecastedwaittimes/__init__.py +117 -0
- mousetools-4.2.0/mousetools/decorators.py +39 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools.egg-info/PKG-INFO +1 -1
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools.egg-info/SOURCES.txt +3 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/pyproject.toml +2 -1
- mousetools-4.1.0/mousetools/channels/facilities/__init__.py +0 -1018
- mousetools-4.1.0/mousetools/channels/facilitystatus/__init__.py +0 -265
- {mousetools-4.1.0 → mousetools-4.2.0}/LICENSE +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/README.md +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/__init__.py +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/api/__init__.py +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/api/search.py +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/auth.py +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/channels/facilities/enums.py +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/enums.py +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/mixins/__init__.py +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/mixins/couchbase.py +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/mixins/disney.py +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools/resources/environments.bin +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools.egg-info/dependency_links.txt +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools.egg-info/requires.txt +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/mousetools.egg-info/top_level.txt +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/setup.cfg +0 -0
- {mousetools-4.1.0 → mousetools-4.2.0}/tests/test_mixins.py +0 -0
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import typing
|
|
2
|
+
from datetime import datetime, timedelta
|
|
3
|
+
from zoneinfo import ZoneInfo
|
|
4
|
+
|
|
5
|
+
from dateutil.parser import isoparse
|
|
2
6
|
|
|
3
7
|
from mousetools.auth import auth_obj
|
|
8
|
+
from mousetools.decorators import disney_property, json_property
|
|
4
9
|
from mousetools.mixins.disney import DisneyAPIMixin
|
|
5
10
|
|
|
6
11
|
# menus -> menu -> menugroups -> menuitems
|
|
@@ -14,7 +19,7 @@ class MenuItem:
|
|
|
14
19
|
def __repr__(self) -> str:
|
|
15
20
|
return f"MenuItem(entity_id={self.entity_id}, parent_resturant_id={self._parent_restaurant_id})"
|
|
16
21
|
|
|
17
|
-
@
|
|
22
|
+
@json_property
|
|
18
23
|
def entity_id(self) -> typing.Optional[str]:
|
|
19
24
|
"""
|
|
20
25
|
The entity id of the menu item.
|
|
@@ -22,12 +27,9 @@ class MenuItem:
|
|
|
22
27
|
Returns:
|
|
23
28
|
(typing.Optional[str]): The entity id of the menu item.
|
|
24
29
|
"""
|
|
25
|
-
|
|
26
|
-
return self._raw_item_data["id"]
|
|
27
|
-
except KeyError:
|
|
28
|
-
return None
|
|
30
|
+
return self._raw_item_data["id"]
|
|
29
31
|
|
|
30
|
-
@
|
|
32
|
+
@json_property
|
|
31
33
|
def pc_short_name(self) -> typing.Optional[str]:
|
|
32
34
|
"""
|
|
33
35
|
The short name of the menu item.
|
|
@@ -35,12 +37,9 @@ class MenuItem:
|
|
|
35
37
|
Returns:
|
|
36
38
|
(typing.Optional[str]): The short name of the menu item.
|
|
37
39
|
"""
|
|
38
|
-
|
|
39
|
-
return self._raw_item_data["names"]["PCShort"]
|
|
40
|
-
except KeyError:
|
|
41
|
-
return None
|
|
40
|
+
return self._raw_item_data["names"]["PCShort"]
|
|
42
41
|
|
|
43
|
-
@
|
|
42
|
+
@json_property
|
|
44
43
|
def pc_long_name(self) -> typing.Optional[str]:
|
|
45
44
|
"""
|
|
46
45
|
The long name of the menu item.
|
|
@@ -48,12 +47,9 @@ class MenuItem:
|
|
|
48
47
|
Returns:
|
|
49
48
|
(typing.Optional[str]): The long name of the menu item.
|
|
50
49
|
"""
|
|
51
|
-
|
|
52
|
-
return self._raw_item_data["names"]["PCLong"]
|
|
53
|
-
except KeyError:
|
|
54
|
-
return None
|
|
50
|
+
return self._raw_item_data["names"]["PCLong"]
|
|
55
51
|
|
|
56
|
-
@
|
|
52
|
+
@json_property
|
|
57
53
|
def mobile_short_name(self) -> typing.Optional[str]:
|
|
58
54
|
"""
|
|
59
55
|
The short name of the menu item.
|
|
@@ -61,12 +57,9 @@ class MenuItem:
|
|
|
61
57
|
Returns:
|
|
62
58
|
(typing.Optional[str]): The short name of the menu item.
|
|
63
59
|
"""
|
|
64
|
-
|
|
65
|
-
return self._raw_item_data["names"]["MobileShort"]
|
|
66
|
-
except KeyError:
|
|
67
|
-
return None
|
|
60
|
+
return self._raw_item_data["names"]["MobileShort"]
|
|
68
61
|
|
|
69
|
-
@
|
|
62
|
+
@json_property
|
|
70
63
|
def mobile_long_name(self) -> typing.Optional[str]:
|
|
71
64
|
"""
|
|
72
65
|
The long name of the menu item.
|
|
@@ -74,12 +67,9 @@ class MenuItem:
|
|
|
74
67
|
Returns:
|
|
75
68
|
(typing.Optional[str]): The long name of the menu item.
|
|
76
69
|
"""
|
|
77
|
-
|
|
78
|
-
return self._raw_item_data["names"]["MobileLong"]
|
|
79
|
-
except KeyError:
|
|
80
|
-
return None
|
|
70
|
+
return self._raw_item_data["names"]["MobileLong"]
|
|
81
71
|
|
|
82
|
-
@
|
|
72
|
+
@json_property
|
|
83
73
|
def mickey_check(self) -> typing.Optional[bool]:
|
|
84
74
|
"""
|
|
85
75
|
Whether the menu item is mickey check.
|
|
@@ -87,12 +77,9 @@ class MenuItem:
|
|
|
87
77
|
Returns:
|
|
88
78
|
(typing.Optional[bool]): Whether the menu item is mickey check.
|
|
89
79
|
"""
|
|
90
|
-
|
|
91
|
-
return self._raw_item_data["mickeyCheck"]
|
|
92
|
-
except KeyError:
|
|
93
|
-
return None
|
|
80
|
+
return self._raw_item_data["mickeyCheck"]
|
|
94
81
|
|
|
95
|
-
@
|
|
82
|
+
@json_property
|
|
96
83
|
def pc_long_description(self) -> typing.Optional[str]:
|
|
97
84
|
"""
|
|
98
85
|
The long description of the menu item.
|
|
@@ -100,12 +87,9 @@ class MenuItem:
|
|
|
100
87
|
Returns:
|
|
101
88
|
(typing.Optional[str]): The long description of the menu item.
|
|
102
89
|
"""
|
|
103
|
-
|
|
104
|
-
return self._raw_item_data["descriptions"]["PCLong"]["text"]
|
|
105
|
-
except KeyError:
|
|
106
|
-
return None
|
|
90
|
+
return self._raw_item_data["descriptions"]["PCLong"]["text"]
|
|
107
91
|
|
|
108
|
-
@
|
|
92
|
+
@json_property
|
|
109
93
|
def mobile_short_description(self) -> typing.Optional[str]:
|
|
110
94
|
"""
|
|
111
95
|
The short description of the menu item.
|
|
@@ -113,12 +97,9 @@ class MenuItem:
|
|
|
113
97
|
Returns:
|
|
114
98
|
(typing.Optional[str]): The short description of the menu item.
|
|
115
99
|
"""
|
|
116
|
-
|
|
117
|
-
return self._raw_item_data["descriptions"]["MobileShort"]["text"]
|
|
118
|
-
except KeyError:
|
|
119
|
-
return None
|
|
100
|
+
return self._raw_item_data["descriptions"]["MobileShort"]["text"]
|
|
120
101
|
|
|
121
|
-
@
|
|
102
|
+
@json_property
|
|
122
103
|
def default_selection(self) -> typing.Optional[bool]:
|
|
123
104
|
"""
|
|
124
105
|
Whether the menu item is the default selection.
|
|
@@ -126,12 +107,9 @@ class MenuItem:
|
|
|
126
107
|
Returns:
|
|
127
108
|
(typing.Optional[bool]): Whether the menu item is the default selection.
|
|
128
109
|
"""
|
|
129
|
-
|
|
130
|
-
return self._raw_item_data["defaultSelection"]
|
|
131
|
-
except KeyError:
|
|
132
|
-
return None
|
|
110
|
+
return self._raw_item_data["defaultSelection"]
|
|
133
111
|
|
|
134
|
-
@
|
|
112
|
+
@json_property
|
|
135
113
|
def prices(self) -> typing.Optional[dict]:
|
|
136
114
|
"""
|
|
137
115
|
The prices of the menu item.
|
|
@@ -139,12 +117,9 @@ class MenuItem:
|
|
|
139
117
|
Returns:
|
|
140
118
|
(typing.Optional[dict]): The prices of the menu item.
|
|
141
119
|
"""
|
|
142
|
-
|
|
143
|
-
return self._raw_item_data["prices"]
|
|
144
|
-
except KeyError:
|
|
145
|
-
return None
|
|
120
|
+
return self._raw_item_data["prices"]
|
|
146
121
|
|
|
147
|
-
@
|
|
122
|
+
@json_property
|
|
148
123
|
def per_serving_without_tax(self) -> typing.Optional[float]:
|
|
149
124
|
"""
|
|
150
125
|
The per serving without tax of the menu item.
|
|
@@ -152,10 +127,7 @@ class MenuItem:
|
|
|
152
127
|
Returns:
|
|
153
128
|
(typing.Optional[float]): The per serving without tax of the menu item.
|
|
154
129
|
"""
|
|
155
|
-
|
|
156
|
-
return self._raw_item_data["prices"]["PerServing"]["withoutTax"]
|
|
157
|
-
except KeyError:
|
|
158
|
-
return None
|
|
130
|
+
return self._raw_item_data["prices"]["PerServing"]["withoutTax"]
|
|
159
131
|
|
|
160
132
|
|
|
161
133
|
class MenuGroup:
|
|
@@ -166,7 +138,7 @@ class MenuGroup:
|
|
|
166
138
|
def __str__(self) -> str:
|
|
167
139
|
return f"MenuGroup(menu_group_type={self.menu_group_type}, parent_restaurant_id={self._parent_restaurant_id})"
|
|
168
140
|
|
|
169
|
-
@
|
|
141
|
+
@json_property
|
|
170
142
|
def menu_group_type(self) -> typing.Optional[str]:
|
|
171
143
|
"""
|
|
172
144
|
The type of the menu group.
|
|
@@ -174,12 +146,9 @@ class MenuGroup:
|
|
|
174
146
|
Returns:
|
|
175
147
|
(typing.Optional[str]): The type of the menu group.
|
|
176
148
|
"""
|
|
177
|
-
|
|
178
|
-
return self._raw_menu_group_data["menuGroupType"]
|
|
179
|
-
except KeyError:
|
|
180
|
-
return None
|
|
149
|
+
return self._raw_menu_group_data["menuGroupType"]
|
|
181
150
|
|
|
182
|
-
@
|
|
151
|
+
@json_property
|
|
183
152
|
def multiple_price_types(self) -> typing.Optional[bool]:
|
|
184
153
|
"""
|
|
185
154
|
Whether the menu group has multiple price types.
|
|
@@ -187,12 +156,9 @@ class MenuGroup:
|
|
|
187
156
|
Returns:
|
|
188
157
|
(typing.Optional[bool]): Whether the menu group has multiple price types.
|
|
189
158
|
"""
|
|
190
|
-
|
|
191
|
-
return self._raw_menu_group_data["multiplePriceTypes"]
|
|
192
|
-
except KeyError:
|
|
193
|
-
return None
|
|
159
|
+
return self._raw_menu_group_data["multiplePriceTypes"]
|
|
194
160
|
|
|
195
|
-
@
|
|
161
|
+
@json_property
|
|
196
162
|
def mickey_check_items(self) -> typing.Optional[bool]:
|
|
197
163
|
"""
|
|
198
164
|
Whether the menu group has mickey check items.
|
|
@@ -200,12 +166,9 @@ class MenuGroup:
|
|
|
200
166
|
Returns:
|
|
201
167
|
(typing.Optional[bool]): Whether the menu group has mickey check items.
|
|
202
168
|
"""
|
|
203
|
-
|
|
204
|
-
return self._raw_menu_group_data["mickeyCheckItems"]
|
|
205
|
-
except KeyError:
|
|
206
|
-
return None
|
|
169
|
+
return self._raw_menu_group_data["mickeyCheckItems"]
|
|
207
170
|
|
|
208
|
-
@
|
|
171
|
+
@json_property
|
|
209
172
|
def names(self) -> typing.Optional[dict]:
|
|
210
173
|
"""
|
|
211
174
|
The names of the menu group.
|
|
@@ -213,12 +176,9 @@ class MenuGroup:
|
|
|
213
176
|
Returns:
|
|
214
177
|
(typing.Optional[dict]): The names of the menu group.
|
|
215
178
|
"""
|
|
216
|
-
|
|
217
|
-
return self._raw_menu_group_data["names"]
|
|
218
|
-
except KeyError:
|
|
219
|
-
return None
|
|
179
|
+
return self._raw_menu_group_data["names"]
|
|
220
180
|
|
|
221
|
-
@
|
|
181
|
+
@json_property
|
|
222
182
|
def pc_short_name(self) -> typing.Optional[str]:
|
|
223
183
|
"""
|
|
224
184
|
The short name of the menu group.
|
|
@@ -226,12 +186,9 @@ class MenuGroup:
|
|
|
226
186
|
Returns:
|
|
227
187
|
(typing.Optional[str]): The short name of the menu group.
|
|
228
188
|
"""
|
|
229
|
-
|
|
230
|
-
return self._raw_menu_group_data["names"]["PCShort"]
|
|
231
|
-
except KeyError:
|
|
232
|
-
return None
|
|
189
|
+
return self._raw_menu_group_data["names"]["PCShort"]
|
|
233
190
|
|
|
234
|
-
@
|
|
191
|
+
@json_property
|
|
235
192
|
def pc_long_name(self) -> typing.Optional[str]:
|
|
236
193
|
"""
|
|
237
194
|
The long name of the menu group.
|
|
@@ -239,12 +196,9 @@ class MenuGroup:
|
|
|
239
196
|
Returns:
|
|
240
197
|
(typing.Optional[str]): The long name of the menu group.
|
|
241
198
|
"""
|
|
242
|
-
|
|
243
|
-
return self._raw_menu_group_data["names"]["PCLong"]
|
|
244
|
-
except KeyError:
|
|
245
|
-
return None
|
|
199
|
+
return self._raw_menu_group_data["names"]["PCLong"]
|
|
246
200
|
|
|
247
|
-
@
|
|
201
|
+
@json_property
|
|
248
202
|
def mobile_short_name(self) -> typing.Optional[str]:
|
|
249
203
|
"""
|
|
250
204
|
The short name of the menu group.
|
|
@@ -252,12 +206,9 @@ class MenuGroup:
|
|
|
252
206
|
Returns:
|
|
253
207
|
(typing.Optional[str]): The short name of the menu group.
|
|
254
208
|
"""
|
|
255
|
-
|
|
256
|
-
return self._raw_menu_group_data["names"]["MobileShort"]
|
|
257
|
-
except KeyError:
|
|
258
|
-
return None
|
|
209
|
+
return self._raw_menu_group_data["names"]["MobileShort"]
|
|
259
210
|
|
|
260
|
-
@
|
|
211
|
+
@json_property
|
|
261
212
|
def mobile_long_name(self) -> typing.Optional[str]:
|
|
262
213
|
"""
|
|
263
214
|
The long name of the menu group.
|
|
@@ -265,10 +216,7 @@ class MenuGroup:
|
|
|
265
216
|
Returns:
|
|
266
217
|
(typing.Optional[str]): The long name of the menu group.
|
|
267
218
|
"""
|
|
268
|
-
|
|
269
|
-
return self._raw_menu_group_data["names"]["MobileLong"]
|
|
270
|
-
except KeyError:
|
|
271
|
-
return None
|
|
219
|
+
return self._raw_menu_group_data["names"]["MobileLong"]
|
|
272
220
|
|
|
273
221
|
@property
|
|
274
222
|
def menu_items(self) -> typing.Optional[list[MenuItem]]:
|
|
@@ -292,7 +240,7 @@ class Menu:
|
|
|
292
240
|
def __str__(self):
|
|
293
241
|
return f"Menu(entity_id={self.entity_id}, menu_type={self.menu_type}, parent_restaurant_id={self._parent_restaurant_id})"
|
|
294
242
|
|
|
295
|
-
@
|
|
243
|
+
@json_property
|
|
296
244
|
def entity_id(self) -> typing.Optional[str]:
|
|
297
245
|
"""
|
|
298
246
|
The entity id of the menu.
|
|
@@ -300,12 +248,9 @@ class Menu:
|
|
|
300
248
|
Returns:
|
|
301
249
|
(typing.Optional[str]): The entity id of the menu.
|
|
302
250
|
"""
|
|
303
|
-
|
|
304
|
-
return self._raw_menu_data["id"]
|
|
305
|
-
except KeyError:
|
|
306
|
-
return None
|
|
251
|
+
return self._raw_menu_data["id"]
|
|
307
252
|
|
|
308
|
-
@
|
|
253
|
+
@json_property
|
|
309
254
|
def menu_type(self) -> typing.Optional[str]:
|
|
310
255
|
"""
|
|
311
256
|
The type of the menu.
|
|
@@ -313,12 +258,9 @@ class Menu:
|
|
|
313
258
|
Returns:
|
|
314
259
|
(typing.Optional[str]): The type of the menu.
|
|
315
260
|
"""
|
|
316
|
-
|
|
317
|
-
return self._raw_menu_data["menuType"]
|
|
318
|
-
except KeyError:
|
|
319
|
-
return None
|
|
261
|
+
return self._raw_menu_data["menuType"]
|
|
320
262
|
|
|
321
|
-
@
|
|
263
|
+
@json_property
|
|
322
264
|
def localized_menu_type(self) -> typing.Optional[str]:
|
|
323
265
|
"""
|
|
324
266
|
The localized type of the menu.
|
|
@@ -326,12 +268,9 @@ class Menu:
|
|
|
326
268
|
Returns:
|
|
327
269
|
(typing.Optional[str]): The localized type of the menu.
|
|
328
270
|
"""
|
|
329
|
-
|
|
330
|
-
return self._raw_menu_data["localizedMenuType"]
|
|
331
|
-
except KeyError:
|
|
332
|
-
return None
|
|
271
|
+
return self._raw_menu_data["localizedMenuType"]
|
|
333
272
|
|
|
334
|
-
@
|
|
273
|
+
@json_property
|
|
335
274
|
def experience_type(self) -> typing.Optional[str]:
|
|
336
275
|
"""
|
|
337
276
|
The experience type of the menu.
|
|
@@ -339,12 +278,9 @@ class Menu:
|
|
|
339
278
|
Returns:
|
|
340
279
|
(typing.Optional[str]): The experience type of the menu.
|
|
341
280
|
"""
|
|
342
|
-
|
|
343
|
-
return self._raw_menu_data["experienceType"]
|
|
344
|
-
except KeyError:
|
|
345
|
-
return None
|
|
281
|
+
return self._raw_menu_data["experienceType"]
|
|
346
282
|
|
|
347
|
-
@
|
|
283
|
+
@json_property
|
|
348
284
|
def service_style(self) -> typing.Optional[str]:
|
|
349
285
|
"""
|
|
350
286
|
The service style of the menu.
|
|
@@ -352,12 +288,9 @@ class Menu:
|
|
|
352
288
|
Returns:
|
|
353
289
|
(typing.Optional[str]): The service style of the menu.
|
|
354
290
|
"""
|
|
355
|
-
|
|
356
|
-
return self._raw_menu_data["serviceStyle"]
|
|
357
|
-
except KeyError:
|
|
358
|
-
return None
|
|
291
|
+
return self._raw_menu_data["serviceStyle"]
|
|
359
292
|
|
|
360
|
-
@
|
|
293
|
+
@json_property
|
|
361
294
|
def primary_cuisine_type(self) -> typing.Optional[str]:
|
|
362
295
|
"""
|
|
363
296
|
The primary cuisine type of the menu.
|
|
@@ -365,12 +298,9 @@ class Menu:
|
|
|
365
298
|
Returns:
|
|
366
299
|
(typing.Optional[str]): The primary cuisine type of the menu.
|
|
367
300
|
"""
|
|
368
|
-
|
|
369
|
-
return self._raw_menu_data["primaryCuisineType"]
|
|
370
|
-
except KeyError:
|
|
371
|
-
return None
|
|
301
|
+
return self._raw_menu_data["primaryCuisineType"]
|
|
372
302
|
|
|
373
|
-
@
|
|
303
|
+
@json_property
|
|
374
304
|
def secondary_cuisine_type(self) -> typing.Optional[str]:
|
|
375
305
|
"""
|
|
376
306
|
The secondary cuisine type of the menu.
|
|
@@ -378,10 +308,7 @@ class Menu:
|
|
|
378
308
|
Returns:
|
|
379
309
|
(typing.Optional[str]): The secondary cuisine type of the menu.
|
|
380
310
|
"""
|
|
381
|
-
|
|
382
|
-
return self._raw_menu_data["secondaryCuisineType"]
|
|
383
|
-
except KeyError:
|
|
384
|
-
return None
|
|
311
|
+
return self._raw_menu_data["secondaryCuisineType"]
|
|
385
312
|
|
|
386
313
|
@property
|
|
387
314
|
def menu_groups(self) -> list[MenuGroup]:
|
|
@@ -406,10 +333,15 @@ class Menus(DisneyAPIMixin):
|
|
|
406
333
|
self.entity_id = restaurant_channel_id.rsplit(".", 1)[-1]
|
|
407
334
|
self._menu_service_url = f"{self._menu_service_base}/{self.entity_id}"
|
|
408
335
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
336
|
+
self._refresh_interval: timedelta = timedelta(
|
|
337
|
+
hours=12
|
|
338
|
+
) # properties are rarely updated, no need to spam the API
|
|
339
|
+
self._tz = ZoneInfo("UTC")
|
|
340
|
+
|
|
341
|
+
self._disney_data: typing.Optional[dict] = None
|
|
342
|
+
self._disney_data_pull_time: datetime = datetime.now(tz=self._tz)
|
|
343
|
+
if not lazy_load:
|
|
344
|
+
self.refresh()
|
|
413
345
|
|
|
414
346
|
def __str__(self):
|
|
415
347
|
return f"Menus(entity_id={self.entity_id})"
|
|
@@ -417,7 +349,13 @@ class Menus(DisneyAPIMixin):
|
|
|
417
349
|
def __repr__(self):
|
|
418
350
|
return f"Menus(restaurant_channel_id={self.entity_id})"
|
|
419
351
|
|
|
420
|
-
|
|
352
|
+
def refresh(self) -> None:
|
|
353
|
+
"""Pulls initial data if none exists or if it is older than the refresh interval"""
|
|
354
|
+
if self._disney_data is None or datetime.now(tz=self._tz) - self.last_refresh > self._refresh_interval:
|
|
355
|
+
self._disney_data = self.get_disney_data(self._menu_service_url)
|
|
356
|
+
self._disney_data_pull_time = datetime.now(tz=self._tz)
|
|
357
|
+
|
|
358
|
+
@disney_property(default_value=[])
|
|
421
359
|
def menus(self) -> list[Menu]:
|
|
422
360
|
"""
|
|
423
361
|
Returns a list of all the menus associated with this entity.
|
|
@@ -425,9 +363,52 @@ class Menus(DisneyAPIMixin):
|
|
|
425
363
|
Returns:
|
|
426
364
|
(list[Menu]): List of Menu objects that are associated with this entity.
|
|
427
365
|
"""
|
|
428
|
-
|
|
429
|
-
|
|
366
|
+
|
|
367
|
+
return [Menu(i, self.entity_id) for i in self._disney_data["menus"]]
|
|
368
|
+
|
|
369
|
+
@disney_property()
|
|
370
|
+
def facility_name(self) -> typing.Optional[str]:
|
|
371
|
+
"""
|
|
372
|
+
The name of the facility.
|
|
373
|
+
|
|
374
|
+
Returns:
|
|
375
|
+
(typing.Optional[str]): The name of the facility.
|
|
376
|
+
"""
|
|
377
|
+
return self._disney_data["facilityName"]
|
|
378
|
+
|
|
379
|
+
@disney_property()
|
|
380
|
+
def ancestor_location_park_resort(self) -> typing.Optional[str]:
|
|
381
|
+
"""
|
|
382
|
+
The name of the ancestor location.
|
|
383
|
+
|
|
384
|
+
Returns:
|
|
385
|
+
(typing.Optional[str]): The name of the ancestor location.
|
|
386
|
+
"""
|
|
387
|
+
return self._disney_data["ancestorLocationParkResort"]
|
|
388
|
+
|
|
389
|
+
@disney_property()
|
|
390
|
+
def ancestor_location_land_area(self) -> typing.Optional[str]:
|
|
391
|
+
"""
|
|
392
|
+
The name of the ancestor location.
|
|
393
|
+
|
|
394
|
+
Returns:
|
|
395
|
+
(typing.Optional[str]): The name of the ancestor location.
|
|
396
|
+
"""
|
|
397
|
+
return self._disney_data["ancestorLocationLandArea"]
|
|
398
|
+
|
|
399
|
+
@property
|
|
400
|
+
def last_refresh(self) -> datetime:
|
|
401
|
+
"""
|
|
402
|
+
The last time the menus were refreshed.
|
|
403
|
+
|
|
404
|
+
Returns:
|
|
405
|
+
(datetime): The last time the menus were refreshed.
|
|
406
|
+
"""
|
|
407
|
+
if self._disney_data is None:
|
|
408
|
+
self._disney_data = self.get_disney_data(self.entity_id)
|
|
430
409
|
try:
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
return
|
|
410
|
+
refresh_time = isoparse(self._disney_data["lastRefresh"])
|
|
411
|
+
refresh_time = refresh_time.replace(tzinfo=self._tz)
|
|
412
|
+
return refresh_time
|
|
413
|
+
except (KeyError, TypeError, ValueError):
|
|
414
|
+
return self._disney_data_pull_time
|
|
@@ -3,7 +3,7 @@ from datetime import datetime, timedelta
|
|
|
3
3
|
from enum import Enum
|
|
4
4
|
|
|
5
5
|
from mousetools.channels.enums import DestinationTimezones, DLRCouchbaseChannels, WDWCouchbaseChannels
|
|
6
|
-
from mousetools.enums import DestinationShort
|
|
6
|
+
from mousetools.enums import DestinationShort, EntityType
|
|
7
7
|
from mousetools.mixins.couchbase import CouchbaseMixin
|
|
8
8
|
|
|
9
9
|
|
|
@@ -44,6 +44,15 @@ class CouchbaseChannel(CouchbaseMixin):
|
|
|
44
44
|
|
|
45
45
|
return [i["id"] for i in self._cb_data["results"]]
|
|
46
46
|
|
|
47
|
+
def _get_children_objects_helper(self, class_obj, entity_type: EntityType) -> list:
|
|
48
|
+
self.refresh()
|
|
49
|
+
channels = []
|
|
50
|
+
check_for = f"entitytype={entity_type.value}".lower()
|
|
51
|
+
for i in self._cb_data["results"]:
|
|
52
|
+
if check_for == i["id"].rsplit(";")[-1].lower():
|
|
53
|
+
channels.append(class_obj(i["id"]))
|
|
54
|
+
return channels
|
|
55
|
+
|
|
47
56
|
def __repr__(self):
|
|
48
57
|
return f"{self.__class__.__name__}(channel_id='{self.channel_id}')"
|
|
49
58
|
|