sports_api 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rubocop.yml +39 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +310 -0
- data/Rakefile +12 -0
- data/docs/.nojekyll +0 -0
- data/docs/README.md +12 -0
- data/docs/_media/favicon.ico +0 -0
- data/docs/_media/home-logo.svg +57 -0
- data/docs/_media/readme-logo.png +0 -0
- data/docs/_sidebar.md +42 -0
- data/docs/cover.md +2 -0
- data/docs/index.html +44 -0
- data/docs/installation.md +17 -0
- data/docs/resources.md +932 -0
- data/docs/usage.md +13 -0
- data/lib/sports_api/collection.rb +30 -0
- data/lib/sports_api/error.rb +5 -0
- data/lib/sports_api/football/client.rb +180 -0
- data/lib/sports_api/football/objects/coach.rb +8 -0
- data/lib/sports_api/football/objects/country.rb +8 -0
- data/lib/sports_api/football/objects/fixtures/fixture.rb +8 -0
- data/lib/sports_api/football/objects/fixtures/fixture_event.rb +8 -0
- data/lib/sports_api/football/objects/fixtures/fixture_head_to_head.rb +8 -0
- data/lib/sports_api/football/objects/fixtures/fixture_lineup.rb +8 -0
- data/lib/sports_api/football/objects/fixtures/fixture_player_statistic.rb +8 -0
- data/lib/sports_api/football/objects/fixtures/fixture_round.rb +8 -0
- data/lib/sports_api/football/objects/fixtures/fixture_statistic.rb +8 -0
- data/lib/sports_api/football/objects/injury.rb +8 -0
- data/lib/sports_api/football/objects/leagues/league.rb +8 -0
- data/lib/sports_api/football/objects/leagues/league_season.rb +8 -0
- data/lib/sports_api/football/objects/odds_in_play/odds_live.rb +8 -0
- data/lib/sports_api/football/objects/odds_in_play/odds_live_bet.rb +8 -0
- data/lib/sports_api/football/objects/odds_pre_match/odds.rb +8 -0
- data/lib/sports_api/football/objects/odds_pre_match/odds_bet.rb +8 -0
- data/lib/sports_api/football/objects/odds_pre_match/odds_bookmaker.rb +8 -0
- data/lib/sports_api/football/objects/odds_pre_match/odds_mapping.rb +8 -0
- data/lib/sports_api/football/objects/players/player.rb +8 -0
- data/lib/sports_api/football/objects/players/player_season.rb +8 -0
- data/lib/sports_api/football/objects/players/player_squad.rb +8 -0
- data/lib/sports_api/football/objects/players/player_top_assist.rb +8 -0
- data/lib/sports_api/football/objects/players/player_top_red_card.rb +8 -0
- data/lib/sports_api/football/objects/players/player_top_scorer.rb +8 -0
- data/lib/sports_api/football/objects/players/player_top_yellow_card.rb +8 -0
- data/lib/sports_api/football/objects/prediction.rb +8 -0
- data/lib/sports_api/football/objects/sidelined.rb +8 -0
- data/lib/sports_api/football/objects/standing.rb +8 -0
- data/lib/sports_api/football/objects/teams/team.rb +8 -0
- data/lib/sports_api/football/objects/teams/team_country.rb +8 -0
- data/lib/sports_api/football/objects/teams/team_season.rb +8 -0
- data/lib/sports_api/football/objects/teams/team_statistic.rb +8 -0
- data/lib/sports_api/football/objects/timezone.rb +8 -0
- data/lib/sports_api/football/objects/transfer.rb +8 -0
- data/lib/sports_api/football/objects/trophy.rb +8 -0
- data/lib/sports_api/football/objects/venue.rb +8 -0
- data/lib/sports_api/football/resources/coach.rb +21 -0
- data/lib/sports_api/football/resources/country.rb +26 -0
- data/lib/sports_api/football/resources/fixtures/fixture.rb +32 -0
- data/lib/sports_api/football/resources/fixtures/fixture_event.rb +17 -0
- data/lib/sports_api/football/resources/fixtures/fixture_head_to_head.rb +24 -0
- data/lib/sports_api/football/resources/fixtures/fixture_lineup.rb +17 -0
- data/lib/sports_api/football/resources/fixtures/fixture_player_statistic.rb +15 -0
- data/lib/sports_api/football/resources/fixtures/fixture_round.rb +16 -0
- data/lib/sports_api/football/resources/fixtures/fixture_statistic.rb +16 -0
- data/lib/sports_api/football/resources/injury.rb +21 -0
- data/lib/sports_api/football/resources/leagues/league.rb +27 -0
- data/lib/sports_api/football/resources/leagues/league_season.rb +12 -0
- data/lib/sports_api/football/resources/odds_in_play/odds_live.rb +16 -0
- data/lib/sports_api/football/resources/odds_in_play/odds_live_bet.rb +20 -0
- data/lib/sports_api/football/resources/odds_pre_match/odds.rb +21 -0
- data/lib/sports_api/football/resources/odds_pre_match/odds_bet.rb +20 -0
- data/lib/sports_api/football/resources/odds_pre_match/odds_bookmaker.rb +20 -0
- data/lib/sports_api/football/resources/odds_pre_match/odds_mapping.rb +14 -0
- data/lib/sports_api/football/resources/players/player.rb +20 -0
- data/lib/sports_api/football/resources/players/player_season.rb +14 -0
- data/lib/sports_api/football/resources/players/player_squad.rb +15 -0
- data/lib/sports_api/football/resources/players/player_top_assist.rb +21 -0
- data/lib/sports_api/football/resources/players/player_top_red_card.rb +21 -0
- data/lib/sports_api/football/resources/players/player_top_scorer.rb +21 -0
- data/lib/sports_api/football/resources/players/player_top_yellow_card.rb +21 -0
- data/lib/sports_api/football/resources/prediction.rb +14 -0
- data/lib/sports_api/football/resources/sidelined.rb +15 -0
- data/lib/sports_api/football/resources/standing.rb +16 -0
- data/lib/sports_api/football/resources/teams/team.rb +26 -0
- data/lib/sports_api/football/resources/teams/team_country.rb +12 -0
- data/lib/sports_api/football/resources/teams/team_season.rb +14 -0
- data/lib/sports_api/football/resources/teams/team_statistic.rb +24 -0
- data/lib/sports_api/football/resources/timezone.rb +12 -0
- data/lib/sports_api/football/resources/transfer.rb +15 -0
- data/lib/sports_api/football/resources/trophy.rb +15 -0
- data/lib/sports_api/football/resources/venue.rb +23 -0
- data/lib/sports_api/football.rb +84 -0
- data/lib/sports_api/object.rb +35 -0
- data/lib/sports_api/resource.rb +32 -0
- data/lib/sports_api/version.rb +5 -0
- data/lib/sports_api.rb +8 -0
- data/sig/sports_api.rbs +4 -0
- data/sports_api.gemspec +40 -0
- metadata +175 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class FixtureEventResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# fixture: [Integer](required) - The fixture ID.
|
8
|
+
# team: [Integer](optional) - The team ID.
|
9
|
+
# player: [Integer](optional) - The player ID.
|
10
|
+
# type: [String](optional) - The type of the event ["Goal", "Card", "Subst", "Var"].
|
11
|
+
def list(fixture:, **params)
|
12
|
+
response = get_request('fixtures/events', params: { fixture:, **params })
|
13
|
+
Collection.from_response(response, type: SportsApi::Football::FixtureEvent)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class FixtureHeadToHeadResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# h2h: [String](required) - The IDs of the teams.
|
8
|
+
# date: [String](optional) - A valid date (= YYYY-MM-DD).
|
9
|
+
# league: [Integer](optional) - The league ID.
|
10
|
+
# season: [Integer](optional) - The season year of the league (= YYYY).
|
11
|
+
# last: [Integer](optional) - For the X last fixtures.
|
12
|
+
# next: [Integer](optional) - For the X next fixtures.
|
13
|
+
# from: [String](optional) - A valid date (= YYYY-MM-DD).
|
14
|
+
# to: [String](optional) - A valid date (= YYYY-MM-DD).
|
15
|
+
# status: [String](optional) - One or more fixture status short ["NS", "NS-PST-FT"].
|
16
|
+
# venue: [Integer](optional) - The venue ID of the fixture.
|
17
|
+
# timezone: [String](optional) - A valid timezone from the endpoint Timezone.
|
18
|
+
def list(h2h:, **params)
|
19
|
+
response = get_request('fixtures/headtohead', params: { h2h:, **params })
|
20
|
+
Collection.from_response(response, type: SportsApi::Football::FixtureHeadToHead)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class FixtureLineupResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# fixture: [Integer](required) - The fixture ID.
|
8
|
+
# team: [Integer](optional) - The team ID.
|
9
|
+
# player: [Integer](optional) - The player ID.
|
10
|
+
# type: [String](optional) - The type of statistics ["Formation", "Coach", "Start XI", "Substitutes"].
|
11
|
+
def list(fixture:, **params)
|
12
|
+
response = get_request('fixtures/lineups', params: { fixture:, **params })
|
13
|
+
Collection.from_response(response, type: SportsApi::Football::FixtureLineup)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class FixturePlayerStatisticResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# fixture: [Integer](required) - The fixture ID.
|
8
|
+
# team: [Integer](optional) - The team ID.
|
9
|
+
def list(fixture:, **params)
|
10
|
+
response = get_request('fixtures/players', params: { fixture:, **params })
|
11
|
+
Collection.from_response(response, type: SportsApi::Football::FixturePlayerStatistic)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class FixtureRoundResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# league: [Integer](required) - The league ID.
|
8
|
+
# season: [Integer](required) - The season year of the league (= YYYY).
|
9
|
+
# current: [Boolean](optional) - The current round ["true", "false"].
|
10
|
+
def list(league:, season:, **params)
|
11
|
+
response = get_request('fixtures/rounds', params: { league:, season:, **params })
|
12
|
+
Collection.from_response(response, type: SportsApi::Football::FixtureRound)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class FixtureStatisticResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# fixture: [Integer](required) - The fixture ID.
|
8
|
+
# team: [Integer](optional) - The team ID.
|
9
|
+
# type: [String](optional) - The type of statistics ["Shots on Goal", "Corner Kicks", etc].
|
10
|
+
def list(fixture:, **params)
|
11
|
+
response = get_request('fixtures/statistics', params: { fixture:, **params })
|
12
|
+
Collection.from_response(response, type: SportsApi::Football::FixtureStatistic)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class InjuryResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# fixture: [Integer](optional) - The fixture ID.
|
8
|
+
# league: [Integer](optional) - The league ID.
|
9
|
+
# team: [Integer](optional) - The team ID.
|
10
|
+
# player: [Integer](optional) - The player ID.
|
11
|
+
# season: [Integer](optional) - The season of the league, required with league,
|
12
|
+
# team and player parameters (= YYYY).
|
13
|
+
# date: [String](optional) - A valid date (= YYYY-MM-DD).
|
14
|
+
# timezone: [String](optional) - A valid timezone from the endpoint Timezone.
|
15
|
+
def list(**params)
|
16
|
+
response = get_request('injuries', params:)
|
17
|
+
Collection.from_response(response, type: SportsApi::Football::Injury)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class LeagueResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# id: [Integer](optional) - The league ID.
|
8
|
+
# name: [String](optional) - The name of the league.
|
9
|
+
# country: [String] (optional) - The country name of the league.
|
10
|
+
# code: [String] (optional) - The country code of the league (= XXX).
|
11
|
+
# season: [Integer] (optional) - The season of the league (= YYYY).
|
12
|
+
# type: [String] (optional) - The type of the league ["league", "cup"].
|
13
|
+
# current: [String] (optional) - The current status of the league ["true", "false"].
|
14
|
+
# team: [Integer] (optional) - The team ID that has played at least one match.
|
15
|
+
# search: [String] (optional) - The league or country name, can be some letters (>= XXX).
|
16
|
+
def list(**params)
|
17
|
+
response = get_request('leagues', params:)
|
18
|
+
Collection.from_response(response, type: SportsApi::Football::League)
|
19
|
+
end
|
20
|
+
|
21
|
+
def find(id:)
|
22
|
+
response = get_request('leagues', params: { id: id.to_s })
|
23
|
+
SportsApi::Football::League.new(response.body['response'][0])
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class LeagueSeasonResource < Resource
|
6
|
+
def list
|
7
|
+
response = get_request('leagues/seasons')
|
8
|
+
Collection.from_response(response, type: SportsApi::Football::LeagueSeason)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class OddsLiveResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# fixture: [Integer](optional) - The fixture ID.
|
8
|
+
# league: [Integer](optional) - The league ID.
|
9
|
+
# bet: [Integer](optional) - The bet ID.
|
10
|
+
def list(**params)
|
11
|
+
response = get_request('odds/live', params:)
|
12
|
+
Collection.from_response(response, type: SportsApi::Football::OddsLive)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class OddsLiveBetResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# id: [Integer](optional) - The bet ID.
|
8
|
+
# search: [String](optional) - The name of the bet (>= XXX).
|
9
|
+
def list(**params)
|
10
|
+
response = get_request('odds/live/bets', params:)
|
11
|
+
Collection.from_response(response, type: SportsApi::Football::OddsLiveBet)
|
12
|
+
end
|
13
|
+
|
14
|
+
def find(id:)
|
15
|
+
response = get_request('odds/live/bets', params: { id: id.to_s })
|
16
|
+
SportsApi::Football::OddsLiveBet.new(response.body['response'][0])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class OddsResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# fixture: [Integer](optional) - The fixture ID.
|
8
|
+
# league: [Integer](optional) - The league ID.
|
9
|
+
# bet: [Integer](optional) - The bet ID.
|
10
|
+
# bookmaker: [Integer](optional) - The bookmaker ID.
|
11
|
+
# season: [Integer](optional) - The season of the league (= YYYY).
|
12
|
+
# date: [String](optional) - A valid date (= YYYY-MM-DD).
|
13
|
+
# timezone: [String](optional) - A valid timezone from the endpoint Timezone.
|
14
|
+
# page: [Integer](optional) - Use for the pagination (default 1).
|
15
|
+
def list(**params)
|
16
|
+
response = get_request('odds', params:)
|
17
|
+
Collection.from_response(response, type: SportsApi::Football::Odds)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class OddsBetResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# id: [Integer](optional) - The bet ID.
|
8
|
+
# search: [String](optional) - The name of the bet (>= XXX).
|
9
|
+
def list(**params)
|
10
|
+
response = get_request('odds/bets', params:)
|
11
|
+
Collection.from_response(response, type: SportsApi::Football::OddsBet)
|
12
|
+
end
|
13
|
+
|
14
|
+
def find(id:)
|
15
|
+
response = get_request('odds/bets', params: { id: id.to_s })
|
16
|
+
SportsApi::Football::OddsBet.new(response.body['response'][0])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class OddsBookmakerResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# id: [Integer](optional) - The bookmaker ID.
|
8
|
+
# search: [String](optional) - The name of the bookmaker (>= XXX).
|
9
|
+
def list(**params)
|
10
|
+
response = get_request('odds/bookmakers', params:)
|
11
|
+
Collection.from_response(response, type: SportsApi::Football::OddsBookmaker)
|
12
|
+
end
|
13
|
+
|
14
|
+
def find(id:)
|
15
|
+
response = get_request('odds/bookmakers', params: { id: id.to_s })
|
16
|
+
SportsApi::Football::OddsBookmaker.new(response.body['response'][0])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class OddsMappingResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# page: [Integer](optional) - Use for the pagination (default 1).
|
8
|
+
def list(**params)
|
9
|
+
response = get_request('odds/mapping', params:)
|
10
|
+
Collection.from_response(response, type: SportsApi::Football::OddsMapping)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class PlayerResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# id: [Integer](optional) - The player ID.
|
8
|
+
# team: [Integer](optional) - The team ID.
|
9
|
+
# league: [Integer](optional) - The league ID.
|
10
|
+
# season: [Integer](optional) - The season of the league (= YYYY).
|
11
|
+
# Requires the fields Id, League or Team
|
12
|
+
# search: [String](optional) - The name of the coach (>= XXXX).
|
13
|
+
# page: [Integer](optional) - Use for the pagination (default: 1).
|
14
|
+
def list(**params)
|
15
|
+
response = get_request('players', params:)
|
16
|
+
Collection.from_response(response, type: SportsApi::Football::Player)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class PlayerSeasonResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# player: [Integer](optional) - The player ID.
|
8
|
+
def list(**params)
|
9
|
+
response = get_request('players/seasons', params:)
|
10
|
+
Collection.from_response(response, type: SportsApi::Football::PlayerSeason)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class PlayerSquadResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# team: [Integer](optional) - The team ID.
|
8
|
+
# player: [Integer](optional) - The player ID.
|
9
|
+
def list(**params)
|
10
|
+
response = get_request('players/squads', params:)
|
11
|
+
Collection.from_response(response, type: SportsApi::Football::PlayerSquad)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class PlayerTopAssistResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# league: [Integer](required) - The league ID.
|
8
|
+
# season: [Integer](required) - The season of the league (= YYYY).
|
9
|
+
def list(league:, season:)
|
10
|
+
response = get_request(
|
11
|
+
'players/topassists',
|
12
|
+
params: {
|
13
|
+
league: league.to_s,
|
14
|
+
season: season.to_s
|
15
|
+
}
|
16
|
+
)
|
17
|
+
Collection.from_response(response, type: SportsApi::Football::PlayerTopAssist)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class PlayerTopRedCardResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# league: [Integer](required) - The league ID.
|
8
|
+
# season: [Integer](required) - The season of the league (= YYYY).
|
9
|
+
def list(league:, season:)
|
10
|
+
response = get_request(
|
11
|
+
'players/topredcards',
|
12
|
+
params: {
|
13
|
+
league: league.to_s,
|
14
|
+
season: season.to_s
|
15
|
+
}
|
16
|
+
)
|
17
|
+
Collection.from_response(response, type: SportsApi::Football::PlayerTopRedCard)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class PlayerTopScorerResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# league: [Integer](required) - The league ID.
|
8
|
+
# season: [Integer](required) - The season of the league (= YYYY).
|
9
|
+
def list(league:, season:)
|
10
|
+
response = get_request(
|
11
|
+
'players/topscorers',
|
12
|
+
params: {
|
13
|
+
league: league.to_s,
|
14
|
+
season: season.to_s
|
15
|
+
}
|
16
|
+
)
|
17
|
+
Collection.from_response(response, type: SportsApi::Football::PlayerTopScorer)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class PlayerTopYellowCardResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# league: [Integer](required) - The league ID.
|
8
|
+
# season: [Integer](required) - The season of the league (= YYYY).
|
9
|
+
def list(league:, season:)
|
10
|
+
response = get_request(
|
11
|
+
'players/topyellowcards',
|
12
|
+
params: {
|
13
|
+
league: league.to_s,
|
14
|
+
season: season.to_s
|
15
|
+
}
|
16
|
+
)
|
17
|
+
Collection.from_response(response, type: SportsApi::Football::PlayerTopYellowCard)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class PredictionResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# fixture: [Integer](required) - The fixture ID.
|
8
|
+
def list(fixture:)
|
9
|
+
response = get_request('predictions', params: { fixture: fixture.to_s })
|
10
|
+
Collection.from_response(response, type: SportsApi::Football::Prediction)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class SidelinedResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# player: [Integer](optional) - The player ID.
|
8
|
+
# coach: [Integer](optional) - The coach ID.
|
9
|
+
def list(**params)
|
10
|
+
response = get_request('sidelined', params:)
|
11
|
+
Collection.from_response(response, type: SportsApi::Football::Sidelined)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class StandingResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# league: [Integer](optional) - The league ID.
|
8
|
+
# season: [Integer] (required) - The season of the league (= YYYY).
|
9
|
+
# team: [Integer] (optional) - The team ID.
|
10
|
+
def list(season:, **params)
|
11
|
+
response = get_request('standings', params: { season: season.to_s, **params })
|
12
|
+
Collection.from_response(response, type: SportsApi::Football::Standing)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class TeamResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# id: [Integer](optional) - The team ID.
|
8
|
+
# name: [String](optional) - The name of the team.
|
9
|
+
# league: [Integer](optional) - The league ID.
|
10
|
+
# season: [Integer](optional) - The season year (= YYYY).
|
11
|
+
# country: [String] (optional) - The name of the country.
|
12
|
+
# code: [String] (optional) - The country code (= XXX).
|
13
|
+
# venue: [Integer] (optional) - The venue ID.
|
14
|
+
# search: [String] (optional) - The team or country name, can be some letters (>= XXX).
|
15
|
+
def list(**params)
|
16
|
+
response = get_request('teams', params:)
|
17
|
+
Collection.from_response(response, type: SportsApi::Football::Team)
|
18
|
+
end
|
19
|
+
|
20
|
+
def find(id:)
|
21
|
+
response = get_request('teams', params: { id: id.to_s })
|
22
|
+
SportsApi::Football::Team.new(response.body['response'][0])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class TeamCountryResource < Resource
|
6
|
+
def list
|
7
|
+
response = get_request('teams/countries')
|
8
|
+
Collection.from_response(response, type: SportsApi::Football::TeamCountry)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class TeamSeasonResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# team: [Integer](required) - The team ID.
|
8
|
+
def list(team:)
|
9
|
+
response = get_request('teams/seasons', params: { team: team.to_s })
|
10
|
+
Collection.from_response(response, type: SportsApi::Football::TeamSeason)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class TeamStatisticResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# league: [Integer](required) - The league ID.
|
8
|
+
# season: [Integer](required) - The season year (= YYYY).
|
9
|
+
# team: [Integer](required) - The team ID.
|
10
|
+
# date: [String](optional) - The limit date (YYYY-MM-DD).
|
11
|
+
def find(league:, season:, team:, date: nil)
|
12
|
+
params = {
|
13
|
+
league: league.to_s,
|
14
|
+
season: season.to_s,
|
15
|
+
team: team.to_s
|
16
|
+
}
|
17
|
+
params[:date] = date.to_s if date
|
18
|
+
|
19
|
+
response = get_request('teams/statistics', params:)
|
20
|
+
SportsApi::Football::TeamStatistic.new(response.body['response'])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class TransferResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# player: [Integer](optional) - The player ID.
|
8
|
+
# team: [Integer](optional) - The team ID.
|
9
|
+
def list(**params)
|
10
|
+
response = get_request('transfers', params:)
|
11
|
+
Collection.from_response(response, type: SportsApi::Football::Transfer)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class TrophyResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# player: [Integer](optional) - The player ID.
|
8
|
+
# coach: [Integer](optional) - The coach ID.
|
9
|
+
def list(**params)
|
10
|
+
response = get_request('trophies', params:)
|
11
|
+
Collection.from_response(response, type: SportsApi::Football::Trophy)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SportsApi
|
4
|
+
module Football
|
5
|
+
class VenueResource < Resource
|
6
|
+
# Arguments:
|
7
|
+
# id: [Integer](optional) - The venue ID.
|
8
|
+
# name: [String](optional) - The name of the venue.
|
9
|
+
# city: [String](optional) - The city of the venue.
|
10
|
+
# country: [String] (optional) - The country name of the venue.
|
11
|
+
# search: [String] (optional) - The name, city or the country of the venue (>= XXX).
|
12
|
+
def list(**params)
|
13
|
+
response = get_request('venues', params:)
|
14
|
+
Collection.from_response(response, type: SportsApi::Football::Venue)
|
15
|
+
end
|
16
|
+
|
17
|
+
def find(id:)
|
18
|
+
response = get_request('venues', params: { id: id.to_s })
|
19
|
+
SportsApi::Football::Venue.new(response.body['response'][0])
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|