Commit 574c4cc2 authored by Sergey Gernyak's avatar Sergey Gernyak

Passing account name to connection initializer

parent 5f88328e
......@@ -3,6 +3,12 @@ require "betfair_api_ng_rails/errors"
module BetfairApiNgRails
module Api
class Connection
attr_reader :account_name
def initialize(account_name)
@account_name = account_name
end
def request(method, params = {})
provider.fetch method: Api::RequestMethod.new(method), params: hashing(params)
end
......
......@@ -14,7 +14,7 @@ module BetfairApiNgRails
private
def run_request(method, params, account_name = '')
BetfairApiNgRails::Api::Connection.new.request build_request_type(method), params#, account_name
BetfairApiNgRails::Api::Connection.new(account_name).request build_request_type(method), params#, account_name
end
def build_request_type(name)
......
require 'spec_helper'
describe BetfairApiNgRails::Api::Connection do
subject(:connection) { described_class.new }
let(:acc_name) { 'user001' }
subject(:connection) { described_class.new(acc_name) }
describe "#request" do
let(:provider) { double(:provider) }
......
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