football-butler 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/football/butler/api.rb +2 -0
- data/lib/football/butler/api_football/base_api_football.rb +17 -0
- data/lib/football/butler/api_football/coachs.rb +46 -0
- data/lib/football/butler/api_football/countries.rb +39 -0
- data/lib/football/butler/api_football/fixtures.rb +80 -0
- data/lib/football/butler/api_football/head_to_head.rb +56 -0
- data/lib/football/butler/api_football/injuries.rb +62 -0
- data/lib/football/butler/api_football/leagues.rb +101 -0
- data/lib/football/butler/api_football/lineups.rb +39 -0
- data/lib/football/butler/api_football/odds.rb +55 -0
- data/lib/football/butler/api_football/players.rb +47 -0
- data/lib/football/butler/api_football/predictions.rb +27 -0
- data/lib/football/butler/api_football/sidelineds.rb +37 -0
- data/lib/football/butler/api_football/standings.rb +35 -0
- data/lib/football/butler/api_football/statistics.rb +22 -0
- data/lib/football/butler/api_football/teams.rb +66 -0
- data/lib/football/butler/api_football/timezones.rb +21 -0
- data/lib/football/butler/api_football/top_scorers.rb +22 -0
- data/lib/football/butler/api_football/transfers.rb +36 -0
- data/lib/football/butler/api_football/trophies.rb +37 -0
- data/lib/football/butler/api_football/venues.rb +66 -0
- data/lib/football/butler/apifootball/competitions.rb +2 -2
- data/lib/football/butler/apifootball/odds.rb +2 -2
- data/lib/football/butler/areas.rb +11 -2
- data/lib/football/butler/base.rb +2 -5
- data/lib/football/butler/coachs.rb +26 -0
- data/lib/football/butler/competitions.rb +24 -2
- data/lib/football/butler/configuration.rb +123 -17
- data/lib/football/butler/countries.rb +1 -0
- data/lib/football/butler/events.rb +1 -0
- data/lib/football/butler/fixtures.rb +11 -0
- data/lib/football/butler/football_data/areas.rb +1 -1
- data/lib/football/butler/football_data/odds.rb +1 -1
- data/lib/football/butler/football_data/teams.rb +1 -1
- data/lib/football/butler/head_to_head.rb +1 -0
- data/lib/football/butler/injuries.rb +31 -0
- data/lib/football/butler/leagues.rb +11 -0
- data/lib/football/butler/lineups.rb +1 -0
- data/lib/football/butler/matches.rb +1 -0
- data/lib/football/butler/odds.rb +3 -2
- data/lib/football/butler/players.rb +5 -0
- data/lib/football/butler/predictions.rb +1 -0
- data/lib/football/butler/scorers.rb +5 -0
- data/lib/football/butler/sidelineds.rb +20 -0
- data/lib/football/butler/standings.rb +1 -0
- data/lib/football/butler/statistics.rb +1 -0
- data/lib/football/butler/teams.rb +9 -0
- data/lib/football/butler/tier.rb +26 -11
- data/lib/football/butler/timezones.rb +16 -0
- data/lib/football/butler/top_scorers.rb +1 -0
- data/lib/football/butler/transfers.rb +21 -0
- data/lib/football/butler/trophies.rb +21 -0
- data/lib/football/butler/venues.rb +34 -0
- data/lib/football/butler/version.rb +6 -3
- data/lib/football/butler.rb +9 -0
- metadata +33 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7654e08d510473c24d9918a1c0c17ad59bf099eaa8ffd7eb2d630e9bf01255e8
|
4
|
+
data.tar.gz: 7a921b8c15ea17bf504022db5ea3d5f162cbcaf5665ef0602147cf743f60fd0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a15049ca129fc638e56bb7097a261ac38a87f11f901e481f52115eb89ac6f0cd6047651ef451945317259cfb2f6001647be9b59bee5f6d3197c8d230dc814d8e
|
7
|
+
data.tar.gz: d7ecd05456a3a1be9b324a44ec1511d5256e4fba1253efe230715791b0a0f3531e14983a6485f05aa6576c830fc9009e8a25935fa54437ab7d45d33507b5ad53
|
data/lib/football/butler/api.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'football/butler/api_football/base_api_football'
|
3
|
+
|
4
|
+
module Football
|
5
|
+
module Butler
|
6
|
+
module ApiFootball
|
7
|
+
class Coachs < BaseApiFootball
|
8
|
+
PATH = :coachs
|
9
|
+
|
10
|
+
class << self
|
11
|
+
## COACHS
|
12
|
+
#
|
13
|
+
# id
|
14
|
+
# integer
|
15
|
+
# The id of the coach
|
16
|
+
#
|
17
|
+
# team
|
18
|
+
# integer
|
19
|
+
# The id of the team
|
20
|
+
#
|
21
|
+
# search
|
22
|
+
# string >= 3 characters
|
23
|
+
# The name of the coach
|
24
|
+
#
|
25
|
+
# /coachs?id={id}
|
26
|
+
def by_id(id:, result:, filters:)
|
27
|
+
filters.merge!({ id: id })
|
28
|
+
Api.get(path: PATH, result: result, filters: filters)
|
29
|
+
end
|
30
|
+
|
31
|
+
# /coachs?search={name}
|
32
|
+
def search_by_name(name:, result:, filters:)
|
33
|
+
filters.merge!({ search: name })
|
34
|
+
Api.get(path: PATH, result: result, filters: filters)
|
35
|
+
end
|
36
|
+
|
37
|
+
# /coachs?team={team}
|
38
|
+
def by_team(team:, result:, filters:)
|
39
|
+
filters.merge!({ team: team })
|
40
|
+
Api.get(path: PATH, result: result, filters: filters)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'football/butler/api_football/base_api_football'
|
3
|
+
|
4
|
+
module Football
|
5
|
+
module Butler
|
6
|
+
module ApiFootball
|
7
|
+
class Countries < BaseApiFootball
|
8
|
+
PATH = :countries
|
9
|
+
|
10
|
+
class << self
|
11
|
+
## COUNTRY
|
12
|
+
# /countries?name={name}
|
13
|
+
def by_name(name:, result:, filters:)
|
14
|
+
filters.merge!({ name: name })
|
15
|
+
Api.get(path: PATH, result: result, filters: filters)
|
16
|
+
end
|
17
|
+
|
18
|
+
# /countries?code={code}
|
19
|
+
def by_code(code:, result:, filters:)
|
20
|
+
filters.merge!({ code: code })
|
21
|
+
Api.get(path: PATH, result: result, filters: filters)
|
22
|
+
end
|
23
|
+
|
24
|
+
## COUNTRIES
|
25
|
+
# /countries
|
26
|
+
def all(result:)
|
27
|
+
Api.get(path: PATH, result: result)
|
28
|
+
end
|
29
|
+
|
30
|
+
# /countries?search={name}
|
31
|
+
def search_by_name(name:, result:, filters:)
|
32
|
+
filters.merge!({ search: name })
|
33
|
+
Api.get(path: PATH, result: result, filters: filters)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'football/butler/api_football/base_api_football'
|
3
|
+
|
4
|
+
module Football
|
5
|
+
module Butler
|
6
|
+
module ApiFootball
|
7
|
+
class Fixtures < BaseApiFootball
|
8
|
+
PATH = :fixtures
|
9
|
+
|
10
|
+
class << self
|
11
|
+
## FIXTURE
|
12
|
+
# /fixtures?id={id}
|
13
|
+
def by_id(id:)
|
14
|
+
filters = { id: id }
|
15
|
+
Api.get(path: PATH, filters: filters, result: :response)
|
16
|
+
end
|
17
|
+
|
18
|
+
## FIXTURES
|
19
|
+
#
|
20
|
+
# id
|
21
|
+
# integer
|
22
|
+
# The id of the fixture
|
23
|
+
#
|
24
|
+
# live
|
25
|
+
# string
|
26
|
+
# Enum: "all" "id-id"
|
27
|
+
# date
|
28
|
+
# stringYYYY-MM-DD
|
29
|
+
# A valid date
|
30
|
+
#
|
31
|
+
# league
|
32
|
+
# integer
|
33
|
+
# The id of the league
|
34
|
+
#
|
35
|
+
# season
|
36
|
+
# integer 4 characters YYYY
|
37
|
+
# The season of the league
|
38
|
+
#
|
39
|
+
# team
|
40
|
+
# integer
|
41
|
+
# The id of the team
|
42
|
+
#
|
43
|
+
# last
|
44
|
+
# integer <= 2 characters
|
45
|
+
# For the X last fixtures
|
46
|
+
#
|
47
|
+
# next
|
48
|
+
# integer <= 2 characters
|
49
|
+
# For the X next fixtures
|
50
|
+
#
|
51
|
+
# from
|
52
|
+
# stringYYYY-MM-DD
|
53
|
+
# A valid date
|
54
|
+
#
|
55
|
+
# to
|
56
|
+
# stringYYYY-MM-DD
|
57
|
+
# A valid date
|
58
|
+
#
|
59
|
+
# round
|
60
|
+
# string
|
61
|
+
# The round of the fixture
|
62
|
+
#
|
63
|
+
# status
|
64
|
+
# string
|
65
|
+
# The status short of the fixture
|
66
|
+
#
|
67
|
+
# timezone
|
68
|
+
# string
|
69
|
+
# A valid timezone from the endpoint Timezone
|
70
|
+
#
|
71
|
+
# /fixtures?league={id}&season={year}
|
72
|
+
def by_competition_and_year(id:, year:, result:, filters:)
|
73
|
+
filters.merge!({ league: id, season: year })
|
74
|
+
Api.get(path: PATH, filters: filters, result: result)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Football
|
4
|
+
module Butler
|
5
|
+
module ApiFootball
|
6
|
+
class HeadToHead < Base
|
7
|
+
PATH = 'fixtures/headtohead'
|
8
|
+
|
9
|
+
class << self
|
10
|
+
## HEAD TO HEAD
|
11
|
+
#
|
12
|
+
# h2h
|
13
|
+
# required
|
14
|
+
# stringID-ID
|
15
|
+
# The ids of the teams
|
16
|
+
#
|
17
|
+
# date
|
18
|
+
# stringYYYY-MM-DD
|
19
|
+
# league
|
20
|
+
# integer
|
21
|
+
# The id of the league
|
22
|
+
#
|
23
|
+
# season
|
24
|
+
# integer 4 characters YYYY
|
25
|
+
# The season of the league
|
26
|
+
#
|
27
|
+
# last
|
28
|
+
# integer
|
29
|
+
# For the X last fixtures
|
30
|
+
#
|
31
|
+
# next
|
32
|
+
# integer
|
33
|
+
# For the X next fixtures
|
34
|
+
#
|
35
|
+
# from
|
36
|
+
# stringYYYY-MM-DD
|
37
|
+
# to
|
38
|
+
# stringYYYY-MM-DD
|
39
|
+
# status
|
40
|
+
# string
|
41
|
+
# The status short of the fixture
|
42
|
+
#
|
43
|
+
# timezone
|
44
|
+
# string
|
45
|
+
# A valid timezone from the endpoint Timezone
|
46
|
+
#
|
47
|
+
# fixtures/headtohead?h2h={team_id-second_team_id}
|
48
|
+
def by_teams(team_id:, second_team_id:, filters:, result:)
|
49
|
+
filters.merge!(h2h: "#{team_id}-#{second_team_id}")
|
50
|
+
Api.get(path: PATH, filters: filters, result: result)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'football/butler/api_football/base_api_football'
|
3
|
+
|
4
|
+
module Football
|
5
|
+
module Butler
|
6
|
+
module ApiFootball
|
7
|
+
class Injuries < BaseApiFootball
|
8
|
+
PATH = :injuries
|
9
|
+
|
10
|
+
class << self
|
11
|
+
## Injuries
|
12
|
+
#
|
13
|
+
# league
|
14
|
+
# integer
|
15
|
+
# The id of the league
|
16
|
+
#
|
17
|
+
# season
|
18
|
+
# integer 4 characters YYYY
|
19
|
+
# The season of the league, required with league, team and player parameters
|
20
|
+
#
|
21
|
+
# fixture
|
22
|
+
# integer
|
23
|
+
# The id of the fixture
|
24
|
+
#
|
25
|
+
# team
|
26
|
+
# integer
|
27
|
+
# The id of the team
|
28
|
+
#
|
29
|
+
# player
|
30
|
+
# integer
|
31
|
+
# The id of the player
|
32
|
+
#
|
33
|
+
# date
|
34
|
+
# stringYYYY-MM-DD
|
35
|
+
# A valid date
|
36
|
+
#
|
37
|
+
# timezone
|
38
|
+
# string
|
39
|
+
# A valid timezone from the endpoint Timezone
|
40
|
+
#
|
41
|
+
# /injuries?ccompetition={competition}&season={season}
|
42
|
+
def by_competition_and_season(competition:, season:, result:, filters:)
|
43
|
+
filters.merge!({ league: competition, season: season })
|
44
|
+
Api.get(path: PATH, result: result, filters: filters)
|
45
|
+
end
|
46
|
+
|
47
|
+
# /injuries?fixture={match}
|
48
|
+
def by_match(match:, result:, filters:)
|
49
|
+
filters.merge!({ fixture: match })
|
50
|
+
Api.get(path: PATH, result: result, filters: filters)
|
51
|
+
end
|
52
|
+
|
53
|
+
# /injuries?team={team}&season={season}
|
54
|
+
def by_team_and_season(team:, season:, result:, filters:)
|
55
|
+
filters.merge!({ team: team, season: season })
|
56
|
+
Api.get(path: PATH, result: result, filters: filters)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'football/butler/api_football/base_api_football'
|
3
|
+
|
4
|
+
module Football
|
5
|
+
module Butler
|
6
|
+
module ApiFootball
|
7
|
+
class Leagues < BaseApiFootball
|
8
|
+
PATH = :leagues
|
9
|
+
|
10
|
+
class << self
|
11
|
+
## LEAGUE
|
12
|
+
# /leagues?id={id}
|
13
|
+
def by_id(id:)
|
14
|
+
filters = { id: id }
|
15
|
+
Api.get(path: PATH, filters: filters, result: :response)
|
16
|
+
end
|
17
|
+
|
18
|
+
# /leagues?country={country}
|
19
|
+
def by_country_name(name:, result:)
|
20
|
+
filters = { country: name }
|
21
|
+
Api.get(path: PATH, filters: filters, result: result)
|
22
|
+
end
|
23
|
+
|
24
|
+
# /leagues/seasons
|
25
|
+
def all_seasons(result:)
|
26
|
+
path = "#{PATH}/seasons"
|
27
|
+
Api.get(path: path, result: result)
|
28
|
+
end
|
29
|
+
|
30
|
+
## LEAGUES
|
31
|
+
# https://www.api-football.com/documentation-v3#operation/get-leagues
|
32
|
+
#
|
33
|
+
# id
|
34
|
+
# integer
|
35
|
+
# The id of the league
|
36
|
+
#
|
37
|
+
# name
|
38
|
+
# string
|
39
|
+
# The name of the league
|
40
|
+
#
|
41
|
+
# country
|
42
|
+
# string
|
43
|
+
# The country name of the league
|
44
|
+
#
|
45
|
+
# code
|
46
|
+
# string 2 characters FR, GB, IT…
|
47
|
+
# The Alpha2 code of the country
|
48
|
+
#
|
49
|
+
# season
|
50
|
+
# integer 4 characters YYYY
|
51
|
+
# The season of the league
|
52
|
+
#
|
53
|
+
# team
|
54
|
+
# integer
|
55
|
+
# The id of the team
|
56
|
+
#
|
57
|
+
# type
|
58
|
+
# string
|
59
|
+
# Enum: "league" "cup"
|
60
|
+
# The type of the league
|
61
|
+
#
|
62
|
+
# current
|
63
|
+
# string
|
64
|
+
# Enum: "true" "false"
|
65
|
+
# The state of the league
|
66
|
+
#
|
67
|
+
# search
|
68
|
+
# string >= 3 characters
|
69
|
+
# The name or the country of the league
|
70
|
+
#
|
71
|
+
# last
|
72
|
+
# integer <= 2 characters
|
73
|
+
#
|
74
|
+
# /leagues
|
75
|
+
def all(result:, filters:)
|
76
|
+
Api.get(path: PATH, result: result, filters: filters)
|
77
|
+
end
|
78
|
+
|
79
|
+
# /leagues?search={name}
|
80
|
+
def search_by_name(name:, filters:, result:)
|
81
|
+
filters.merge!({ search: name })
|
82
|
+
Api.get(path: PATH, filters: filters, result: result)
|
83
|
+
end
|
84
|
+
|
85
|
+
# /leagues?type=league
|
86
|
+
def all_leagues(result:, filters:)
|
87
|
+
filters.merge!({ type: 'league' })
|
88
|
+
Api.get(path: PATH, result: result, filters: filters)
|
89
|
+
end
|
90
|
+
|
91
|
+
# /leagues?type=cup
|
92
|
+
def all_cups(result:, filters:)
|
93
|
+
filters.merge!({ type: 'cup' })
|
94
|
+
Api.get(path: PATH, result: result, filters: filters)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'football/butler/api_football/base_api_football'
|
3
|
+
|
4
|
+
module Football
|
5
|
+
module Butler
|
6
|
+
module ApiFootball
|
7
|
+
class Lineups < BaseApiFootball
|
8
|
+
PATH = 'fixtures/lineups'
|
9
|
+
|
10
|
+
class << self
|
11
|
+
## LINEUPS
|
12
|
+
#
|
13
|
+
# fixture
|
14
|
+
# required
|
15
|
+
# integer
|
16
|
+
# The id of the fixture
|
17
|
+
#
|
18
|
+
# team
|
19
|
+
# integer
|
20
|
+
# The id of the team
|
21
|
+
#
|
22
|
+
# player
|
23
|
+
# integer
|
24
|
+
# The id of the player
|
25
|
+
#
|
26
|
+
# type
|
27
|
+
# string
|
28
|
+
# The type
|
29
|
+
#
|
30
|
+
# fixtures/lineups?fixture={id}
|
31
|
+
def by_match(id:)
|
32
|
+
filters = { fixture: id }
|
33
|
+
Api.get(path: PATH, filters: filters, result: :response)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|