otf-api 0.13.0__py3-none-any.whl → 0.13.2__py3-none-any.whl

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.
otf_api/__init__.py CHANGED
@@ -36,7 +36,7 @@ def _setup_logging() -> None:
36
36
 
37
37
  _setup_logging()
38
38
 
39
- __version__ = "0.13.0"
39
+ __version__ = "0.13.2"
40
40
 
41
41
 
42
42
  __all__ = ["Otf", "OtfUser", "models"]
@@ -80,7 +80,7 @@ class BookingApi:
80
80
  ends_before=end_date, starts_after=start_date, include_canceled=include_canceled, expand=expand
81
81
  )
82
82
 
83
- results = [models.BookingV2.create(**b, api=self) for b in bookings_resp]
83
+ results = [models.BookingV2.create(**b, api=self.otf) for b in bookings_resp]
84
84
 
85
85
  if not remove_duplicates:
86
86
  return results
@@ -188,7 +188,7 @@ class BookingApi:
188
188
  for c in classes_resp:
189
189
  c["studio"] = studio_dict[c["studio"]["id"]] # the one (?) place where ID actually means UUID
190
190
  c["is_home_studio"] = c["studio"].studio_uuid == self.otf.home_studio_uuid
191
- classes.append(models.OtfClass(**c))
191
+ classes.append(models.OtfClass.create(**c, api=self.otf))
192
192
 
193
193
  # additional data filtering and enrichment
194
194
 
@@ -228,7 +228,7 @@ class BookingApi:
228
228
  raise ValueError("booking_uuid is required")
229
229
 
230
230
  data = self.client.get_booking(booking_uuid)
231
- return models.Booking.create(**data, api=self)
231
+ return models.Booking.create(**data, api=self.otf)
232
232
 
233
233
  def get_booking_from_class(self, otf_class: str | models.OtfClass) -> models.Booking:
234
234
  """Get a specific booking by class_uuid or OtfClass object.
@@ -337,7 +337,7 @@ class BookingApi:
337
337
 
338
338
  resp = self.client.post_class_new(body)
339
339
 
340
- new_booking = models.BookingV2.create(**resp, api=self)
340
+ new_booking = models.BookingV2.create(**resp, api=self.otf)
341
341
 
342
342
  return new_booking
343
343
 
@@ -443,7 +443,7 @@ class BookingApi:
443
443
  b["class"]["studio"] = studios[b["class"]["studio"]["studioUUId"]]
444
444
  b["is_home_studio"] = b["class"]["studio"].studio_uuid == self.otf.home_studio_uuid
445
445
 
446
- bookings = [models.Booking.create(**b, api=self) for b in resp]
446
+ bookings = [models.Booking.create(**b, api=self.otf) for b in resp]
447
447
  bookings = sorted(bookings, key=lambda x: x.otf_class.starts_at)
448
448
 
449
449
  if exclude_cancelled:
@@ -134,7 +134,7 @@ class MemberApi:
134
134
 
135
135
  res = self.client.put_member_name(first_name, last_name)
136
136
 
137
- return models.MemberDetail.create(**res, api=self)
137
+ return models.MemberDetail.create(**res, api=self.otf)
138
138
 
139
139
  def get_member_detail(self) -> models.MemberDetail:
140
140
  """Get the member details.
@@ -148,7 +148,7 @@ class MemberApi:
148
148
  home_studio_uuid = data["homeStudio"]["studioUUId"]
149
149
  data["home_studio"] = self.otf.studios.get_studio_detail(home_studio_uuid)
150
150
 
151
- return models.MemberDetail.create(**data, api=self)
151
+ return models.MemberDetail.create(**data, api=self.otf)
152
152
 
153
153
  def get_member_membership(self) -> models.MemberMembership:
154
154
  """Get the member's membership details.
@@ -56,7 +56,7 @@ class StudioApi:
56
56
 
57
57
  new_faves = resp.get("studios", [])
58
58
 
59
- return [models.StudioDetail.create(**studio, api=self) for studio in new_faves]
59
+ return [models.StudioDetail.create(**studio, api=self.otf) for studio in new_faves]
60
60
 
61
61
  def remove_favorite_studio(self, studio_uuids: list[str] | str) -> None:
62
62
  """Remove a studio from the member's favorite studios.
