em-betfair 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
+ .yardoc/
2
+ doc/
1
3
  .DS_Store
2
4
  Gemfile.lock
3
5
  .rvmrc
data/README.md CHANGED
@@ -4,6 +4,7 @@ em-betfair is a work in progress evented client for the Betfair API. The followi
4
4
 
5
5
  - login
6
6
  - getMarket
7
+ - getSilksV2
7
8
  - getAllMarkets
8
9
  - getMarketPricesCompressed
9
10
  - getMarketTradedVolumeCompressed
@@ -35,7 +36,7 @@ Making a call to the API:
35
36
  rsp.hash_response # access a hash of the response data
36
37
 
37
38
  rsp.successfull # boolean for success
38
- rsp.error # API error messge if not successfull
39
+ rsp.error # API error message if not successfull
39
40
 
40
41
  end
41
42
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "em-betfair"
5
- s.version = "0.2"
5
+ s.version = "0.3"
6
6
  s.authors = ["George Sheppard"]
7
7
  s.email = ["george@fuzzmonkey.co.uk"]
8
8
  s.homepage = "https://github.com/fuzzmonkey/em-betfair"
@@ -1,3 +1,5 @@
1
+ # Betfair::Client
2
+
1
3
  require 'uri'
2
4
  require 'em-http'
3
5
  require 'nokogiri'
@@ -6,6 +8,8 @@ require 'nokogiri'
6
8
  module Betfair
7
9
 
8
10
  BETFAIR_TIME_ZONES = {"RSA"=>"Africa/Johannesburg", "AST"=>"US/Arizona", "MST"=>"US/Mountain", "JPT"=>"Japan", "HK"=>"Hongkong", "GMT"=>"GMT", "PKT"=>"Etc/GMT-5", "UAE"=>"Asia/Dubai", "CST"=>"US/Central", "AKST"=>"US/Alaska", "BRT"=>"Brazil/East", "INT"=>"Asia/Calcutta", "SMT"=>"America/Santiago", "MSK"=>"Europe/Moscow", "AWST"=>"Australia/Perth", "PST"=>"US/Pacific", "EST"=>"US/Eastern", "KMT"=>"Jamaica", "CET"=>"CET", "ANST"=>"Australia/Darwin", "ACST"=>"Australia/Adelaide", "NZT"=>"NZ", "UKT"=>"Europe/London", "AMT"=>"Brazil/West", "THAI"=>"Asia/Bangkok", "SJMT"=>"America/Costa_Rica", "HST"=>"US/Hawaii", "EET"=>"EET", "AEST"=>"Australia/Sydney", "IEST"=>"America/Indiana/Indianapolis", "AQST"=>"Australia/Queensland"}
11
+ REQUEST_RATE_LIMITS = {"login" => 24, "get_market" => 5, "get_market_info" => 5, "get_market_prices_compressed" => 60, "get_market_traded_volume_compressed" => 60 }
12
+ FREE_PRODUCT_ID = 82
9
13
 
10
14
  class Client
11
15
 
@@ -16,6 +20,8 @@ module Betfair
16
20
  def initialize config
17
21
  @config = config
18
22
  @session_token = nil
23
+ @num_requests = {}
24
+ EventMachine::PeriodicTimer.new(60) { reset_requests } if EM.reactor_running?
19
25
  end
20
26
 
21
27
  # Creates a session on the Betfair API, used by Betfair::Client internally to maintain session.
@@ -25,39 +31,53 @@ module Betfair
25
31
 
26
32
  # Returns all the available markets on Betfair.
27
33
  #
28
- # countries - array of ISO 3166-1 country codes
29
- # event_type_ids - array of Betfair event ids
30
- # to_date - DateTime
31
- # from_date - DateTime
34
+ # @param [Array] countries array of ISO 3166-1 country codes
35
+ # @param [Array] event_type_ids array of Betfair event ids
36
+ # @param [DateTime] to_date start time range of events to retrieve
37
+ # @param [DateTime] from_date end time range of events to retrieve
38
+ # @return [Betfair::Response]
32
39
  def get_all_markets countries=nil, event_type_ids=nil, to_date=nil, from_date=nil, &block
33
40
  with_session do
34
41
  build_request "exchange", "get_all_markets", {"countries" => countries, "event_type_ids" => event_type_ids, "to_date" => to_date, "from_date" => from_date}, block
35
42
  end
36
43
  end
37
44
 
38
- # Returns the details of a specifc market
45
+ # Returns the details for a specifc market.
39
46
  #
40
- # market_id - Betfair market ID
47
+ # @param [String] market_id Betfair market ID
48
+ # @return [Betfair::Response]
41
49
  def get_market market_id, &block
42
50
  with_session do
43
51
  build_request "exchange", "get_market", {"market_id" => market_id }, block
44
52
  end
45
53
  end
46
54
 
47
- # Returns the compressed market prices
55
+ # Returns the runner details for specifc markets.
56
+ #
57
+ # @param [Array] market_ids Betfair market IDs
58
+ # @return [Betfair::Response]
59
+ def get_silks_v2 market_ids, &block
60
+ with_session do
61
+ build_request "exchange", "get_silks_v2", {"market_ids" => market_ids }, block
62
+ end
63
+ end
64
+
65
+ # Returns the compressed market prices for a specifc market.
48
66
  #
49
- # market_id - Betfair market ID
50
- # currency_code - three letter ISO 4217 country code
67
+ # @param [String] market_id Betfair market ID
68
+ # @param [String] currency_code three letter ISO 4217 country code
69
+ # @return [Betfair::Response]
51
70
  def get_market_prices_compressed market_id, currency_code=nil, &block
52
71
  with_session do
53
72
  build_request "exchange", "get_market_prices_compressed", {"market_id" => market_id, "currency_code" => currency_code}, block
54
73
  end
55
74
  end
56
75
 
57
- # Returns the compressed traded volumes
76
+ # Returns the compressed traded volumes for a specifc market.
58
77
  #
59
- # market_id - Betfair market ID
60
- # currency_code - three letter ISO 4217 country code
78
+ # @param [String] market_id Betfair market ID
79
+ # @param [String] currency_code three letter ISO 4217 country code
80
+ # @return [Betfair::Response]
61
81
  def get_market_traded_volume_compressed market_id, currency_code=nil, &block
62
82
  with_session do
63
83
  build_request "exchange", "get_market_traded_volume_compressed", {"market_id" => market_id, "currency_code" => currency_code}, block
@@ -72,24 +92,31 @@ module Betfair
72
92
  # action - the API method to call on the API
73
93
  # data - hash of parameters to populate the SOAP request
74
94
  # block - the ballback for this request
75
- def build_request service_name, action, data={}, block
95
+ def build_request service_name, request_action, data={}, block
96
+ puts "building request #{service_name} #{request_action}"
97
+ if defer_request? request_action
98
+ EventMachine::Timer.new(30) { build_request(service_name, request_action, data, block) }
99
+ return
100
+ end
101
+ increment_num_requests request_action unless @session_token && request_action == "login"
76
102
  request_data = { :data => data.merge!({"session_token" => @session_token}) }
77
- soap_req = Betfair::SOAPRenderer.new( service_name, action ).render( request_data )
103
+ soap_req = Betfair::SOAPRenderer.new( service_name, request_action ).render( request_data )
78
104
  url = get_endpoint service_name
79
- headers = { 'SOAPAction' => action, 'Accept-Encoding' => 'gzip,deflate', 'Content-type' => 'text/xml;charset=UTF-8' }
105
+ headers = { 'SOAPAction' => request_action, 'Accept-Encoding' => 'gzip,deflate', 'Content-type' => 'text/xml;charset=UTF-8' }
80
106
  req = EventMachine::HttpRequest.new(url).post :body => soap_req, :head => headers
81
107
  req.errback { block.call(Response.new(nil,nil,false,"Error connecting to the API")) }
82
- req.callback { parse_response(req.response,block) }
108
+ req.callback { parse_response(request_action,req.response,block) }
83
109
  end
84
110
 
85
111
  # Parses the API response, building a response object
86
112
  #
87
- # raw_rsp - response body from EM:Http request
88
- # block - callback for this request
89
- def parse_response raw_rsp, block
113
+ # @param [String] raw_rsp response body from EM:Http request
114
+ # block [block] block callback for this request
115
+ def parse_response request_action, raw_rsp, block
90
116
  parsed_response = Nokogiri::XML raw_rsp
91
117
 
92
118
  soap_fault = parsed_response.xpath("//faultstring").first
119
+ puts soap_fault
93
120
  if soap_fault
94
121
  block.call(Response.new(raw_rsp,parsed_response,false,soap_fault.text))
95
122
  return
@@ -97,6 +124,9 @@ module Betfair
97
124
 
98
125
  api_error = parsed_response.xpath("//header/errorCode").text
99
126
  method_error = parsed_response.xpath("//errorCode").last.text
127
+
128
+ puts api_error
129
+ puts method_error
100
130
 
101
131
  error_rsp = api_error == "OK" ? method_error : api_error
102
132
  unless api_error == "OK" && method_error == "OK"
@@ -104,7 +134,6 @@ module Betfair
104
134
  block.call(Response.new(raw_rsp,parsed_response,false,error_rsp))
105
135
  return
106
136
  end
107
-
108
137
  @session_token = parsed_response.xpath("//sessionToken").text
109
138
 
110
139
  block.call Response.new(raw_rsp,parsed_response,true)
@@ -121,6 +150,27 @@ module Betfair
121
150
  return @config["#{service_name}_endpoint"]
122
151
  end
123
152
 
153
+ def increment_num_requests request_action
154
+ @num_requests[request_action] ||= 0
155
+ @num_requests[request_action] +=1
156
+ # puts "#{request_action} set to #{@num_requests[request_action]}"
157
+ end
158
+
159
+ def reset_requests
160
+ @num_requests = {}
161
+ end
162
+
163
+ # Checks the number of requests this minute against the free API rate limits
164
+ # @param [String] request_action soap request to check limits for
165
+ # @return [boolean] whether the request should be deferred
166
+ def defer_request? request_action
167
+ return false unless REQUEST_RATE_LIMITS[request_action] && @config["product_id"] != FREE_PRODUCT_ID
168
+ # puts "defer_request? #{request_action} : #{@num_requests[request_action].to_i >= REQUEST_RATE_LIMITS[request_action]}"
169
+ # puts "Rate limit : #{REQUEST_RATE_LIMITS[request_action]}"
170
+ # puts "Requests this minute : #{@num_requests[request_action]}"
171
+ return @num_requests[request_action].to_i >= REQUEST_RATE_LIMITS[request_action]
172
+ end
173
+
124
174
  end
125
175
 
126
176
  end
@@ -1,22 +1,19 @@
1
- # Stolen from Rails 3
2
- def underscore(camel_cased_word)
3
- camel_cased_word.to_s.gsub(/::/, '/').
4
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
5
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
6
- tr("-", "_").
7
- downcase
8
- end
1
+ # Response object used to return different formats of responses from the Betfair API.
9
2
 
10
3
  module Betfair
11
4
 
12
5
  class Response
13
6
  include ResponseParser
14
7
 
15
- attr_accessor :raw_response # response string
16
- attr_accessor :parsed_response # response xml
17
- attr_accessor :successfull
18
- attr_accessor :error
8
+ attr_accessor :raw_response # raw response body (String)
9
+ attr_accessor :parsed_response # response xml (Nokogiri::XML object)
10
+ attr_accessor :successfull # boolean
11
+ attr_accessor :error # String error message
19
12
 
13
+ # @param [String] raw raw request body from EM::Http request
14
+ # @param [String] parsed Nokogiri XML object
15
+ # @param [Boolean] successfull boolean for status of request
16
+ # @param [String] error error message
20
17
  def initialize raw, parsed, successfull, error=""
21
18
  @raw_response = raw
22
19
  @parsed_response = parsed
@@ -24,18 +21,30 @@ module Betfair
24
21
  @error = error
25
22
  end
26
23
 
27
- # lazy loaded
24
+ # @return Hash of response parsed using the Betfair::ResponseParser
28
25
  def hash_response
29
26
  method = get_response_type
30
27
  self.send method.to_sym, self.parsed_response if method && self.respond_to?(method)
31
28
  end
32
29
 
30
+ # Gets the response method based on the parsed response object
33
31
  def get_response_type
34
32
  return nil unless self.parsed_response.respond_to?(:xpath)
35
33
  response_type = self.parsed_response.xpath("//ns:Envelope/ns:Body", "ns" => "http://schemas.xmlsoap.org/soap/envelope/").first.elements.first.name
36
34
  underscore(response_type.gsub("Response",""))
37
35
  end
38
36
 
37
+ # Stolen from active support
38
+ # @param [String] camel_cased_word Camel cased method name
39
+ # @return [String] underscored method name
40
+ def underscore(camel_cased_word)
41
+ camel_cased_word.to_s.gsub(/::/, '/').
42
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
43
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
44
+ tr("-", "_").
45
+ downcase
46
+ end
47
+
39
48
  end
40
49
 
41
50
  end
@@ -1,3 +1,5 @@
1
+ # Utility class for chopping up Betfair API responses and turning them into hashes
2
+
1
3
  module Betfair
2
4
 
3
5
  # TODO - version this to handle changes in the API
@@ -15,6 +17,8 @@ module Betfair
15
17
  {"currency" => xml.xpath("//currency").text}
16
18
  end
17
19
 
20
+ # @param xml Nokogiri XML object
21
+ # @return hash of get_all_markets response
18
22
  def get_all_markets xml
19
23
  market_data = xml.xpath("//marketData").text
20
24
  all_markets_hash = {"market_data" => {}}
@@ -44,6 +48,8 @@ module Betfair
44
48
  all_markets_hash
45
49
  end
46
50
 
51
+ # @param xml Nokogiri XML object
52
+ # @return hash of get_market response
47
53
  def get_market xml
48
54
  market_hash = {}
49
55
  market_hash["id"] = xml.xpath("//market/marketId").text
@@ -67,6 +73,60 @@ module Betfair
67
73
  market_hash
68
74
  end
69
75
 
76
+ def get_silks_v2 xml
77
+ markets = {}
78
+ n2 = "http://www.betfair.com/publicapi/types/exchange/v5/"
79
+ xml.xpath("//marketDisplayDetails/n2:MarketDisplayDetail", "n2" => n2).each do |market_xml|
80
+ market_id = market_xml.xpath("marketId").text
81
+ markets[market_id] = {"runners" => {} }
82
+ market_xml.xpath("racingSilks/n2:RacingSilk","n2" => n2).each do |xml_racing_silk|
83
+ selection_id = xml_racing_silk.xpath("selectionId").text
84
+ runner_hash = {}
85
+ markets[market_id]["runners"][selection_id] = runner_hash
86
+
87
+ runner_hash["silks_url"] = xml_racing_silk.xpath("silksURL").text
88
+ runner_hash["silks_text"] = xml_racing_silk.xpath("silksText").text
89
+
90
+ runner_hash["trainer_name"] = xml_racing_silk.xpath("trainerName").text
91
+ runner_hash["age_weight"] = xml_racing_silk.xpath("ageWeight").text
92
+ runner_hash["form"] = xml_racing_silk.xpath("form").text
93
+ runner_hash["days_since"] = xml_racing_silk.xpath("daysSince").text
94
+ runner_hash["jockey_claim"] = xml_racing_silk.xpath("jockeyClaim").text
95
+ runner_hash["wearing"] = xml_racing_silk.xpath("wearing").text
96
+ runner_hash["saddle_cloth"] = xml_racing_silk.xpath("saddleCloth").text
97
+ runner_hash["stall_draw"] = xml_racing_silk.xpath("stallDraw").text
98
+ runner_hash["owner_name"] = xml_racing_silk.xpath("ownerName").text
99
+ runner_hash["jockey_name"] = xml_racing_silk.xpath("jockeyName").text
100
+ runner_hash["colour"] = xml_racing_silk.xpath("colour").text
101
+ runner_hash["sex"] = xml_racing_silk.xpath("sex").text
102
+ runner_hash["bred"] = xml_racing_silk.xpath("bred").text
103
+ forecast_numerator = xml_racing_silk.xpath("forecastPriceNumerator").text
104
+ forecast_denominator = xml_racing_silk.xpath("forecastPriceDenominator").text
105
+ runner_hash["forecast_price"] = "#{forecast_numerator}/#{forecast_denominator}"
106
+ runner_hash["official_rating"] = xml_racing_silk.xpath("officialRating").text
107
+
108
+ runner_hash["sire"] = {}
109
+ runner_hash["sire"]["name"] = xml_racing_silk.xpath("sire/name").text
110
+ runner_hash["sire"]["bred"] = xml_racing_silk.xpath("sire/bred").text
111
+ runner_hash["sire"]["year_born"] = xml_racing_silk.xpath("sire/yearBorn").text
112
+
113
+ runner_hash["dam"] = {}
114
+ runner_hash["dam"]["name"] = xml_racing_silk.xpath("dam/name").text
115
+ runner_hash["dam"]["bred"] = xml_racing_silk.xpath("dam/bred").text
116
+ runner_hash["dam"]["year_born"] = xml_racing_silk.xpath("dam/yearBorn").text
117
+
118
+ runner_hash["dam_sire"] = {}
119
+ runner_hash["dam_sire"]["name"] = xml_racing_silk.xpath("damSire/name").text
120
+ runner_hash["dam_sire"]["bred"] = xml_racing_silk.xpath("damSire/bred").text
121
+ runner_hash["dam_sire"]["year_born"] = xml_racing_silk.xpath("damSire/yearBorn").text
122
+
123
+ end
124
+ end
125
+ markets
126
+ end
127
+
128
+ # @param xml Nokogiri XML object
129
+ # @return hash of get_market_prices_compressed response
70
130
  def get_market_prices_compressed xml
