Ejemplo n.º 1
0
 def get_profile_photo(self, size='medium'):
     if size not in ('small', 'medium', 'large'):
         raise InvalidSizeException('User get_profile_photo size must one of "small", "medium" or "large".')
     from mapmyfitness import MapMyFitness
     instance = MapMyFitness.instance()
     user_profile_photo = instance._user_profile_photo.find(self.id)
     return getattr(user_profile_photo, size)
Ejemplo n.º 2
0
 def get_profile_photo(self, size='medium'):
     if size not in ('small', 'medium', 'large'):
         raise InvalidSizeException(
             'User get_profile_photo size must one of "small", "medium" or "large".'
         )
     from mapmyfitness import MapMyFitness
     instance = MapMyFitness.instance()
     user_profile_photo = instance._user_profile_photo.find(self.id)
     return getattr(user_profile_photo, size)
Ejemplo n.º 3
0
 def activity_type(self):
     if hasattr(self, '_activity_type'):
         return self._activity_type
     else:
         from mapmyfitness import MapMyFitness
         instance = MapMyFitness.instance()
         activity_type = instance.activity_type.find(self.activity_type_id)
         self._activity_type = activity_type
         return self._activity_type
Ejemplo n.º 4
0
    def activity_type(self):
        if hasattr(self, "_activity_type"):
            return self._activity_type
        else:
            from mapmyfitness import MapMyFitness

            instance = MapMyFitness.instance()
            activity_type = instance.activity_type.find(self.activity_type_id)
            self._activity_type = activity_type
            return self._activity_type
Ejemplo n.º 5
0
 def route(self):
     if self.route_id:
         if hasattr(self, '_route'):
             return self._route
         else:
             from mapmyfitness import MapMyFitness
             instance = MapMyFitness.instance()
             route = instance.route.find(self.route_id)
             self._route = route
             return self._route
Ejemplo n.º 6
0
 def route(self):
     if self.route_id:
         if hasattr(self, '_route'):
             return self._route
         else:
             from mapmyfitness import MapMyFitness
             instance = MapMyFitness.instance()
             route = instance.route.find(self.route_id)
             self._route = route
             return self._route
 def root_activity_type(self):
     if not self.has_parent:
         return self
     if hasattr(self, '_activity_type'):
         return self._activity_type
     else:
         from mapmyfitness import MapMyFitness
         instance = MapMyFitness.instance()
         activity_type = instance.activity_type.find(self.root_activity_type_id)
         self._activity_type = activity_type
         return self._activity_type
Ejemplo n.º 8
0
 def time_series(self):
     if self.has_time_series:
         if 'time_series' in self.original_dict:
             return self.original_dict['time_series']
         elif hasattr(self, '_time_series'):
             return self._time_series
         else:
             from mapmyfitness import MapMyFitness
             instance = MapMyFitness.instance()
             workout = instance.workout.find(self.id)
             self._time_series = workout.time_series
             return self._time_series
Ejemplo n.º 9
0
 def time_series(self):
     if self.has_time_series:
         if 'time_series' in self.original_dict:
             return self.original_dict['time_series']
         elif hasattr(self, '_time_series'):
             return self._time_series
         else:
             from mapmyfitness import MapMyFitness
             instance = MapMyFitness.instance()
             workout = instance.workout.find(self.id)
             self._time_series = workout.time_series
             return self._time_series
Ejemplo n.º 10
0
    def __getattr__(self, name):
        # First checking to see if we're entering a recursion
        # cycle, and if so exiting immediately. Calling `hasattr(self, name)`
        # will call getattr(self, name) itself and therefore keep recursing.
        if '__getattr__' in inspect.stack()[1]:
            raise AttributeNotFoundException

        from mapmyfitness import MapMyFitness
        instance = MapMyFitness.instance()
        user = instance.user.find(self.id)
        self.__init__(user.original_dict)

        return getattr(self, name)
Ejemplo n.º 11
0
    def __getattr__(self, name):
        # First checking to see if we're entering a recursion
        # cycle, and if so exiting immediately. Calling `hasattr(self, name)`
        # will call getattr(self, name) itself and therefore keep recursing.
        if '__getattr__' in inspect.stack()[1]:
            raise AttributeNotFoundException

        from mapmyfitness import MapMyFitness
        instance = MapMyFitness.instance()
        user = instance.user.find(self.id)
        self.__init__(user.original_dict)

        return getattr(self, name)
    def test_MapMyFitness_instance(self):
        MapMyFitness('api-key', 'access_token')

        assert MapMyFitness.instance()
Ejemplo n.º 13
0
    def test_MapMyFitness_instance(self):
        MapMyFitness('api-key', 'access_token')

        assert MapMyFitness.instance()
Ejemplo n.º 14
0
 def get_friends(self):
     from mapmyfitness import MapMyFitness
     instance = MapMyFitness.instance()
     friends = instance.user.search(friends_with=self.id)
     return friends
Ejemplo n.º 15
0
 def get_friends(self):
     from mapmyfitness import MapMyFitness
     instance = MapMyFitness.instance()
     friends = instance.user.search(friends_with=self.id)
     return friends