@@ -116,7 +116,7 @@ class StudioApi:
116
116
  except exc.ResourceNotFoundError:
117
117
  return models.StudioDetail.create_empty_model(studio_uuid)
118
118
 
119
- return models.StudioDetail.create(**res, api=self)
119
+ return models.StudioDetail.create(**res, api=self.otf)
120
120
 
121
121
  def get_studios_by_geo(
122
122
  self, latitude: float | None = None, longitude: float | None = None
@@ -141,7 +141,7 @@ class StudioApi:
141
141
  longitude = longitude or self.otf.home_studio.location.longitude
142
142
 
143
143
  results = self.client.get_studios_by_geo(latitude, longitude, distance)
144
- return [models.StudioDetail.create(**studio, api=self) for studio in results]
144
+ return [models.StudioDetail.create(**studio, api=self.otf) for studio in results]
145
145
 
146
146
  def _get_all_studios(self) -> list[models.StudioDetail]:
147
147
  """Gets all studios. Marked as private to avoid random users calling it.
@@ -153,7 +153,7 @@ class StudioApi:
153
153
  """
154
154
  # long/lat being None will cause the endpoint to return all studios
155
155
  results = self.client.get_studios_by_geo(None, None)
156
- return [models.StudioDetail.create(**studio, api=self) for studio in results]
156
+ return [models.StudioDetail.create(**studio, api=self.otf) for studio in results]
157
157
 
158
158
  def _get_studio_detail_threaded(self, studio_uuids: list[str]) -> dict[str, models.StudioDetail]:
159
159
  """Get detailed information about multiple studios in a threaded manner.
@@ -169,5 +169,6 @@ class StudioApi:
169
169
  """
170
170
  studio_dicts = self.client.get_studio_detail_threaded(studio_uuids)
171
171
  return {
172
- studio_uuid: models.StudioDetail.create(**studio, api=self) for studio_uuid, studio in studio_dicts.items()
172
+ studio_uuid: models.StudioDetail.create(**studio, api=self.otf)
173
+ for studio_uuid, studio in studio_dicts.items()
173
174
  }
@@ -237,7 +237,7 @@ class WorkoutApi:
237
237
 
238
238
  perf_summary = self.client.get_performance_summary(booking.workout.performance_summary_id)
239
239
  telemetry = self.get_telemetry(booking.workout.performance_summary_id)
240
- workout = models.Workout.create(**perf_summary, v2_booking=booking, telemetry=telemetry, api=self)
240
+ workout = models.Workout.create(**perf_summary, v2_booking=booking, telemetry=telemetry, api=self.otf)
241
241
 
242
242
  return workout
243
243
 
@@ -275,7 +275,7 @@ class WorkoutApi:
275
275
  v2_booking=bookings_dict[perf_id],
276
276
  telemetry=telemetry_dict.get(perf_id),
277
277
  class_uuid=perf_summary_to_class_uuid_map.get(perf_id),
278
- api=self,
278
+ api=self.otf,
279
279
  )
280
280
  workouts.append(workout)
281
281
 
otf_api/models/mixins.py CHANGED
@@ -22,9 +22,8 @@ class ApiMixin:
22
22
  self._api = api
23
23
 
24
24
  @classmethod
25
- def create(cls, **kwargs) -> typing.Self:
25
+ def create(cls, api: "Otf", **kwargs) -> typing.Self:
26
26
  """Creates a new instance of the model with the given keyword arguments."""
27
- api = kwargs.pop("api", None)
28
27
  instance = cls(**kwargs)
29
28
  if api is not None:
30
29
  instance.set_api(api)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: otf-api
3
- Version: 0.13.0
3
+ Version: 0.13.2
4
4
  Summary: Python OrangeTheory Fitness API Client