71
131
  prices_hash = {}
72
132
  prices = xml.xpath("//marketPrices").text
@@ -105,6 +165,8 @@ module Betfair
105
165
  prices_hash
106
166
  end
107
167
 
168
+ # @param xml Nokogiri XML object
169
+ # @return hash of get_market_traded_volume_compressed response
108
170
  def get_market_traded_volume_compressed xml
109
171
  traded_volumne_hash = {}
110
172
  traded = xml.xpath("//tradedVolume").text
@@ -6,7 +6,9 @@ module Betfair
6
6
  # Utility class to render a SOAP request from a haml file, embedding data
7
7
  # elements as necessary
8
8
  class SOAPRenderer
9
-
9
+
10
+ # @param [String] service, one of 'exchange' or 'global'
11
+ # @param [String] soap_name name of the soap request to render
10
12
  def initialize service, soap_name
11
13
  base = Pathname.new(__FILE__).realpath.parent
12
14
  file = "#{base}/views/#{service}/#{soap_name}.haml"
@@ -17,6 +19,8 @@ module Betfair
17
19
  @engine = Haml::Engine.new( File.read( file ) ) # this is quite expensive, might be better to keep a hash of renderers
18
20
  end
19
21
 
22
+ # @param [Hash] content hash of values to include in XML request
23
+ # @return [String] xml request body
20
24
  def render content
21
25
  content.each do |key,value|
22
26
  self.instance_variable_set( "@#{key}", value )
