Class: SportDB::Models::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



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

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



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

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