Class: Fotmob::Client
- Inherits:
-
Object
- Object
- Fotmob::Client
- Defined in:
- lib/fotmob/client.rb
Overview
Main client for interacting with the FotMob API
Constant Summary collapse
- BASE_URL =
"http://www.fotmob.com/api"- DEFAULT_TIMEOUT =
seconds
10
Instance Attribute Summary collapse
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#get_league(league_id) ⇒ Hash
Get league/competition data.
-
#get_match_details(match_id) ⇒ Hash
Get detailed information about a specific match.
-
#get_matches(date) ⇒ Hash
Get matches for a specific date.
-
#get_player(player_id) ⇒ Hash
Get player data and statistics.
-
#get_team(team_id) ⇒ Hash
Get team data and statistics.
-
#initialize(timeout: DEFAULT_TIMEOUT) ⇒ Client
constructor
Initialize a new FotMob API client.
Constructor Details
#initialize(timeout: DEFAULT_TIMEOUT) ⇒ Client
Initialize a new FotMob API client
19 20 21 |
# File 'lib/fotmob/client.rb', line 19 def initialize(timeout: DEFAULT_TIMEOUT) @timeout = timeout end |
Instance Attribute Details
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
14 15 16 |
# File 'lib/fotmob/client.rb', line 14 def timeout @timeout end |
Instance Method Details
#get_league(league_id) ⇒ Hash
Get league/competition data
28 29 30 |
# File 'lib/fotmob/client.rb', line 28 def get_league(league_id) get("/leagues", id: league_id) end |
#get_match_details(match_id) ⇒ Hash
Get detailed information about a specific match
46 47 48 |
# File 'lib/fotmob/client.rb', line 46 def get_match_details(match_id) get("/matchDetails", matchId: match_id) end |
#get_matches(date) ⇒ Hash
Get matches for a specific date
37 38 39 |
# File 'lib/fotmob/client.rb', line 37 def get_matches(date) get("/matches", date: date) end |
#get_player(player_id) ⇒ Hash
Get player data and statistics
55 56 57 |
# File 'lib/fotmob/client.rb', line 55 def get_player(player_id) get("/playerData", id: player_id) end |
#get_team(team_id) ⇒ Hash
Get team data and statistics
64 65 66 |
# File 'lib/fotmob/client.rb', line 64 def get_team(team_id) get("/teams", id: team_id) end |