Commit daf33300 authored by Sergey Gernyak's avatar Sergey Gernyak

REF: provider requester is use account subsystem

parent 249c8c83
...@@ -5,10 +5,10 @@ module BetfairApiNgRails ...@@ -5,10 +5,10 @@ module BetfairApiNgRails
class << self class << self
include Api::Constants include Api::Constants
def provider_requester(api_url, ssoid = nil) def provider_requester(api_url, ssoid = nil, app_key)
create_http_requester(api_url).tap do |req| create_http_requester(api_url).tap do |req|
req.set_request_headers API_REQUEST_HEADERS req.set_request_headers API_REQUEST_HEADERS
req.set_auth_headers Api::Config.application_key, ssoid req.set_auth_headers app_key, ssoid
end end
end end
......
...@@ -28,7 +28,7 @@ module BetfairApiNgRails ...@@ -28,7 +28,7 @@ module BetfairApiNgRails
end end
def http_requester(api_url) def http_requester(api_url)
Api::Http::Factory.provider_requester api_url, ssoid Api::Http::Factory.provider_requester api_url, ssoid, application_key
end end
end end
end end
......
...@@ -45,7 +45,7 @@ describe BetfairApiNgRails::Api::Provider do ...@@ -45,7 +45,7 @@ describe BetfairApiNgRails::Api::Provider do
describe "#http_requester" do describe "#http_requester" do
it "initalizes provider http request" do it "initalizes provider http request" do
expect(BetfairApiNgRails::Api::Http::Factory).to receive(:provider_requester).with 'api_url', ssoid expect(BetfairApiNgRails::Api::Http::Factory).to receive(:provider_requester).with 'api_url', ssoid, application_key
subject.send :http_requester, 'api_url' subject.send :http_requester, 'api_url'
end end
end end
......
...@@ -14,13 +14,12 @@ describe BetfairApiNgRails::Api::Http::Factory do ...@@ -14,13 +14,12 @@ describe BetfairApiNgRails::Api::Http::Factory do
subject(:factory) { described_class } subject(:factory) { described_class }
describe '.session_requester' do before do
before do expect(factory).to receive(:create_http_requester)
expect(factory).to receive(:create_http_requester) .and_return(requester)
.with(BetfairApiNgRails::Api::Constants::LOGIN_URL, false) end
.and_return(requester)
end
describe '.session_requester' do
it 'settings up requester for session' do it 'settings up requester for session' do
expect(requester).to receive(:set_ssl_files).with 'crt_filepath', 'key_filepath' expect(requester).to receive(:set_ssl_files).with 'crt_filepath', 'key_filepath'
expect(requester).to receive(:set_request_headers) expect(requester).to receive(:set_request_headers)
...@@ -30,4 +29,12 @@ describe BetfairApiNgRails::Api::Http::Factory do ...@@ -30,4 +29,12 @@ describe BetfairApiNgRails::Api::Http::Factory do
factory.session_requester account factory.session_requester account
end end
end end
describe '.provider_requester' do
it 'settings up requester for provider' do
expect(requester).to receive(:set_request_headers)
expect(requester).to receive(:set_auth_headers).with('app_key', 'some_ssoid')
factory.provider_requester 'api_url', 'some_ssoid', 'app_key'
end
end
end end
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