5
5
  Author-email: Jessica Smith <j.smith.git1@gmail.com>
6
6
  License-Expression: MIT
@@ -1,4 +1,4 @@
1
- otf_api/__init__.py,sha256=mpjME4x_GP5hUzbQ99qMPuZ4pzbQNrYXLAXqnGNsXcw,1150
1
+ otf_api/__init__.py,sha256=B8xq2bcHRV-z-pluFbo3Ow-FBAYO4jG5hq6wll9FhqE,1150
2
2
  otf_api/cache.py,sha256=m4xUBhaS0MkcZypon1jjfhJzZPRQBE5Fto4_RMReXZ0,4311
3
3
  otf_api/exceptions.py,sha256=b6ZdH1dtYyUfXSupdVGGni6d66qqhzD0SGzyuty89gM,2174
4
4
  otf_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -8,16 +8,16 @@ otf_api/api/api.py,sha256=yda8RObOMd_lBWbqlAAUZ3dTwGhdEYsfGQJDiphp6Eo,2633
8
8
  otf_api/api/client.py,sha256=o533H-nYweRcosBEYmm3U-7ivkpGDF7jElM9iIhK7E8,8157
9
9
  otf_api/api/utils.py,sha256=mNDUrz6d8b8KqTaUr5fGGGejy6bq9HHLs9LS8ibbfW4,9926
10
10
  otf_api/api/bookings/__init__.py,sha256=ocHSZXV4nnkZhjpjBX76iKHCQ21_ZL5hV4YKgUR0Wwg,62
11
- otf_api/api/bookings/booking_api.py,sha256=s4GWT1MYUY0-EjXucj_8rcNfRP6o-sFGfVsmY3RJMdM,22087
11
+ otf_api/api/bookings/booking_api.py,sha256=VdEX5WF3TIV5V_1n2DclBPqxhXQysNqyxJxeR6c05UM,22124
12
12
  otf_api/api/bookings/booking_client.py,sha256=qYaEomexGWP2N_WdWePMN7BR8aIKEpO71g5J0KaVfAc,4244
13
13
  otf_api/api/members/__init__.py,sha256=6mkeMiATRsNQTYQ37P7k6SWf9RZ9T5QY9-_r1sS1-vY,59
14
- otf_api/api/members/member_api.py,sha256=bpSnUWrLbrqkIcwhzaPonkWTa9-gLPdadzE4ec_meT0,7224
14
+ otf_api/api/members/member_api.py,sha256=5FAPbRN_Dv3mLC1AmxcErqF1d1ypL5zVEn1u7gDbTZA,7232
15
15
  otf_api/api/members/member_client.py,sha256=d6v6vexmtiedw1-lXLMobbN8tTmRT-zHq7VzdJb5wDE,4528
16
16
  otf_api/api/studios/__init__.py,sha256=vPir509hQOJL7uJ4yBCOHgooXVnXs6N5RlWs1tN54Uk,59
17
- otf_api/api/studios/studio_api.py,sha256=qggdaTGeYtrE1q5oV8ozCqAC5Xv6DtwVG5dHzSB1q74,6781
17
+ otf_api/api/studios/studio_api.py,sha256=sn1jBebe4u-wE1VkHp2W96beUOFwHdiGzVSmnGNPZjg,6813
18
18
  otf_api/api/studios/studio_client.py,sha256=KWc4CF-2387WDUFYpMtIUm3KyPj1JdelCn7RH9L1FBI,4707
19
19
  otf_api/api/workouts/__init__.py,sha256=GPb2cEsAxoaiJIP8Finrk9x9vUeL9NXA9iz2eya9HYk,62
20
- otf_api/api/workouts/workout_api.py,sha256=h65nEt2-2mYV33tiVkv2N6L7NoEJ_naViw-IrMnEn8E,13207
20
+ otf_api/api/workouts/workout_api.py,sha256=prlqDFF4VXuzC7SRPpmD_yeZuMAp-dnfaSa52I4SM9o,13215
21
21
  otf_api/api/workouts/workout_client.py,sha256=MvEWbhPXywpQMSdsBSGCYBIR65TJjdqgb7T0Bc8H8D0,6762
