xing_api icon indicating copy to clipboard operation
xing_api copied to clipboard

Readme might be missunderstood for single threaded usage

Open freetwix opened this issue 11 years ago • 1 comments

Reading the following:

# Or if your code is executed single threaded ...
oauth_token, oauth_token_secret = # load from your db

XingApi::Client.configure do |_|
  _.oauth_token = oauth_token
  _.oauth_token_secret = oauth_token_secret
end

# no client instance needed, because oauth token is set globally
XingApi::User.me

... one might use the configure block in a request based filter (controller.before) to initialize a new request with a correct xing default client.

BUT: having a user without oauth_token and oauth_token_secret will lead to the following behaviour:

# REQUEST "Peter"
XingApi::Client.default_options 
# => { :oauth_token=>"peter_token", :oauth_token_secret=>"peter_secret" }

# REQUEST "Mary"
# controller.before
XingApi::Client.configure do |_|
  _.oauth_token = nil
  _.oauth_token_secret = nil
end

XingApi::Client.default_options 
# => { :oauth_token=>"peter_token", :oauth_token_secret=>"peter_secret" }

just sayin, greets jochen

freetwix avatar Jun 05 '14 13:06 freetwix

Hi Jochen,

thx for the hint. I guess it's unlikely that you use both configuration approaches together, but I fully agree, that's pretty unexpected behavior.

I'm going to fix that.

Cheers, Mark

markschmidt avatar Jun 11 '14 12:06 markschmidt