Class: Fotmob

Inherits:
Object
  • Object
show all
Defined in:
lib/fotmob.rb

Constant Summary collapse

BASE_URL =
"http://www.fotmob.com/api"
LEAGUES_URL =
BASE_URL + "/leagues?id="
MATCHES_URL =
BASE_URL + "/matches?date="
MATCH_DETAILS_URL =
BASE_URL + "/matchDetails?matchId="
PLAYER_URL =
BASE_URL + "/playerData?id="
TEAMS_URL =
BASE_URL + "/teams?id="

Instance Method Summary collapse

Instance Method Details

#get_league(league_id) ⇒ Object



13
14
15
16
# File 'lib/fotmob.rb', line 13

def get_league(league_id)
  json = URI.open(LEAGUES_URL+league_id).read
  symbolize_json(json)
end

#get_match_details(match_id) ⇒ Object



23
24
25
26
# File 'lib/fotmob.rb', line 23

def get_match_details(match_id)
  json = URI.open(MATCH_DETAILS_URL+match_id).read
  symbolize_json(json)
end

#get_matches(match_date) ⇒ Object



18
19
20
21
# File 'lib/fotmob.rb', line 18

def get_matches(match_date)
  json = URI.open(MATCHES_URL+match_date).read
  symbolize_json(json)
end

#get_player(player_id) ⇒ Object



28
29
30
31
# File 'lib/fotmob.rb', line 28

def get_player(player_id)
  json = URI.open(PLAYER_URL+player_id).read
  symbolize_json(json)
end

#get_team(team_id) ⇒ Object



33
34
35
36
# File 'lib/fotmob.rb', line 33

def get_team(team_id)
  json = URI.open(TEAMS_URL+team_id).read
  symbolize_json(json)
end