22
22
  otf_api/auth/__init__.py,sha256=uTvFTNQVvfogTN_-4D3bRSundAf2enUJ5ji6PwO0xm8,104
23
23
  otf_api/auth/auth.py,sha256=67-RXDla3rVm5vmlyPEOqPOF5kecJiEznVmq0gSz3M0,16448
@@ -25,7 +25,7 @@ otf_api/auth/user.py,sha256=OChRG0EhZ63vEtT_Sg3NmXWmOD1vZcILuHhRXlwaG0I,2156
25
25
  otf_api/auth/utils.py,sha256=YBxqg2h59u4V1ij5kgqJDyKh0gtgOlXrSZdpAKSdelY,3954
26
26
  otf_api/models/__init__.py,sha256=P0IjxRUPIfzUI-e3VDMpipJeWr6BlypWAED2ovnZw-w,1545
27
27
  otf_api/models/base.py,sha256=KJlIxl_sRj6f-g5vKYPw4yV6fGDk-fwZ93EO0JGPYMw,202
28
- otf_api/models/mixins.py,sha256=mY9ufoi3QJM5H7KMU9q7grgYuZp85xLs8ie2aLikvi8,4164
28
+ otf_api/models/mixins.py,sha256=R2FvaxieTcJn7BRn_rPuuV84ZyuV0VS4dhIKw7am6R8,4138
29
29
  otf_api/models/bookings/__init__.py,sha256=-EtaVW9qF5dmWvSlkq693vkxc3bX6d7dWOgcnNNfpV4,642
30
30
  otf_api/models/bookings/bookings.py,sha256=YlocSxdOEECxcCsVkEYAXHFE3EmMTUBxXgSFFxskaLk,5681
31
31
  otf_api/models/bookings/bookings_v2.py,sha256=Jd9zh4E3AEWUyxLTISq2j2I_firKCfV5IQzNdkc7iK4,7965
@@ -52,8 +52,8 @@ otf_api/models/workouts/out_of_studio_workout_history.py,sha256=-BKp-MnIp_5-U2KW
52
52
  otf_api/models/workouts/performance_summary.py,sha256=R1p-g1L4XWWEiBYaGtX5JFvoS3Z6bzQrsPIfTQHDqyM,3464
53
53
  otf_api/models/workouts/telemetry.py,sha256=rKsmLbsOVUxUXH439zxxIEWYGTohKNemqrtMamAl5cA,3465
54
54
  otf_api/models/workouts/workout.py,sha256=_KIR9fLI4LgUlS02Q5SNauHd4aOqJI9H4uaFKf-xJOU,4580
55
- otf_api-0.13.0.dist-info/licenses/LICENSE,sha256=UaPT9ynYigC3nX8n22_rC37n-qmTRKLFaHrtUwF9ktE,1071
56
- otf_api-0.13.0.dist-info/METADATA,sha256=-x6Y4z5eG5ECRWfbS_jmbFr3oo6eNrKdrNMeDkMniuM,2162
57
- otf_api-0.13.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
- otf_api-0.13.0.dist-info/top_level.txt,sha256=KAhYg1X2YG0LkTuVRhUV1I_AReNZUVNdEan7cp0pEE4,8
59
- otf_api-0.13.0.dist-info/RECORD,,
55
+ otf_api-0.13.2.dist-info/licenses/LICENSE,sha256=UaPT9ynYigC3nX8n22_rC37n-qmTRKLFaHrtUwF9ktE,1071
56
+ otf_api-0.13.2.dist-info/METADATA,sha256=ABfr_86oOf234G_WSqA06txQG2igkLdAx7KaNhabQFs,2162
57
+ otf_api-0.13.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
+ otf_api-0.13.2.dist-info/top_level.txt,sha256=KAhYg1X2YG0LkTuVRhUV1I_AReNZUVNdEan7cp0pEE4,8
59
+ otf_api-0.13.2.dist-info/RECORD,,