Commit 4a899a3c authored by Sergey Gernyak's avatar Sergey Gernyak

Passing account name to account API methods

parent 1eea9664
...@@ -5,16 +5,16 @@ module BetfairApiNgRails ...@@ -5,16 +5,16 @@ module BetfairApiNgRails
# #
# Returns the details relating your account, including your discount rate and Betfair point balance. # Returns the details relating your account, including your discount rate and Betfair point balance.
# #
def get_account_details def get_account_details(account: '')
run_request __method__, {} run_request __method__, {}, account
end end
# #
# Get available to bet amount. The getAccounts service will return the UK wallet balance by default # Get available to bet amount. The getAccounts service will return the UK wallet balance by default
# from either the UK or AUS Accounts API endpoint if the wallet parameter is not specified. # from either the UK or AUS Accounts API endpoint if the wallet parameter is not specified.
# #
def get_account_funds def get_account_funds(account: '')
run_request __method__, {} run_request __method__, {}, account
end end
end end
end end
......
...@@ -21,7 +21,7 @@ module BetfairApiNgRails ...@@ -21,7 +21,7 @@ module BetfairApiNgRails
end end
def place_orders(market_id: "", instructions: [], customer_ref: "", account_name: '') def place_orders(market_id: "", instructions: [], customer_ref: "", account_name: '')
run_request __method__, { market_id: market_id, instructions: instructions, customer_ref: customer_ref } run_request __method__, { market_id: market_id, instructions: instructions, customer_ref: customer_ref }, account_name
end end
end end
end end
......
...@@ -29,11 +29,25 @@ describe BetfairApiNgRails::Api::RequestMethods do ...@@ -29,11 +29,25 @@ describe BetfairApiNgRails::Api::RequestMethods do
describe "#place_orders" do describe "#place_orders" do
it "calls run_request with proper params" do it "calls run_request with proper params" do
expect(TestModule).to receive(:run_request).with(:place_orders, {market_id: "", instructions: [], customer_ref: ""}) expect(TestModule).to receive(:run_request).with(:place_orders, {market_id: "", instructions: [], customer_ref: ""}, "")
TestModule.place_orders TestModule.place_orders
end end
end end
describe '#get_account_details' do
it 'calls run request with proper params' do
expect(TestModule).to receive(:run_request).with(:get_account_details, {}, "")
TestModule.get_account_details
end
end
describe '#get_account_funds' do
it 'calls run request with proper params' do
expect(TestModule).to receive(:run_request).with(:get_account_funds, {}, "")
TestModule.get_account_funds
end
end
describe "private method" do describe "private method" do
describe "#build_request_type" do describe "#build_request_type" do
it "returns proper api method name" do it "returns proper api method name" do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment