Class: SportsApi::Football::Client
- Inherits:
-
Object
- Object
- SportsApi::Football::Client
- Defined in:
- lib/sports_api/football/client.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- BASE_URL =
'https://v3.football.api-sports.io/'
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #coaches ⇒ Object
- #connection ⇒ Object
- #countries ⇒ Object
- #fixture_events ⇒ Object
- #fixture_head_to_head ⇒ Object
- #fixture_lineups ⇒ Object
- #fixture_player_statistics ⇒ Object
- #fixture_rounds ⇒ Object
- #fixture_statistics ⇒ Object
- #fixtures ⇒ Object
-
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
constructor
A new instance of Client.
- #injuries ⇒ Object
- #inspect ⇒ Object
- #league_seasons ⇒ Object
- #leagues ⇒ Object
- #odds ⇒ Object
- #odds_bets ⇒ Object
- #odds_bookmakers ⇒ Object
- #odds_live_bets ⇒ Object
- #odds_lives ⇒ Object
- #odds_mappings ⇒ Object
- #player_seasons ⇒ Object
- #player_squads ⇒ Object
- #player_top_assists ⇒ Object
- #player_top_red_cards ⇒ Object
- #player_top_scorers ⇒ Object
- #player_top_yellow_cards ⇒ Object
- #players ⇒ Object
- #predictions ⇒ Object
- #sidelined ⇒ Object
- #standings ⇒ Object
- #team_countries ⇒ Object
- #team_seasons ⇒ Object
- #team_statistics ⇒ Object
- #teams ⇒ Object
- #timezones ⇒ Object
- #transfers ⇒ Object
- #trophies ⇒ Object
- #venues ⇒ Object
Constructor Details
#initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 |
# File 'lib/sports_api/football/client.rb', line 13 def initialize(api_key:, adapter: Faraday.default_adapter, stubs: nil) @api_key = api_key @adapter = adapter # Test stubs for requests @stubs = stubs end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
11 12 13 |
# File 'lib/sports_api/football/client.rb', line 11 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
11 12 13 |
# File 'lib/sports_api/football/client.rb', line 11 def api_key @api_key end |
Instance Method Details
#coaches ⇒ Object
21 22 23 |
# File 'lib/sports_api/football/client.rb', line 21 def coaches CoachResource.new(self) end |
#connection ⇒ Object
165 166 167 168 169 170 171 172 |
# File 'lib/sports_api/football/client.rb', line 165 def connection @connection ||= Faraday.new do |conn| conn.url_prefix = BASE_URL conn.request :json conn.response :json, content_type: 'application/json' conn.adapter adapter, @stubs end end |
#countries ⇒ Object
25 26 27 |
# File 'lib/sports_api/football/client.rb', line 25 def countries CountryResource.new(self) end |
#fixture_events ⇒ Object
45 46 47 |
# File 'lib/sports_api/football/client.rb', line 45 def fixture_events FixtureEventResource.new(self) end |
#fixture_head_to_head ⇒ Object
37 38 39 |
# File 'lib/sports_api/football/client.rb', line 37 def fixture_head_to_head FixtureHeadToHeadResource.new(self) end |
#fixture_lineups ⇒ Object
49 50 51 |
# File 'lib/sports_api/football/client.rb', line 49 def fixture_lineups FixtureLineupResource.new(self) end |
#fixture_player_statistics ⇒ Object
53 54 55 |
# File 'lib/sports_api/football/client.rb', line 53 def fixture_player_statistics FixturePlayerStatisticResource.new(self) end |
#fixture_rounds ⇒ Object
33 34 35 |
# File 'lib/sports_api/football/client.rb', line 33 def fixture_rounds FixtureRoundResource.new(self) end |
#fixture_statistics ⇒ Object
41 42 43 |
# File 'lib/sports_api/football/client.rb', line 41 def fixture_statistics FixtureStatisticResource.new(self) end |
#fixtures ⇒ Object
29 30 31 |
# File 'lib/sports_api/football/client.rb', line 29 def fixtures FixtureResource.new(self) end |
#injuries ⇒ Object
57 58 59 |
# File 'lib/sports_api/football/client.rb', line 57 def injuries InjuryResource.new(self) end |
#inspect ⇒ Object
174 175 176 |
# File 'lib/sports_api/football/client.rb', line 174 def inspect '#<SportsApi::Football::Client>' end |
#league_seasons ⇒ Object
65 66 67 |
# File 'lib/sports_api/football/client.rb', line 65 def league_seasons LeagueSeasonResource.new(self) end |
#leagues ⇒ Object
61 62 63 |
# File 'lib/sports_api/football/client.rb', line 61 def leagues LeagueResource.new(self) end |
#odds ⇒ Object
69 70 71 |
# File 'lib/sports_api/football/client.rb', line 69 def odds OddsResource.new(self) end |
#odds_bets ⇒ Object
73 74 75 |
# File 'lib/sports_api/football/client.rb', line 73 def odds_bets OddsBetResource.new(self) end |
#odds_bookmakers ⇒ Object
77 78 79 |
# File 'lib/sports_api/football/client.rb', line 77 def odds_bookmakers OddsBookmakerResource.new(self) end |
#odds_live_bets ⇒ Object
85 86 87 |
# File 'lib/sports_api/football/client.rb', line 85 def odds_live_bets OddsLiveBetResource.new(self) end |
#odds_lives ⇒ Object
81 82 83 |
# File 'lib/sports_api/football/client.rb', line 81 def odds_lives OddsLiveResource.new(self) end |
#odds_mappings ⇒ Object
89 90 91 |
# File 'lib/sports_api/football/client.rb', line 89 def odds_mappings OddsMappingResource.new(self) end |
#player_seasons ⇒ Object
113 114 115 |
# File 'lib/sports_api/football/client.rb', line 113 def player_seasons PlayerSeasonResource.new(self) end |
#player_squads ⇒ Object
117 118 119 |
# File 'lib/sports_api/football/client.rb', line 117 def player_squads PlayerSquadResource.new(self) end |
#player_top_assists ⇒ Object
97 98 99 |
# File 'lib/sports_api/football/client.rb', line 97 def player_top_assists PlayerTopAssistResource.new(self) end |
#player_top_red_cards ⇒ Object
105 106 107 |
# File 'lib/sports_api/football/client.rb', line 105 def player_top_red_cards PlayerTopRedCardResource.new(self) end |
#player_top_scorers ⇒ Object
101 102 103 |
# File 'lib/sports_api/football/client.rb', line 101 def player_top_scorers PlayerTopScorerResource.new(self) end |
#player_top_yellow_cards ⇒ Object
109 110 111 |
# File 'lib/sports_api/football/client.rb', line 109 def player_top_yellow_cards PlayerTopYellowCardResource.new(self) end |
#players ⇒ Object
93 94 95 |
# File 'lib/sports_api/football/client.rb', line 93 def players PlayerResource.new(self) end |
#predictions ⇒ Object
121 122 123 |
# File 'lib/sports_api/football/client.rb', line 121 def predictions PredictionResource.new(self) end |
#sidelined ⇒ Object
125 126 127 |
# File 'lib/sports_api/football/client.rb', line 125 def sidelined SidelinedResource.new(self) end |
#standings ⇒ Object
129 130 131 |
# File 'lib/sports_api/football/client.rb', line 129 def standings StandingResource.new(self) end |
#team_countries ⇒ Object
137 138 139 |
# File 'lib/sports_api/football/client.rb', line 137 def team_countries TeamCountryResource.new(self) end |
#team_seasons ⇒ Object
141 142 143 |
# File 'lib/sports_api/football/client.rb', line 141 def team_seasons TeamSeasonResource.new(self) end |
#team_statistics ⇒ Object
145 146 147 |
# File 'lib/sports_api/football/client.rb', line 145 def team_statistics TeamStatisticResource.new(self) end |
#teams ⇒ Object
133 134 135 |
# File 'lib/sports_api/football/client.rb', line 133 def teams TeamResource.new(self) end |
#timezones ⇒ Object
149 150 151 |
# File 'lib/sports_api/football/client.rb', line 149 def timezones TimezoneResource.new(self) end |
#transfers ⇒ Object
153 154 155 |
# File 'lib/sports_api/football/client.rb', line 153 def transfers TransferResource.new(self) end |
#trophies ⇒ Object
157 158 159 |
# File 'lib/sports_api/football/client.rb', line 157 def trophies TrophyResource.new(self) end |
#venues ⇒ Object
161 162 163 |
# File 'lib/sports_api/football/client.rb', line 161 def venues VenueResource.new(self) end |