Created
December 22, 2010 16:43
-
-
Save rubiii/751742 to your computer and use it in GitHub Desktop.
using savon to talk to the betfair soap api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<soapenv:Envelope | |
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" | |
xmlns:bfex="http://www.betfair.com/publicapi/v5/BFExchangeService/" | |
xmlns:v5="http://www.betfair.com/publicapi/types/exchange/v5/"> | |
<soapenv:Header/> | |
<soapenv:Body> | |
<bfex:getAllMarkets> | |
<bfex:request> | |
<header> | |
<clientStamp>stamp</clientStamp> | |
<sessionToken>token</sessionToken> | |
</header> | |
<locale>UK</locale> | |
<eventTypeIds> | |
<!--Zero or more repetitions:--> | |
<v5:int>1</v5:int> | |
</eventTypeIds> | |
<countries> | |
<!--Zero or more repetitions:--> | |
<v5:Country>UK</v5:Country> | |
</countries> | |
<fromDate>2010-01-10:10:10:00Z</fromDate> | |
<toDate>2010-11-10:10:10:00Z</toDate> | |
</bfex:request> | |
</bfex:getAllMarkets> | |
</soapenv:Body> | |
</soapenv:Envelope> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# solution for https://github.com/rubiii/savon/issues/68 | |
client = Savon::Client.new do | |
wsdl.endpoint = "https://api.betfair.com/exchange/v5/BFExchangeService" | |
wsdl.namespace = "http://www.betfair.com/publicapi/v5/BFExchangeService/" | |
end | |
client.request :bfex, :get_all_markets do | |
soap.namespaces["xmlns:v5"] = "http://www.betfair.com/publicapi/types/exchange/v5/" | |
soap.body = { | |
"bfex:request" => { | |
:header => { :client_stamp => "stamp", :session_token => "token" }, | |
:locale => "UK", | |
:event_type_ids => { "v5:int" => [1, 2] }, | |
:countries => { "v5:Country" => ["DE", "UK"] }, | |
:from_date => 1.year.ago, | |
:to_date => Time.now | |
} | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment