Skip to content

Commit

Permalink
Add permit search
Browse files Browse the repository at this point in the history
  • Loading branch information
changlan committed Jul 7, 2023
1 parent f807634 commit 6c273d6
Show file tree
Hide file tree
Showing 18 changed files with 496 additions and 3 deletions.
3 changes: 3 additions & 0 deletions camply/config/api_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ class RIDBConfig:
CAMPGROUND_FACILITY_FIELD_QUALIFIER: str = "Campground"
TICKET_FACILITY_FIELD_QUALIFIER: str = "Ticket Facility"
TIMED_ENTRY_FACILITY_FIELD_QUALIFIER: str = "Timed Entry"
PERMIT_FACILITY_FIELD_QUALIFIER: str = "Permit"
# RECREATION AREA FIELDS
REC_AREA_API_PATH: str = "recareas"
# CAMPSITE DETAILS
CAMPSITE_API_PATH: str = "campsites"
# TOUR DETAILS
TOUR_API_PATH: str = "tours"
# PERMIT ENTRANCE DETAILS
PERMIT_ENTRANCE_API_PATH: str = "permitentrances"


class RecreationBookingConfig:
Expand Down
72 changes: 71 additions & 1 deletion camply/containers/api_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,78 @@ class RecDotGovSearchResponse(CamplyModel):
Parent Response from Search Results
"""

results: List[RecDotGovSearchResult]
results: Optional[List[RecDotGovSearchResult]]
size: int
spelling_autocorrected: Any
start: int
total: int


class RecDotGovPermitMapping(CamplyModel):
day_use_permit_ids: List[str]
early_access_permit_ids: List[str]
hunting_permit_ids: List[str]
itinerary_permit_ids: List[str]
land_permit_ids: List[str]
lottery_permit_ids: List[str]
vehicle_permit_ids: List[str]
water_permit_ids: List[str]


class RecDotGovPermitMappingResponse(CamplyModel):
payload: RecDotGovPermitMapping


class _PermitEntranceAttribute(CamplyModel):
AttributeID: Optional[int]
AttributeName: str
AttributeValue: str


class _PermitEntranceZone(CamplyModel):
PermitEntranceZoneID: int
Zone: str


class PermitEntranceResponse(CoreRecDotGovResponse):
"""
https://ridb.recreation.gov/api/v1/permitentrances/<PERMIT ENTRANCE ID>
"""

PermitEntranceID: int
FacilityID: int
PermitEntranceName: str
PermitEntranceDescription: str
District: str
Town: str
PermitEntranceAccessible: bool
Longitude: float
Latitude: float
CreatedDate: datetime.date
LastUpdatedDate: datetime.date
ATTRIBUTES: List[_PermitEntranceAttribute]
ZONES: List[_PermitEntranceZone]

def __str__(self) -> str:
"""
String Representation
"""
return f"{self.PermitEntranceName} (#{self.PermitEntranceID})"


class PermitEntranceForFacilityResponse(CoreRecDotGovResponse):
"""
https://ridb.recreation.gov/api/v1/facilities/<FACILITY ID>/permitentrances
"""
RECDATA: List[PermitEntranceResponse]
METADATA: Dict[str, Dict[str, Union[int, str]]]


class PermitAvailability(CamplyModel):
total: int
remaining: int
is_walkup: bool


class PermitMonthlyAvailabilityResponse(CamplyModel):
payload: Dict[datetime.date, Dict[int, PermitAvailability]]
Empty file modified camply/notifications/apprise.py
100755 → 100644
Empty file.
Empty file modified camply/notifications/base_notifications.py
100755 → 100644
Empty file.
Empty file modified camply/notifications/email_notifications.py
100755 → 100644
Empty file.
Empty file modified camply/notifications/ntfy.py
100755 → 100644
Empty file.
Empty file modified camply/notifications/pushbullet.py
100755 → 100644
Empty file.
Empty file modified camply/notifications/pushover.py
100755 → 100644
Empty file.
Empty file modified camply/notifications/silent_notifications.py
100755 → 100644
Empty file.
Empty file modified camply/notifications/slack.py
100755 → 100644
Empty file.
Empty file modified camply/notifications/telegram.py
100755 → 100644
Empty file.
Empty file modified camply/notifications/twilio.py
100755 → 100644
Empty file.
3 changes: 3 additions & 0 deletions camply/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
RecreationDotGovTicket,
RecreationDotGovTimedEntry,
)
from .recreation_dot_gov.recdotgov_permits import RecreationDotGovPermit
from .usedirect.variations import (
AlabamaStateParks,
ArizonaStateParks,
Expand All @@ -36,6 +37,7 @@
RecreationDotGovDailyTimedEntry,
RecreationDotGovTicket,
RecreationDotGovTimedEntry,
RecreationDotGovPermit,
Yellowstone,
ReserveCalifornia,
NorthernTerritory,
Expand All @@ -60,6 +62,7 @@
"RecreationDotGovDailyTimedEntry",
"RecreationDotGovTicket",
"RecreationDotGovTimedEntry",
"RecreationDotGovPermit",
"Yellowstone",
"ReserveCalifornia",
"NorthernTerritory",
Expand Down
Loading

0 comments on commit 6c273d6

Please sign in to comment.