class Celly::Leaders

Constants

BASE_URL

Public Instance Methods

assists(season) click to toggle source
# File lib/celly/leaders.rb, line 20
def assists(season)
  end_point = "/stats/leaders?leaderCategories=assists&season#{season}"
  uri = URI("#{BASE_URL}#{end_point}")
  response = Net::HTTP.get_response(uri)

  if response.code == '200'
    json_response = JSON.parse(response.body)
    {status: response.code, message: response.message, data: json_response["leagueLeaders"]}
  else
    {status: response.code, message: response.message}
  end
end
goals(season) click to toggle source
# File lib/celly/leaders.rb, line 7
def goals(season)
  end_point = "/stats/leaders?leaderCategories=goals&season#{season}"
  uri = URI("#{BASE_URL}#{end_point}")
  response = Net::HTTP.get_response(uri)

  if response.code == '200'
    json_response = JSON.parse(response.body)
    {status: response.code, message: response.message, data: json_response["leagueLeaders"]}
  else
    {status: response.code, message: response.message}
  end
end
points(season) click to toggle source
# File lib/celly/leaders.rb, line 33
def points(season)
  end_point = "/stats/leaders?leaderCategories=points&season#{season}"
  uri = URI("#{BASE_URL}#{end_point}")
  response = Net::HTTP.get_response(uri)

  if response.code == '200'
    json_response = JSON.parse(response.body)
    {status: response.code, message: response.message, data: json_response["leagueLeaders"]}
  else
    {status: response.code, message: response.message}
  end
end
shutouts(season) click to toggle source
# File lib/celly/leaders.rb, line 46
def shutouts(season)
  end_point = "/stats/leaders?leaderCategories=shutouts&season#{season}"
  uri = URI("#{BASE_URL}#{end_point}")
  response = Net::HTTP.get_response(uri)

  if response.code == '200'
    json_response = JSON.parse(response.body)
    {status: response.code, message: response.message, data: json_response["leagueLeaders"]}
  else
    {status: response.code, message: response.message}
  end

end
wins(season) click to toggle source
# File lib/celly/leaders.rb, line 60
def wins(season)
  end_point = "/stats/leaders?leaderCategories=wins&season#{season}"
  uri = URI("#{BASE_URL}#{end_point}")
  response = Net::HTTP.get_response(uri)

  if response.code == '200'
    json_response = JSON.parse(response.body)
    {status: response.code, message: response.message, data: json_response["leagueLeaders"]}
  else
    {status: response.code, message: response.message}
  end
end