Esempio n. 1
0
    def get(self, **kwargs):
        results = {}
        results['results'] = {}

        if('facebookId' in kwargs['parameters']):
            results['results'] = SpotModel.listByUserFacebookId(kwargs['parameters']['facebookId'])

        elif('city' in kwargs['parameters']):
            results['results'] = SpotModel.listByCity(kwargs['parameters']['city'])

        elif('lng' in kwargs['parameters'] and 'lat' in kwargs['parameters'] and 'range' in kwargs['parameters']):
            results['results'] = SpotModel.listNearby(kwargs['parameters']['lng'], kwargs['parameters']['lat'], kwargs['parameters']['range'])

        return results
Esempio n. 2
0
    def post(self, id, **kwargs):
        results = {}

        # TODO from MOBergeron (2015-10-12):
        #   Implement the Google API call to get the city location of the lat/lng of the spot.
        #   NOTE : The API looks to have a quota unless we have an APIKey.
        #   EXAMPLE :
        #       "http://maps.googleapis.com/maps/api/geocode/json?latlng={},{}&sensor=true".format(lat,lng)

        city = ""

        if('message' in kwargs['parameters'] and 'lng' in kwargs['parameters'] and 'lat' in kwargs['parameters']):
            results['results'] = SpotModel.create(id, kwargs['parameters']['message'], kwargs['parameters']['lng'], kwargs['parameters']['lat'], city)

        return results
Esempio n. 3
0
 def get(self, id):
     results = {}
     results['results'] = SpotModel.getById(id)
     return results