Exemple #1
0
 def get(self):
     """
         GET request for Espys List
         Route: Routes['espy']
         Parameters :
         Returns:
             status: 200
             mimetype: application/json
             data:
                 teams: {
                         {
                            'date':  date,
                            'team': string,
                            'sponsor': string,
                            'description': string,
                            'points': int,
                            'receipt': string
                         }
                           ,{...}
                         ]
     """
     # return a pagination of teams
     page = request.args.get('page', 1, type=int)
     pagination = Espys.query.paginate(page, PAGE_SIZE, False)
     result = pagination_response(pagination, Routes['espy'])
     resp = Response(dumps(result), status=200,
                     mimetype="application/json")
     return resp
Exemple #2
0
 def get(self):
     """
         GET request for Bats List
         Route: Routes['bat']
         Parameters :
         Returns:
             status: 200
             mimetype: application/json
             data:
                 games: [  {
                             'bat_id': int,
                            'game_id': int,
                            'team_id': int,
                            'team': string,
                            'rbi': int,
                            'hit': string,
                            'inning': int,
                            'player_id': int,
                            'player': string
                           }
                             ,{...}
                        ]
     """
     #  return a pagination of bats
     page = request.args.get('page', 1, type=int)
     pagination = Bat.query.paginate(page, PAGE_SIZE, False)
     result = pagination_response(pagination, Routes['bat'])
     resp = Response(dumps(result), status=200,
                     mimetype="application/json")
     return resp
Exemple #3
0
 def get(self):
     """
         GET request for Games List
         Route: Routes['game']
         Parameters :
         Returns:
             status: 200
             mimetype: application/json
             data:
                 games: [  {
                             home_team: string
                             home_team_id: int,
                             away_team: string
                             away_team_id: int,
                             date: string,
                             time: string,
                             league_id: int,
                             game_id: int,
                             status: string,
                             field: string
                           }
                             ,{...}
                        ]
     """
     # return a pagination of games
     page = request.args.get('page', 1, type=int)
     pagination = Game.query.paginate(page, PAGE_SIZE, False)
     result = pagination_response(pagination, Routes['game'])
     resp = Response(dumps(result), status=200, mimetype="application/json")
     return resp
 def get(self):
     """
         GET request for Teams List
         Route: Routes['team']
         Parameters :
         Returns:
             status: 200
             mimetype: application/json
             data:
                 teams: [  {
                             'team_id':  int,
                            'team_name': string,
                            'color': string,
                            'sponsor_id': int,
                            'league_id': int,
                            'year': int,
                            'espys': int,
                            'captain': string
                             }
                           ,{...}
                         ]
     """
     # return a pagination of teams
     page = request.args.get('page', 1, type=int)
     pagination = Team.query.paginate(page, PAGE_SIZE, False)
     result = pagination_response(pagination, Routes['team'])
     resp = Response(dumps(result), status=200, mimetype="application/json")
     return resp
 def get(self):
     """
         GET request for Division List
         Route: Route['division']
         Returns:
             status: 200
             mimetype: application/json
             Paginated list of division objects
     """
     # return a pagination of Divisions
     page = request.args.get('page', 1, type=int)
     pagination = Division.query.paginate(page, PAGE_SIZE, False)
     result = pagination_response(pagination, Routes['division'])
     resp = Response(dumps(result), status=200,
                     mimetype="application/json")
     return resp
Exemple #6
0
    def get(self):
        """
            GET request for Fun List
            Route: Routes['fun']
            Parameters :

            Returns:
                status: 200
                mimetype: application/json
                data:
                    Sponsors: [{year: int, count:int
                                },{...}
                            ]
        """
        # return a pagination of sponsors
        page = request.args.get('page', 1, type=int)
        pagination = Fun.query.paginate(page, PAGE_SIZE, False)
        result = pagination_response(pagination, Routes['fun'])
        resp = Response(dumps(result), status=200, mimetype="application/json")
        return resp
 def get(self):
     """
         GET request for Player List
         Route: Routes['player']
         Returns:
             status: 200
             mimetype: application/json
             data:
                 players: [{player_id:int,
                           player-name:string,
                           gender: string,
                           active: boolean},{}
                         ]
     """
     # return a pagination of users
     page = request.args.get('page', 1, type=int)
     pagination = Player.query.paginate(page, PAGE_SIZE, False)
     result = pagination_response(pagination, Routes['player'])
     resp = Response(dumps(result), status=200, mimetype="application/json")
     return resp
 def get(self):
     """
         GET request for League List
         Route: Route['league']
         Parameters :
             league_name: The league's name (string)
         Returns:
             status: 200
             mimetype: application/json
             data:
                 tournaments: [{league_id:int,
                                league_name:string,
                               },{...}
                         ]
     """
     # return a pagination of leagues
     page = request.args.get('page', 1, type=int)
     pagination = League.query.paginate(page, PAGE_SIZE, False)
     result = pagination_response(pagination, Routes['league'])
     resp = Response(dumps(result), status=200, mimetype="application/json")
     return resp
Exemple #9
0
 def get(self):
     """
         GET request for Sponsor List
         Route: Routes['sponsor']
         Parameters:
         Returns:
             status: 200
             mimetype: application/json
             data:
                 Sponsors: [{sponsor_id:int,
                             sponsor_name:string,
                             description: string,
                             link: string,
                             active: boolean
                             },{...}
                         ]
     """
     # return a pagination of Sponsors
     page = request.args.get('page', 1, type=int)
     pagination = Sponsor.query.paginate(page, PAGE_SIZE, False)
     result = pagination_response(pagination, Routes['sponsor'])
     resp = Response(dumps(result), status=200, mimetype="application/json")
     return resp