Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Joco #787

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pybikes/data/joco.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"instances": [
{
"tag": "joco-new-york",
"bbox": [[40.528083, -74.206935],[40.942386, -73.725738]],
"meta": {
"city": "New York",
"name": "JOCO New York",
Expand All @@ -15,7 +14,7 @@
"longitude": -73.9859,
"ebikes": true
},
"feed_url": "https://ridejoco.com/locationinfo.json"
"feed_url": "https://platform.api.gourban.services/v1/joco/front/physical-stations"
}
],
"system": "joco",
Expand Down
24 changes: 12 additions & 12 deletions pybikes/joco.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import json

from pybikes import BikeShareSystem, BikeShareStation, PyBikesScraper
from pybikes.utils import Bounded


class Joco(Bounded, BikeShareSystem):
def __init__(self, tag, meta, bbox, feed_url):
super(Joco, self).__init__(tag, meta, bounds=bbox)
class Joco(BikeShareSystem):
def __init__(self, tag, meta, feed_url):
super(Joco, self).__init__(tag, meta)

self.feed_url = feed_url

Expand All @@ -27,21 +26,22 @@ def update(self, scraper=None):

class JocoStation(BikeShareStation):
def __init__(self, data):
super(JocoStation, self).__init__()

self.name = data["name"]
self.latitude = float(data["lat"])
self.longitude = float(data["lng"])
self.latitude = float(data["info"]["position"]["coordinates"][1])
self.longitude = float(data["info"]["position"]["coordinates"][0])

slots = int(data["totalcapacity"])
bikes = int(data["availabilty"])
bikes = int(data["slots"]["withAvailableVehicle"])

self.bikes = bikes
self.free = slots - bikes
self.free = int(data["slots"]["free"])

self.extra = {
"uid": data["id"],
'has_ebikes': True,
"ebikes": bikes,
"address": data["address"],
"postal_code": data["postal"],
"slots": slots
"address": data["info"]["address"],
"slots": int(data["slots"]["total"]),
'online': data["state"] == "OPEN",
}
Loading