Commit 202b4753 authored by sergio1990's avatar sergio1990

Fix ssoid refreshing logic

parent 61589048
......@@ -14,9 +14,8 @@ module BetfairApiNgRails
include Api::ConnectionExt::Parsing
include Api::ConnectionExt::Formatting
def expire_ssoid
def expire_provider
@_provider = nil
BetfairApiNgRails::Api::SessionManager.expire_ssoid
end
protected
......@@ -26,7 +25,7 @@ module BetfairApiNgRails
end
def request_ssoid
@_ssoid ||= BetfairApiNgRails::Api::SessionManager.new_ssoid
BetfairApiNgRails::Api::SessionManager.new_ssoid
end
def hashing(params)
......
......@@ -27,11 +27,11 @@ module BetfairApiNgRails
private
def is_ssoid_problem?(e)
e.info[:info]["code"] == -32099
e.info[:info]["code"].to_i == -32099
end
def try_request(method, params)
expire_ssoid
expire_provider
request_without_ssoid_refreshing(method, params)
end
......
......@@ -27,11 +27,10 @@ describe BetfairApiNgRails::Api::Connection do
end
describe "#expire_ssoid" do
describe "#expire_provider" do
it "resets provider and ssoid" do
expect(BetfairApiNgRails::Api::SessionManager).to receive(:expire_ssoid)
connection.expire_ssoid
connection.expire_provider
expect(connection.instance_variable_get(:@_provider)).to be_nil
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