module Kickme
Constants
- VERSION
Public Class Methods
base_uri()
click to toggle source
# File lib/kickme/helpers.rb, line 25 def self.base_uri "http://www.football-data.co.uk" end
config()
click to toggle source
# File lib/kickme/helpers.rb, line 7 def self.config file = File.read("#{self.root}/config.json") JSON.parse(file) end
countries()
click to toggle source
# File lib/kickme/helpers.rb, line 16 def self.countries config["countries"] end
country_names()
click to toggle source
# File lib/kickme/helpers.rb, line 12 def self.country_names config["countries"].map { |country| country["name"] } end
country_page(country_name)
click to toggle source
# File lib/kickme/helpers.rb, line 29 def self.country_page(country_name) country_name = country_name.capitalize # frozen string error from thor country_url = countries.detect { |country| country["name"] == country_name }["web_entry"] Nokogiri::HTML(open("#{Kickme.base_uri}/#{country_url}")) end
leagues_for(country_name)
click to toggle source
# File lib/kickme/helpers.rb, line 20 def self.leagues_for(country_name) country_name = country_name.capitalize # frozen string error from thor countries.detect { |country| country["name"] == country_name }["leagues"] end
root()
click to toggle source
# File lib/kickme/helpers.rb, line 3 def self.root File.expand_path('../../..', __FILE__) end