Class: SportDb::Model::Quote

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/sportdb/market/models/quote.rb

Class Method Summary collapse

Class Method Details

.create_from_ary!(games_with_odds, service) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/sportdb/market/models/quote.rb', line 12

def self.create_from_ary!( games_with_odds, service )
  games_with_odds.each do |values|
    Quote.create!(
      :service => service,
      :game    => values[0],
      :odds1   => values[1],
      :oddsx   => values[2],
      :odds2   => values[3])
  end # each games
end

.create_from_ary_for_round!(games_with_odds, service, round) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/sportdb/market/models/quote.rb', line 23

def self.create_from_ary_for_round!( games_with_odds, service, round )
  games_with_odds.each do |values|
    Quote.create!(
      :service => service,
      :game    => Game.find_by_round_id_and_team1_id_and_team2_id!( round.id, values[0].id, values[1].id),
      :odds1   => values[2],
      :oddsx   => values[3],
      :odds2   => values[4])
  end # each games
end