@@ -0,0 +1,14 @@
1
+ %soapenv:Envelope{"xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/", "xmlns:bfex" => "http://www.betfair.com/publicapi/v5/BFExchangeService/" }
2
+ %soapenv:Header
3
+ %soapenv:Body
4
+ %bfex:getSilksV2
5
+ %bfex:request
6
+ %header
7
+ - if @data["client_stamp"]
8
+ %clientStamp= @data["client_stamp"]
9
+ %sessionToken= @data["session_token"]
10
+ - if @data["locale"]
11
+ %locale= @data["locale"]
12
+ %markets
13
+ - @data["market_ids"].each do |market|
14
+ %bfex:int= market
@@ -30,7 +30,7 @@ EM::run {
30
30
  config = {
31
31
  "username" => "<YOUR BETFAIR USERNAME>",
32
32
  "password" => "<YOUR BETFAIR PASSWORD>",
33
- "product_id" => "<YOUR BETFAIR PRODUCTID>",
33
+ "product_id" => "<YOUR BETFAIR PRODUCTID>",
34
34
  "exchange_endpoint" => "https://api.betfair.com/exchange/v5/BFExchangeService",
35
35
  "global_endpoint" => "https://api.betfair.com/global/v3/BFGlobalService"
36
36
  }
@@ -6,7 +6,8 @@ config = {
6
6
  "password" => "some_password",
7
7
  "product_id" => 22,
8
8
  "exchange_endpoint" => "http://exchange.betfair.com", #"https://api.betfair.com/exchange/v5/BFExchangeService",
9
- "global_endpoint" => "http://global.betfair.com" #"https://api.betfair.com/global/v3/BFGlobalService"
9
+ "global_endpoint" => "http://global.betfair.com", #"https://api.betfair.com/global/v3/BFGlobalService"
10
+ "silks_base_url" => "http://content-cache.betfair.com/feeds_images/Horses/SilkColours/"
10
11
  }
11
12
 
12
13
  describe Betfair::Client do
@@ -110,6 +111,24 @@ describe Betfair::Client do
110
111
 
111
112
  end
112
113
 
114
+ describe "get_silks_v2" do
115
+
116
+ it "should handle an OK response" do
117
+ stub_request(:post, "http://global.betfair.com").to_return(:body => load_response("login_ok.xml"), :status => 200)
118
+ stub_request(:post, "http://exchange.betfair.com").to_return(:body => load_response("get_silks_v2.xml"), :status => 200)
119
+ EM::run {
120
+ @bf_client.get_silks_v2 ["104968439"] do |rsp|
121
+ rsp.successfull.should eq true
122
+ rsp.error.should eq ""
123
+ rsp.hash_response.should be_an_instance_of Hash
124
+ rsp.parsed_response.xpath("//marketDisplayDetails").children.should_not be_empty
125
+ EM::stop
126
+ end
127
+ }
128
+ end
129
+
130
+ end
131
+
113
132
  describe "get_market_prices_compressed" do
114
133
 
115
134
  it "should handle an OK response" do
@@ -39,6 +39,19 @@ describe Betfair::Client do
39
39
  end
40
40
 
41
41
  end
42
+
43
+ describe "get_silks_v2" do
44
+
45
+ it "should work against a remote API" do
46
+ # EM::run {
47
+ # @bf_client.get_silks_v2 [105668397] do |response|
48
+ # puts response.raw_response
49
+ # EM::stop
50
+ # end
51
+ # }
52
+ end
53
+
54
+ end
42
55
 
43
56
  describe "get_market_prices_compressed" do
44
57
 
@@ -0,0 +1,385 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:n2="http://www.betfair.com/publicapi/types/exchange/v5/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3
+ <soap:Body>
4
+ <n:getSilksV2Response xmlns:n="http://www.betfair.com/publicapi/v5/BFExchangeService/">
5
+ <n:Result xsi:type="n2:GetSilksV2Resp">
6
+ <header xsi:type="n2:APIResponseHeader">
7
+ <errorCode xsi:type="n2:APIErrorEnum">OK</errorCode>
8
+ <minorErrorCode xsi:nil="1"/>
9
+ <sessionToken xsi:type="xsd:string">UbGrFAIEUBT4iMgyjohRHDuJfA+FzuFxbX/rL8Evgkw=</sessionToken>
10
+ <timestamp xsi:type="xsd:dateTime">2012-05-08T19:39:55.234Z</timestamp>
11
+ </header>
12
+ <errorCode xsi:type="n2:GetSilksErrorEnum">OK</errorCode>
13
+ <minorErrorCode xsi:nil="1"/>
14
+ <marketDisplayDetails xsi:type="n2:ArrayOfMarketDisplayDetailV2">
15
+ <n2:MarketDisplayDetail xsi:type="n2:MarketDisplayDetailV2">
16
+ <marketId xsi:type="xsd:int">105668397</marketId>
17
+ <racingSilks xsi:type="n2:ArrayOfRacingSilkV2">
18
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
19
+ <selectionId xsi:type="xsd:int">5446714</selectionId>
20
+ <silksURL xsi:type="xsd:string">c20120508cat/00074030.jpg</silksURL>
21
+ <silksText xsi:type="xsd:string">White, dark blue triple diamond, dark blue and white diabolo on sleeves, white cap, dark blue diamond</silksText>
22
+ <trainerName xsi:type="xsd:string">Richard Whitaker</trainerName>
23
+ <ageWeight xsi:type="xsd:string">4/9-6</ageWeight>
24
+ <form xsi:type="xsd:string">1343-</form>
25
+ <daysSince xsi:type="xsd:int">237</daysSince>
26
+ <jockeyClaim xsi:type="xsd:int">3</jockeyClaim>
27
+ <wearing xsi:nil="1"/>
28
+ <saddleCloth xsi:type="xsd:int">3</saddleCloth>
29
+ <stallDraw xsi:type="xsd:int">3</stallDraw>
30
+ <ownerName xsi:type="xsd:string">Mrs Jane Newett</ownerName>
31
+ <jockeyName xsi:type="xsd:string">Amy Ryan</jockeyName>
32
+ <colour xsi:type="xsd:string">ch</colour>
33
+ <sex xsi:type="xsd:string">f</sex>
34
+ <bred xsi:type="xsd:string">GB</bred>
35
+ <forecastPriceNumerator xsi:type="xsd:int">13</forecastPriceNumerator>
36
+ <forecastPriceDenominator xsi:type="xsd:int">2</forecastPriceDenominator>
37
+ <officialRating xsi:type="xsd:int">68</officialRating>
38
+ <sire xsi:type="n2:Breeding">
39
+ <name xsi:type="xsd:string">Namid</name>
40
+ <bred xsi:type="xsd:string">UK</bred>
41
+ <yearBorn xsi:type="xsd:string">1996</yearBorn>
42
+ </sire>
43
+ <dam xsi:type="n2:Breeding">
44
+ <name xsi:type="xsd:string">Petra Nova</name>
45
+ <bred xsi:type="xsd:string">UK</bred>
46
+ <yearBorn xsi:type="xsd:string">1996</yearBorn>
47
+ </dam>
48
+ <damSire xsi:type="n2:Breeding">
49
+ <name xsi:type="xsd:string">First Trump</name>
50
+ <bred xsi:type="xsd:string">UK</bred>
51
+ <yearBorn xsi:type="xsd:string">1991</yearBorn>
52
+ </damSire>
53
+ </n2:RacingSilk>
54
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
55
+ <selectionId xsi:type="xsd:int">4691268</selectionId>
56
+ <silksURL xsi:type="xsd:string">c20120508cat/00075682.jpg</silksURL>
57
+ <silksText xsi:type="xsd:string">Black, pink seams, striped sleeves, pink cap</silksText>
58
+ <trainerName xsi:type="xsd:string">Ruth Carr</trainerName>
59
+ <ageWeight xsi:type="xsd:string">4/9-5</ageWeight>
60
+ <form xsi:type="xsd:string">468900-</form>
61
+ <daysSince xsi:type="xsd:int">165</daysSince>
62
+ <jockeyClaim xsi:type="xsd:int">0</jockeyClaim>
63
+ <wearing xsi:nil="1"/>
64
+ <saddleCloth xsi:type="xsd:int">4</saddleCloth>
65
+ <stallDraw xsi:type="xsd:int">9</stallDraw>
66
+ <ownerName xsi:type="xsd:string">Paul Saxton &amp; The Bottom Liners</ownerName>
67
+ <jockeyName xsi:type="xsd:string">James Sullivan</jockeyName>
68
+ <colour xsi:type="xsd:string">b</colour>
69
+ <sex xsi:type="xsd:string">g</sex>
70
+ <bred xsi:type="xsd:string">IRE</bred>
71
+ <forecastPriceNumerator xsi:type="xsd:int">12</forecastPriceNumerator>
72
+ <forecastPriceDenominator xsi:type="xsd:int">1</forecastPriceDenominator>
73
+ <officialRating xsi:type="xsd:int">67</officialRating>
74
+ <sire xsi:type="n2:Breeding">
75
+ <name xsi:type="xsd:string">Kheleyf</name>
76
+ <bred xsi:type="xsd:string">USA</bred>
77
+ <yearBorn xsi:type="xsd:string">2001</yearBorn>
78
+ </sire>
79
+ <dam xsi:type="n2:Breeding">
80
+ <name xsi:type="xsd:string">Diplomats Daughter</name>
81
+ <bred xsi:type="xsd:string">UK</bred>
82
+ <yearBorn xsi:type="xsd:string">2001</yearBorn>
83
+ </dam>
84
+ <damSire xsi:type="n2:Breeding">
85
+ <name xsi:type="xsd:string">Unfuwain</name>
86
+ <bred xsi:type="xsd:string">USA</bred>
87
+ <yearBorn xsi:type="xsd:string">1985</yearBorn>
88
+ </damSire>
89
+ </n2:RacingSilk>
90
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
91
+ <selectionId xsi:type="xsd:int">2503257</selectionId>
92
+ <silksURL xsi:type="xsd:string">c20120508cat/00077008.jpg</silksURL>
93
+ <silksText xsi:type="xsd:string">Pink, emerald green triple diamond, diamonds on sleeves, emerald green cap</silksText>
94
+ <trainerName xsi:type="xsd:string">Daniel Loughnane</trainerName>
95
+ <ageWeight xsi:type="xsd:string">7/9-7</ageWeight>
96
+ <form xsi:type="xsd:string">372111</form>
97
+ <daysSince xsi:type="xsd:int">42</daysSince>
98
+ <jockeyClaim xsi:type="xsd:int">0</jockeyClaim>
99
+ <wearing xsi:type="xsd:string">tongue strap</wearing>
100
+ <saddleCloth xsi:type="xsd:int">1</saddleCloth>
101
+ <stallDraw xsi:type="xsd:int">5</stallDraw>
102
+ <ownerName xsi:type="xsd:string">Mrs C. Loughnane</ownerName>
103
+ <jockeyName xsi:type="xsd:string">Shane Kelly</jockeyName>
104
+ <colour xsi:type="xsd:string">b</colour>
105
+ <sex xsi:type="xsd:string">g</sex>
106
+ <bred xsi:type="xsd:string">IRE</bred>
107
+ <forecastPriceNumerator xsi:type="xsd:int">7</forecastPriceNumerator>
108
+ <forecastPriceDenominator xsi:type="xsd:int">2</forecastPriceDenominator>
109
+ <officialRating xsi:type="xsd:int">69</officialRating>
110
+ <sire xsi:type="n2:Breeding">
111
+ <name xsi:type="xsd:string">Captain Rio</name>
112
+ <bred xsi:type="xsd:string">UK</bred>
113
+ <yearBorn xsi:type="xsd:string">1999</yearBorn>
114
+ </sire>
115
+ <dam xsi:type="n2:Breeding">
116
+ <name xsi:type="xsd:string">Queen Sigi</name>
117
+ <bred xsi:type="xsd:string">IRE</bred>
118
+ <yearBorn xsi:type="xsd:string">1995</yearBorn>
119
+ </dam>
120
+ <damSire xsi:type="n2:Breeding">
121
+ <name xsi:type="xsd:string">Fairy King</name>
122
+ <bred xsi:type="xsd:string">USA</bred>
123
+ <yearBorn xsi:type="xsd:string">1982</yearBorn>
124
+ </damSire>
125
+ </n2:RacingSilk>
126
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
127
+ <selectionId xsi:type="xsd:int">3093005</selectionId>
128
+ <silksURL xsi:type="xsd:string">c20120508cat/00042636.jpg</silksURL>
129
+ <silksText xsi:type="xsd:string">Yellow, dark green seams, striped sleeves, yellow cap</silksText>
130
+ <trainerName xsi:type="xsd:string">Paul Green</trainerName>
131
+ <ageWeight xsi:type="xsd:string">6/9-2</ageWeight>
132
+ <form xsi:type="xsd:string">444U85</form>
133
+ <daysSince xsi:type="xsd:int">27</daysSince>
134
+ <jockeyClaim xsi:type="xsd:int">0</jockeyClaim>
135
+ <wearing xsi:type="xsd:string">visor</wearing>
136
+ <saddleCloth xsi:type="xsd:int">5</saddleCloth>
137
+ <stallDraw xsi:type="xsd:int">2</stallDraw>
138
+ <ownerName xsi:type="xsd:string">Mr Paul Green (Oaklea)</ownerName>
139
+ <jockeyName xsi:type="xsd:string">Silvestre De Sousa</jockeyName>
140
+ <colour xsi:type="xsd:string">b</colour>
141
+ <sex xsi:type="xsd:string">g</sex>
142
+ <bred xsi:type="xsd:string">IRE</bred>
143
+ <forecastPriceNumerator xsi:type="xsd:int">10</forecastPriceNumerator>
144
+ <forecastPriceDenominator xsi:type="xsd:int">1</forecastPriceDenominator>
145
+ <officialRating xsi:type="xsd:int">64</officialRating>
146
+ <sire xsi:type="n2:Breeding">
147
+ <name xsi:type="xsd:string">Danetime</name>
148
+ <bred xsi:type="xsd:string">IRE</bred>
149
+ <yearBorn xsi:type="xsd:string">1994</yearBorn>
150
+ </sire>
151
+ <dam xsi:type="n2:Breeding">
152
+ <name xsi:type="xsd:string">Katherine Gorge</name>
153
+ <bred xsi:type="xsd:string">USA</bred>
154
+ <yearBorn xsi:type="xsd:string">1994</yearBorn>
155
+ </dam>
156
+ <damSire xsi:type="n2:Breeding">
157
+ <name xsi:type="xsd:string">Hansel</name>
158
+ <bred xsi:type="xsd:string">USA</bred>
159
+ <yearBorn xsi:type="xsd:string">1988</yearBorn>
160
+ </damSire>
161
+ </n2:RacingSilk>
162
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
163
+ <selectionId xsi:type="xsd:int">4316124</selectionId>
164
+ <silksURL xsi:type="xsd:string">c20120508cat/00004284.jpg</silksURL>
165
+ <silksText xsi:type="xsd:string">White and dark green diamonds, white sleeves, dark green armlets, white cap</silksText>
166
+ <trainerName xsi:type="xsd:string">Paul Midgley</trainerName>
167
+ <ageWeight xsi:type="xsd:string">6/8-11</ageWeight>
168
+ <form xsi:type="xsd:string">215465</form>
169
+ <daysSince xsi:type="xsd:int">34</daysSince>
170
+ <jockeyClaim xsi:type="xsd:int">0</jockeyClaim>
171
+ <wearing xsi:nil="1"/>
172
+ <saddleCloth xsi:type="xsd:int">8</saddleCloth>
173
+ <stallDraw xsi:type="xsd:int">11</stallDraw>
174
+ <ownerName xsi:type="xsd:string">Mr John Allan Milburn</ownerName>
175
+ <jockeyName xsi:type="xsd:string">Micky Fenton</jockeyName>
176
+ <colour xsi:type="xsd:string">b</colour>
177
+ <sex xsi:type="xsd:string">g</sex>
178
+ <bred xsi:type="xsd:string">USA</bred>
179
+ <forecastPriceNumerator xsi:type="xsd:int">9</forecastPriceNumerator>
180
+ <forecastPriceDenominator xsi:type="xsd:int">1</forecastPriceDenominator>
181
+ <officialRating xsi:type="xsd:int">59</officialRating>
182
+ <sire xsi:type="n2:Breeding">
183
+ <name xsi:type="xsd:string">Grand Slam</name>
184
+ <bred xsi:type="xsd:string">USA</bred>
185
+ <yearBorn xsi:type="xsd:string">1995</yearBorn>
186
+ </sire>
187
+ <dam xsi:type="n2:Breeding">
188
+ <name xsi:type="xsd:string">Ruby's Reception</name>
189
+ <bred xsi:type="xsd:string">USA</bred>
190
+ <yearBorn xsi:type="xsd:string">2000</yearBorn>
191
+ </dam>
192
+ <damSire xsi:type="n2:Breeding">
193
+ <name xsi:type="xsd:string">Rubiano</name>
194
+ <bred xsi:type="xsd:string">USA</bred>
195
+ <yearBorn xsi:type="xsd:string">1987</yearBorn>
196
+ </damSire>
197
+ </n2:RacingSilk>
198
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
199
+ <selectionId xsi:type="xsd:int">4237300</selectionId>
200
+ <silksURL xsi:type="xsd:string">c20120508cat/00055527.jpg</silksURL>
201
+ <silksText xsi:type="xsd:string">White, brown seams, white sleeves and cap</silksText>
202
+ <trainerName xsi:type="xsd:string">Michael Easterby</trainerName>
203
+ <ageWeight xsi:type="xsd:string">5/9-0</ageWeight>
204
+ <form xsi:type="xsd:string">2110-01</form>
205
+ <daysSince xsi:type="xsd:int">13</daysSince>
206
+ <jockeyClaim xsi:type="xsd:int">0</jockeyClaim>
207
+ <wearing xsi:nil="1"/>
208
+ <saddleCloth xsi:type="xsd:int">7</saddleCloth>
209
+ <stallDraw xsi:type="xsd:int">6</stallDraw>
210
+ <ownerName xsi:type="xsd:string">Mr A. Saha</ownerName>
211
+ <jockeyName xsi:type="xsd:string">Paddy Aspell</jockeyName>
212
+ <colour xsi:type="xsd:string">b</colour>
213
+ <sex xsi:type="xsd:string">g</sex>
214
+ <bred xsi:type="xsd:string">GB</bred>
215
+ <forecastPriceNumerator xsi:type="xsd:int">6</forecastPriceNumerator>
216
+ <forecastPriceDenominator xsi:type="xsd:int">1</forecastPriceDenominator>
217
+ <officialRating xsi:type="xsd:int">62</officialRating>
218
+ <sire xsi:type="n2:Breeding">
219
+ <name xsi:type="xsd:string">Danroad</name>
220
+ <bred xsi:type="xsd:string">AUS</bred>
221
+ <yearBorn xsi:type="xsd:string">1999</yearBorn>
222
+ </sire>
223
+ <dam xsi:type="n2:Breeding">
224
+ <name xsi:type="xsd:string">Lawless Bridget</name>
225
+ <bred xsi:type="xsd:string">UK</bred>
226
+ <yearBorn xsi:type="xsd:string">1995</yearBorn>
227
+ </dam>
228
+ <damSire xsi:type="n2:Breeding">
229
+ <name xsi:type="xsd:string">Alnasr Alwasheek</name>
230
+ <bred xsi:type="xsd:string">UK</bred>
231
+ <yearBorn xsi:type="xsd:string">1989</yearBorn>
232
+ </damSire>
233
+ </n2:RacingSilk>
234
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
235
+ <selectionId xsi:type="xsd:int">4650680</selectionId>
236
+ <silksURL xsi:type="xsd:string">c20120508cat/00050445.jpg</silksURL>
237
+ <silksText xsi:type="xsd:string">Beige and black (quartered), halved sleeves</silksText>
238
+ <trainerName xsi:type="xsd:string">Paul Midgley</trainerName>
239
+ <ageWeight xsi:type="xsd:string">4/8-11</ageWeight>
240
+ <form xsi:type="xsd:string">0615-84</form>
241
+ <daysSince xsi:type="xsd:int">27</daysSince>
242
+ <jockeyClaim xsi:type="xsd:int">0</jockeyClaim>
243
+ <wearing xsi:type="xsd:string">visor</wearing>
244
+ <saddleCloth xsi:type="xsd:int">10</saddleCloth>
245
+ <stallDraw xsi:type="xsd:int">1</stallDraw>
246
+ <ownerName xsi:type="xsd:string">Mr K. L. Man</ownerName>
247
+ <jockeyName xsi:type="xsd:string">Michael O'Connell</jockeyName>
248
+ <colour xsi:type="xsd:string">br</colour>
249
+ <sex xsi:type="xsd:string">f</sex>
250
+ <bred xsi:type="xsd:string">GB</bred>
251
+ <forecastPriceNumerator xsi:type="xsd:int">20</forecastPriceNumerator>
252
+ <forecastPriceDenominator xsi:type="xsd:int">1</forecastPriceDenominator>
253
+ <officialRating xsi:type="xsd:int">59</officialRating>
254
+ <sire xsi:type="n2:Breeding">
255
+ <name xsi:type="xsd:string">Pastoral Pursuits</name>
256
+ <bred xsi:type="xsd:string">UK</bred>
257
+ <yearBorn xsi:type="xsd:string">2001</yearBorn>
258
+ </sire>
259
+ <dam xsi:type="n2:Breeding">
260
+ <name xsi:type="xsd:string">Eljariha</name>
261
+ <bred xsi:type="xsd:string">UK</bred>
262
+ <yearBorn xsi:type="xsd:string">1997</yearBorn>
263
+ </dam>
264
+ <damSire xsi:type="n2:Breeding">
265
+ <name xsi:type="xsd:string">Unfuwain</name>
266
+ <bred xsi:type="xsd:string">USA</bred>
267
+ <yearBorn xsi:type="xsd:string">1985</yearBorn>
268
+ </damSire>
269
+ </n2:RacingSilk>
270
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
271
+ <selectionId xsi:type="xsd:int">2091820</selectionId>
272
+ <silksURL xsi:type="xsd:string">c20120508cat/00006693.jpg</silksURL>
273
+ <silksText xsi:type="xsd:string">Light blue, dark green hoops, light blue sleeves</silksText>
274
+ <trainerName xsi:type="xsd:string">Chris Grant</trainerName>
275
+ <ageWeight xsi:type="xsd:string">9/9-1</ageWeight>
276
+ <form xsi:type="xsd:string">11393-0</form>
277
+ <daysSince xsi:type="xsd:int">27</daysSince>
278
+ <jockeyClaim xsi:type="xsd:int">0</jockeyClaim>
279
+ <wearing xsi:type="xsd:string">blinkers</wearing>
280
+ <saddleCloth xsi:type="xsd:int">6</saddleCloth>
281
+ <stallDraw xsi:type="xsd:int">10</stallDraw>
282
+ <ownerName xsi:type="xsd:string">Mr Nigel E. M. Jones</ownerName>
283
+ <jockeyName xsi:type="xsd:string">Tony Hamilton</jockeyName>
284
+ <colour xsi:type="xsd:string">b</colour>
285
+ <sex xsi:type="xsd:string">g</sex>
286
+ <bred xsi:type="xsd:string">IRE</bred>
287
+ <forecastPriceNumerator xsi:type="xsd:int">25</forecastPriceNumerator>
288
+ <forecastPriceDenominator xsi:type="xsd:int">1</forecastPriceDenominator>
289
+ <officialRating xsi:type="xsd:int">63</officialRating>
290
+ <sire xsi:type="n2:Breeding">
291
+ <name xsi:type="xsd:string">Pivotal</name>
292
+ <bred xsi:type="xsd:string">UK</bred>
293
+ <yearBorn xsi:type="xsd:string">1993</yearBorn>
294
+ </sire>
295
+ <dam xsi:type="n2:Breeding">
296
+ <name xsi:type="xsd:string">My-Lorraine</name>
297
+ <bred xsi:type="xsd:string">IRE</bred>
298
+ <yearBorn xsi:type="xsd:string">1994</yearBorn>
299
+ </dam>
300
+ <damSire xsi:type="n2:Breeding">
301
+ <name xsi:type="xsd:string">Mac's Imp</name>
302
+ <bred xsi:type="xsd:string">USA</bred>
303
+ <yearBorn xsi:type="xsd:string">1988</yearBorn>
304
+ </damSire>
305
+ </n2:RacingSilk>
306
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
307
+ <selectionId xsi:type="xsd:int">1500142</selectionId>
308
+ <silksURL xsi:type="xsd:string">c20120508cat/00041945.jpg</silksURL>
309
+ <silksText xsi:type="xsd:string">Black, orange epaulets, diamonds on sleeves</silksText>
310
+ <trainerName xsi:type="xsd:string">Paul Midgley</trainerName>
311
+ <ageWeight xsi:type="xsd:string">8/9-6</ageWeight>
312
+ <form xsi:type="xsd:string">90850-9</form>
313
+ <daysSince xsi:type="xsd:int">29</daysSince>
314
+ <jockeyClaim xsi:type="xsd:int">7</jockeyClaim>
315
+ <wearing xsi:type="xsd:string">visor</wearing>
316
+ <saddleCloth xsi:type="xsd:int">2</saddleCloth>
317
+ <stallDraw xsi:type="xsd:int">8</stallDraw>
318
+ <ownerName xsi:type="xsd:string">Mr Anthony D. Copley</ownerName>
319
+ <jockeyName xsi:type="xsd:string">Ned Curtis</jockeyName>
320
+ <colour xsi:type="xsd:string">ch</colour>
321
+ <sex xsi:type="xsd:string">f</sex>
322
+ <bred xsi:type="xsd:string">GB</bred>
323
+ <forecastPriceNumerator xsi:type="xsd:int">16</forecastPriceNumerator>
324
+ <forecastPriceDenominator xsi:type="xsd:int">1</forecastPriceDenominator>
325
+ <officialRating xsi:type="xsd:int">68</officialRating>
326
+ <sire xsi:type="n2:Breeding">
327
+ <name xsi:type="xsd:string">Ishiguru</name>
328
+ <bred xsi:type="xsd:string">USA</bred>
329
+ <yearBorn xsi:type="xsd:string">1998</yearBorn>
330
+ </sire>
331
+ <dam xsi:type="n2:Breeding">
332
+ <name xsi:type="xsd:string">Statuette</name>
333
+ <bred xsi:type="xsd:string">UK</bred>
334
+ <yearBorn xsi:type="xsd:string">1994</yearBorn>
335
+ </dam>
336
+ <damSire xsi:type="n2:Breeding">
337
+ <name xsi:type="xsd:string">Statoblest</name>
338
+ <bred xsi:type="xsd:string">UK</bred>
339
+ <yearBorn xsi:type="xsd:string">1986</yearBorn>
340
+ </damSire>
341
+ </n2:RacingSilk>
342
+ <n2:RacingSilk xsi:type="n2:RacingSilkV2">
343
+ <selectionId xsi:type="xsd:int">5521912</selectionId>
344
+ <silksURL xsi:type="xsd:string">c20120508cat/00024544.jpg</silksURL>
345
+ <silksText xsi:type="xsd:string">Maroon, grey cross of lorraine</silksText>
346
+ <trainerName xsi:type="xsd:string">Christopher Wilson</trainerName>
347
+ <ageWeight xsi:type="xsd:string">4/8-7</ageWeight>
348
+ <form xsi:type="xsd:string">082100-</form>
349
+ <daysSince xsi:type="xsd:int">196</daysSince>
350
+ <jockeyClaim xsi:type="xsd:int">0</jockeyClaim>
351
+ <wearing xsi:nil="1"/>
352
+ <saddleCloth xsi:type="xsd:int">11</saddleCloth>
353
+ <stallDraw xsi:type="xsd:int">7</stallDraw>
354
+ <ownerName xsi:type="xsd:string">Mr David Bartlett</ownerName>
355
+ <jockeyName xsi:type="xsd:string">Tom Eaves</jockeyName>
356
+ <colour xsi:type="xsd:string">ch</colour>
357
+ <sex xsi:type="xsd:string">f</sex>
358
+ <bred xsi:type="xsd:string">GB</bred>
359
+ <forecastPriceNumerator xsi:type="xsd:int">18</forecastPriceNumerator>
360
+ <forecastPriceDenominator xsi:type="xsd:int">1</forecastPriceDenominator>
361
+ <officialRating xsi:type="xsd:int">55</officialRating>
362
+ <sire xsi:type="n2:Breeding">
363
+ <name xsi:type="xsd:string">Blue Dakota</name>
364
+ <bred xsi:type="xsd:string">IRE</bred>
365
+ <yearBorn xsi:type="xsd:string">2002</yearBorn>
366
+ </sire>
367
+ <dam xsi:type="n2:Breeding">
368
+ <name xsi:type="xsd:string">Kungfu Kerry</name>
369
+ <bred xsi:type="xsd:string">UK</bred>
370
+ <yearBorn xsi:type="xsd:string">1999</yearBorn>
371
+ </dam>
372
+ <damSire xsi:type="n2:Breeding">
373
+ <name xsi:type="xsd:string">Celtic Swing</name>
374
+ <bred xsi:type="xsd:string">UK</bred>
375
+ <yearBorn xsi:type="xsd:string">1992</yearBorn>
376
+ </damSire>
377
+ </n2:RacingSilk>
378
+ </racingSilks>
379
+ <errorCode xsi:type="n2:MarketDisplayErrorEnum">OK</errorCode>
380
+ </n2:MarketDisplayDetail>
381
+ </marketDisplayDetails>
382
+ </n:Result>
383
+ </n:getSilksV2Response>
384
+ </soap:Body>
385
+ </soap:Envelope>
@@ -27,7 +27,13 @@ describe Betfair::ResponseParser do
27
27
  it "should parse get_market response" do
28
28
  get_market_xml = load_xml_response("get_market.xml")
29
29
  parsed = @parser.get_market get_market_xml
30
- parsed.should == {"id"=>"104968439", "parent_id"=>"26813086", "country_code"=>"GBR", "event_type"=>"7", "base_rate"=>"5.0", "market_name"=>"2m Hcap Chs", "num_winners"=>"1", "runners"=>[{"selection_id"=>"3043342", "name"=>"Arctic Ben"}, {"selection_id"=>"4493849", "name"=>"Educated Evans"}, {"selection_id"=>"2795387", "name"=>"Buffalo Bob"}, {"selection_id"=>"3687553", "name"=>"Rileyev"}, {"selection_id"=>"2610448", "name"=>"Oh Crick"}, {"selection_id"=>"2406110", "name"=>"Oscar Gogo"}, {"selection_id"=>"2446696", "name"=>"Dinarius"}, {"selection_id"=>"1381307", "name"=>"Moon Over Miami"}, {"selection_id"=>"2810086", "name"=>"Super Formen"}]}
30
+ parsed.should == {"id"=>"104968439", "status"=>"ACTIVE", "parent_id"=>"26813086", "country_code"=>"GBR", "event_type"=>"7", "base_rate"=>"5.0", "market_name"=>"2m Hcap Chs", "num_winners"=>"1", "market_time"=>"2012-02-25T15:45:00.000Z", "runners"=>[{"selection_id"=>"3043342", "name"=>"Arctic Ben"}, {"selection_id"=>"4493849", "name"=>"Educated Evans"}, {"selection_id"=>"2795387", "name"=>"Buffalo Bob"}, {"selection_id"=>"3687553", "name"=>"Rileyev"}, {"selection_id"=>"2610448", "name"=>"Oh Crick"}, {"selection_id"=>"2406110", "name"=>"Oscar Gogo"}, {"selection_id"=>"2446696", "name"=>"Dinarius"}, {"selection_id"=>"1381307", "name"=>"Moon Over Miami"}, {"selection_id"=>"2810086", "name"=>"Super Formen"}]}
31
+ end
32
+
33
+ it "should parse get_silks_v2 response" do
34
+ get_silks_v2_xml = load_xml_response("get_silks_v2.xml")
35
+ parsed = @parser.get_silks_v2 get_silks_v2_xml
36
+ parsed.should == {"105668397"=>{"runners"=>{"5446714"=>{"silks_url"=>"c20120508cat/00074030.jpg", "silks_text"=>"White, dark blue triple diamond, dark blue and white diabolo on sleeves, white cap, dark blue diamond", "trainer_name"=>"Richard Whitaker", "age_weight"=>"4/9-6", "form"=>"1343-", "days_since"=>"237", "jockey_claim"=>"3", "wearing"=>"", "saddle_cloth"=>"3", "stall_draw"=>"3", "owner_name"=>"Mrs Jane Newett", "jockey_name"=>"Amy Ryan", "colour"=>"ch", "sex"=>"f", "bred"=>"GB", "forecast_price"=>"13/2", "official_rating"=>"68", "sire"=>{"name"=>"Namid", "bred"=>"UK", "year_born"=>"1996"}, "dam"=>{"name"=>"Petra Nova", "bred"=>"UK", "year_born"=>"1996"}, "dam_sire"=>{"name"=>"First Trump", "bred"=>"UK", "year_born"=>"1991"}}, "4691268"=>{"silks_url"=>"c20120508cat/00075682.jpg", "silks_text"=>"Black, pink seams, striped sleeves, pink cap", "trainer_name"=>"Ruth Carr", "age_weight"=>"4/9-5", "form"=>"468900-", "days_since"=>"165", "jockey_claim"=>"0", "wearing"=>"", "saddle_cloth"=>"4", "stall_draw"=>"9", "owner_name"=>"Paul Saxton & The Bottom Liners", "jockey_name"=>"James Sullivan", "colour"=>"b", "sex"=>"g", "bred"=>"IRE", "forecast_price"=>"12/1", "official_rating"=>"67", "sire"=>{"name"=>"Kheleyf", "bred"=>"USA", "year_born"=>"2001"}, "dam"=>{"name"=>"Diplomats Daughter", "bred"=>"UK", "year_born"=>"2001"}, "dam_sire"=>{"name"=>"Unfuwain", "bred"=>"USA", "year_born"=>"1985"}}, "2503257"=>{"silks_url"=>"c20120508cat/00077008.jpg", "silks_text"=>"Pink, emerald green triple diamond, diamonds on sleeves, emerald green cap", "trainer_name"=>"Daniel Loughnane", "age_weight"=>"7/9-7", "form"=>"372111", "days_since"=>"42", "jockey_claim"=>"0", "wearing"=>"tongue strap", "saddle_cloth"=>"1", "stall_draw"=>"5", "owner_name"=>"Mrs C. Loughnane", "jockey_name"=>"Shane Kelly", "colour"=>"b", "sex"=>"g", "bred"=>"IRE", "forecast_price"=>"7/2", "official_rating"=>"69", "sire"=>{"name"=>"Captain Rio", "bred"=>"UK", "year_born"=>"1999"}, "dam"=>{"name"=>"Queen Sigi", "bred"=>"IRE", "year_born"=>"1995"}, "dam_sire"=>{"name"=>"Fairy King", "bred"=>"USA", "year_born"=>"1982"}}, "3093005"=>{"silks_url"=>"c20120508cat/00042636.jpg", "silks_text"=>"Yellow, dark green seams, striped sleeves, yellow cap", "trainer_name"=>"Paul Green", "age_weight"=>"6/9-2", "form"=>"444U85", "days_since"=>"27", "jockey_claim"=>"0", "wearing"=>"visor", "saddle_cloth"=>"5", "stall_draw"=>"2", "owner_name"=>"Mr Paul Green (Oaklea)", "jockey_name"=>"Silvestre De Sousa", "colour"=>"b", "sex"=>"g", "bred"=>"IRE", "forecast_price"=>"10/1", "official_rating"=>"64", "sire"=>{"name"=>"Danetime", "bred"=>"IRE", "year_born"=>"1994"}, "dam"=>{"name"=>"Katherine Gorge", "bred"=>"USA", "year_born"=>"1994"}, "dam_sire"=>{"name"=>"Hansel", "bred"=>"USA", "year_born"=>"1988"}}, "4316124"=>{"silks_url"=>"c20120508cat/00004284.jpg", "silks_text"=>"White and dark green diamonds, white sleeves, dark green armlets, white cap", "trainer_name"=>"Paul Midgley", "age_weight"=>"6/8-11", "form"=>"215465", "days_since"=>"34", "jockey_claim"=>"0", "wearing"=>"", "saddle_cloth"=>"8", "stall_draw"=>"11", "owner_name"=>"Mr John Allan Milburn", "jockey_name"=>"Micky Fenton", "colour"=>"b", "sex"=>"g", "bred"=>"USA", "forecast_price"=>"9/1", "official_rating"=>"59", "sire"=>{"name"=>"Grand Slam", "bred"=>"USA", "year_born"=>"1995"}, "dam"=>{"name"=>"Ruby's Reception", "bred"=>"USA", "year_born"=>"2000"}, "dam_sire"=>{"name"=>"Rubiano", "bred"=>"USA", "year_born"=>"1987"}}, "4237300"=>{"silks_url"=>"c20120508cat/00055527.jpg", "silks_text"=>"White, brown seams, white sleeves and cap", "trainer_name"=>"Michael Easterby", "age_weight"=>"5/9-0", "form"=>"2110-01", "days_since"=>"13", "jockey_claim"=>"0", "wearing"=>"", "saddle_cloth"=>"7", "stall_draw"=>"6", "owner_name"=>"Mr A. Saha", "jockey_name"=>"Paddy Aspell", "colour"=>"b", "sex"=>"g", "bred"=>"GB", "forecast_price"=>"6/1", "official_rating"=>"62", "sire"=>{"name"=>"Danroad", "bred"=>"AUS", "year_born"=>"1999"}, "dam"=>{"name"=>"Lawless Bridget", "bred"=>"UK", "year_born"=>"1995"}, "dam_sire"=>{"name"=>"Alnasr Alwasheek", "bred"=>"UK", "year_born"=>"1989"}}, "4650680"=>{"silks_url"=>"c20120508cat/00050445.jpg", "silks_text"=>"Beige and black (quartered), halved sleeves", "trainer_name"=>"Paul Midgley", "age_weight"=>"4/8-11", "form"=>"0615-84", "days_since"=>"27", "jockey_claim"=>"0", "wearing"=>"visor", "saddle_cloth"=>"10", "stall_draw"=>"1", "owner_name"=>"Mr K. L. Man", "jockey_name"=>"Michael O'Connell", "colour"=>"br", "sex"=>"f", "bred"=>"GB", "forecast_price"=>"20/1", "official_rating"=>"59", "sire"=>{"name"=>"Pastoral Pursuits", "bred"=>"UK", "year_born"=>"2001"}, "dam"=>{"name"=>"Eljariha", "bred"=>"UK", "year_born"=>"1997"}, "dam_sire"=>{"name"=>"Unfuwain", "bred"=>"USA", "year_born"=>"1985"}}, "2091820"=>{"silks_url"=>"c20120508cat/00006693.jpg", "silks_text"=>"Light blue, dark green hoops, light blue sleeves", "trainer_name"=>"Chris Grant", "age_weight"=>"9/9-1", "form"=>"11393-0", "days_since"=>"27", "jockey_claim"=>"0", "wearing"=>"blinkers", "saddle_cloth"=>"6", "stall_draw"=>"10", "owner_name"=>"Mr Nigel E. M. Jones", "jockey_name"=>"Tony Hamilton", "colour"=>"b", "sex"=>"g", "bred"=>"IRE", "forecast_price"=>"25/1", "official_rating"=>"63", "sire"=>{"name"=>"Pivotal", "bred"=>"UK", "year_born"=>"1993"}, "dam"=>{"name"=>"My-Lorraine", "bred"=>"IRE", "year_born"=>"1994"}, "dam_sire"=>{"name"=>"Mac's Imp", "bred"=>"USA", "year_born"=>"1988"}}, "1500142"=>{"silks_url"=>"c20120508cat/00041945.jpg", "silks_text"=>"Black, orange epaulets, diamonds on sleeves", "trainer_name"=>"Paul Midgley", "age_weight"=>"8/9-6", "form"=>"90850-9", "days_since"=>"29", "jockey_claim"=>"7", "wearing"=>"visor", "saddle_cloth"=>"2", "stall_draw"=>"8", "owner_name"=>"Mr Anthony D. Copley", "jockey_name"=>"Ned Curtis", "colour"=>"ch", "sex"=>"f", "bred"=>"GB", "forecast_price"=>"16/1", "official_rating"=>"68", "sire"=>{"name"=>"Ishiguru", "bred"=>"USA", "year_born"=>"1998"}, "dam"=>{"name"=>"Statuette", "bred"=>"UK", "year_born"=>"1994"}, "dam_sire"=>{"name"=>"Statoblest", "bred"=>"UK", "year_born"=>"1986"}}, "5521912"=>{"silks_url"=>"c20120508cat/00024544.jpg", "silks_text"=>"Maroon, grey cross of lorraine", "trainer_name"=>"Christopher Wilson", "age_weight"=>"4/8-7", "form"=>"082100-", "days_since"=>"196", "jockey_claim"=>"0", "wearing"=>"", "saddle_cloth"=>"11", "stall_draw"=>"7", "owner_name"=>"Mr David Bartlett", "jockey_name"=>"Tom Eaves", "colour"=>"ch", "sex"=>"f", "bred"=>"GB", "forecast_price"=>"18/1", "official_rating"=>"55", "sire"=>{"name"=>"Blue Dakota", "bred"=>"IRE", "year_born"=>"2002"}, "dam"=>{"name"=>"Kungfu Kerry", "bred"=>"UK", "year_born"=>"1999"}, "dam_sire"=>{"name"=>"Celtic Swing", "bred"=>"UK", "year_born"=>"1992"}}}}}
31
37
  end
32
38
 
33
39
  it "should parse get_market_prices_compressed response" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-betfair
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-26 00:00:00.000000000Z
12
+ date: 2012-05-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70315616479680 !ruby/object:Gem::Requirement
16
+ requirement: &70106249211740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70315616479680
24
+ version_requirements: *70106249211740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: eventmachine
27
- requirement: &70315616479200 !ruby/object:Gem::Requirement
27
+ requirement: &70106249211100 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70315616479200
35
+ version_requirements: *70106249211100
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: em-http-request
38
- requirement: &70315616478760 !ruby/object:Gem::Requirement
38
+ requirement: &70106249210680 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70315616478760
46
+ version_requirements: *70106249210680
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: haml
49
- requirement: &70315616478340 !ruby/object:Gem::Requirement
49
+ requirement: &70106249210260 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70315616478340
57
+ version_requirements: *70106249210260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: nokogiri
60
- requirement: &70315616477840 !ruby/object:Gem::Requirement
60
+ requirement: &70106249209820 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70315616477840
68
+ version_requirements: *70106249209820
69
69
  description: em-betfair is a work in progress evented client for the Betfair API
70
70
  email:
71
71
  - george@fuzzmonkey.co.uk
@@ -78,7 +78,6 @@ files:
78
78
  - README.md
79
79
  - Rakefile
80
80
  - em-betfair.gemspec
81
- - examples/scrape_betfair.rb
82
81
  - lib/em-betfair.rb
83
82
  - lib/em-betfair/betfair_client.rb
84
83
  - lib/em-betfair/response.rb
@@ -88,10 +87,12 @@ files:
88
87
  - lib/em-betfair/views/exchange/get_market.haml
89
88
  - lib/em-betfair/views/exchange/get_market_prices_compressed.haml
90
89
  - lib/em-betfair/views/exchange/get_market_traded_volume_compressed.haml
90
+ - lib/em-betfair/views/exchange/get_silks_v2.haml
91
91
  - lib/em-betfair/views/global/get_all_event_types.haml
92
92
  - lib/em-betfair/views/global/login.haml
93
93
  - lib/em-betfair/views/global/retrieve_limb_message.haml
94
94
  - lib/em-betfair/views/global/submit_limb_message.haml
95
+ - snippits/scrape_betfair.rb
95
96
  - spec/functional/betfair_client_spec.rb
96
97
  - spec/remote/betfair_client_spec.rb
97
98
  - spec/spec_helper.rb
@@ -100,6 +101,7 @@ files:
100
101
  - spec/support/canned_responses/get_market.xml
101
102
  - spec/support/canned_responses/get_market_prices_compressed.xml
102
103
  - spec/support/canned_responses/get_market_traded_volume_compressed.xml
104
+ - spec/support/canned_responses/get_silks_v2.xml
103
105
  - spec/support/canned_responses/login_failed.xml
104
106
  - spec/support/canned_responses/login_ok.xml
105
107
  - spec/support/canned_responses/soap_fault.xml
@@ -137,7 +139,9 @@ test_files:
137
139
  - spec/support/canned_responses/get_market.xml
138
140
  - spec/support/canned_responses/get_market_prices_compressed.xml
139
141
  - spec/support/canned_responses/get_market_traded_volume_compressed.xml
142
+ - spec/support/canned_responses/get_silks_v2.xml
140
143
  - spec/support/canned_responses/login_failed.xml
141
144
  - spec/support/canned_responses/login_ok.xml
142
145
  - spec/support/canned_responses/soap_fault.xml
143
146
  - spec/unit/response_parser_spec.rb
147
+ has_rdoc: