Title / Description
Code def get_and_parse_news(date = Time.now) response = news_request(date) if response cur_season_id = Season.get_cur_season.id response['Updates'].each do |update_item| footballer = Footballer.where(extid: update_item['Player']['OptaId'], season_id: cur_season_id).first next if footballer.nil? news_item = News.find_or_initialize_by(rotowire_update_idi: update_item['Id']) if news_item.new_record? news_item.assign_attributes( rotowire_update_idi: update_item['Id'], headline: update_item['Headline'], notes: update_item['Notes'], analysis: update_item['Analysis'], news_date: update_item['DateTime'], headline_background_color: footballer.real_team.color, source: 'http://rotowire.com', source_name: 'RotoWire' ) news_item.save! news_item.footballers << footballer end end end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code