lib/sportradar/api/football/ncaafb.rb in sportradar-api-0.11.0 vs lib/sportradar/api/football/ncaafb.rb in sportradar-api-0.11.1
- old
+ new
@@ -54,11 +54,11 @@
end
def division(code_name)
divisions_by_name[code_name]
end
private def divisions_by_name
- @divisions_by_name ||= divisions.map { |d| [d.alias, d] }.to_h
+ @divisions_by_name ||= divisions.map { |d| [d.id, d] }.to_h
end
def conferences
divisions.flat_map(&:conferences)
end
@@ -176,12 +176,12 @@
url, headers, options, timeout = api.get_request_info(path_weekly_schedule(ncaafb_season_week))
{url: url, headers: headers, params: options, timeout: timeout, callback: method(:ingest_weekly_schedule)}
end
## hierarchy
- def get_hierarchy
- data = api.get_data(path_hierarchy).to_h
+ def get_hierarchy(division = 'FBS')
+ data = api.get_data(path_hierarchy(division)).to_h
ingest_hierarchy(data)
end
def ingest_hierarchy(data)
create_data(@divisions_hash, data, klass: Division, hierarchy: self, api: api)
@@ -214,11 +214,11 @@
data = api.get_data(path_standings).to_h
ingest_standings(data)
end
def ingest_standings(data)
- update(data.dig('league','season'), source: :teams)
+ update(data, source: :teams)
data
end
def queue_standings
url, headers, options, timeout = api.get_request_info(path_standings)
@@ -242,18 +242,18 @@
# url, headers, options, timeout = api.get_request_info(path_venues)
# {url: url, headers: headers, params: options, timeout: timeout, callback: method(:ingest_venues)}
# end
def self.sim_api
- Sportradar::Api::Football::Ncaafb::Api.new('sim-t')
+ Sportradar::Api::Football::Ncaafb::Api.new.sim!
end
def self.simulation
new({}, api: sim_api, year: 2015, type: 'reg')
end
def self.simulations
api = sim_api
['2015/REG/1/WKY/MSH', '2015/REG/1/KEN/FLA', '2015/REG/1/WOU/PRST'].map do |game_uri|
- Game.new({'uri' => game_uri}, api: api)
+ Game.new({'id' => game_uri}).sim!
end
end
end
end