Skip to content

Commit

Permalink
Breakout memberships call
Browse files Browse the repository at this point in the history
  • Loading branch information
nikdoof committed Nov 11, 2023
1 parent 2a2b004 commit 3156fb3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion hackspaceapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

class HealthResponse(BaseModel):
health: str = Field(description="State of the API", examples=["ok", "error"])
version: str = Field(description="Version of the API", examples=["0.1.0"])
version: str = Field(description="Version of the API", examples=[VERSION])


@app.get(
Expand Down
20 changes: 13 additions & 7 deletions hackspaceapi/spaceapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ def get_links() -> list:
]


# TODO: replace with calls to the website data
@ttl_cache(1800)
def get_membership_plans() -> list:
return [
{'name': 'Member', 'value': 25, 'currency': 'GBP', 'billing_interval': 'monthly'},
{'name': 'Member+', 'value': 30, 'currency': 'GBP', 'billing_interval': 'monthly'},
{'name': 'Concession', 'value': 18, 'currency': 'GBP', 'billing_interval': 'monthly'},
{'name': 'Family', 'value': 40, 'currency': 'GBP', 'billing_interval': 'monthly'},
{'name': 'Day Pass', 'value': 5, 'currency': 'GBP', 'billing_interval': 'daily'},
]


@spaceapi.get("/space.json", description='Returns a SpaceAPI JSON supporting v13 and v14 of the schema', tags=['SpaceAPI'])
async def space_json():
data = {
Expand Down Expand Up @@ -211,13 +223,7 @@ async def space_json():
},
"links": get_links(),
"issue_report_channels": ["email"],
"membership_plans": [
{'name': 'Member', 'value': 25, 'currency': 'GBP', 'billing_interval': 'monthly'},
{'name': 'Member+', 'value': 30, 'currency': 'GBP', 'billing_interval': 'monthly'},
{'name': 'Concession', 'value': 18, 'currency': 'GBP', 'billing_interval': 'monthly'},
{'name': 'Family', 'value': 40, 'currency': 'GBP', 'billing_interval': 'monthly'},
{'name': 'Day Pass', 'value': 5, 'currency': 'GBP', 'billing_interval': 'daily'},
]
"membership_plans": get_membership_plans(),
}

return data

0 comments on commit 3156fb3

Please sign in to comment.