class Interwetten::MarketsClient

Public Instance Methods

feed_params() click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 5
def feed_params
  "BettingOffers"
end
get_competitions() click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 9
def get_competitions
  @competitions ||= @xml.search("LEAGUE").map { |value| value.get_attribute("NAME") }
end
get_competitions_with_id() click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 13
def get_competitions_with_id
  @competitions_with_id ||= @xml.search("LEAGUE").map { |value| { :name => value.get_attribute("NAME"), :id => value.get_attribute("ID") } }
end
get_events_for_competition(competition_id) click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 17
def get_events_for_competition(competition_id)
  @xml.search("LEAGUE[ID='#{competition_id}']").search("EVENT").map { |value| { :name => value.get_attribute("NAME"),
    :time => value.get_attribute("START_TIME") + " +2", :id => value.get_attribute("EVENTID") } }
end
get_market_for_event(event_id, type) click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 30
def get_market_for_event(event_id, type)
  @xml.search("EVENT[EVENTID='#{event_id}']").search("BET[TYPENAME='#{type}']").map { |value| { :id => value.get_attribute("ID"),
    :player1 => value.get_attribute("PLAYER1"), :player2 => value.get_attribute("PLAYER2"), :tip => value.get_attribute("TIP"), 
    :odds => value.get_attribute("QUOTE") } }
end
get_market_types_for_competition(competition_id) click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 36
def get_market_types_for_competition(competition_id)
  @xml.search("LEAGUE[ID='#{competition_id}']").search("BET").map { |value| value.get_attribute "TYPENAME" }.uniq
end
get_market_types_for_event(event_id) click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 40
def get_market_types_for_event(event_id)
  @xml.search("EVENT[EVENTID='#{event_id}']").search("BET").map { |value| value.get_attribute "TYPENAME" }.uniq
end
get_markets_for_competition(competition_id, type) click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 22
def get_markets_for_competition(competition_id, type)
  xml_events = @xml.search("LEAGUE[ID='#{competition_id}']").search("EVENT")
  xml_events.map do |xml_event|
    xml_event.search("BET[TYPENAME='#{type}']").map { |value| { :id => value.get_attribute("ID"), :player1 => value.get_attribute("PLAYER1"),
      :player2 => value.get_attribute("PLAYER2"), :tip => value.get_attribute("TIP"), :odds => value.get_attribute("QUOTE") } }
  end
end
get_odds_for_option(option_id) click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 49
def get_odds_for_option(option_id)
  @xml.search("BET[ID='#{option_id}']").first.get_attribute("QUOTE")
end
get_option(option_id) click to toggle source
# File lib/interwetten/clients/markets_client.rb, line 44
def get_option(option_id)
  option = @xml.search("BET[ID='#{option_id}']").first
  { :odds => option.get_attribute("QUOTE"), :player1 => option.get_attribute("PLAYER1"), :player2 => option.get_attribute("PLAYER2"), :tip => option.get_attribute("TIP") } if option
end