refresh! breaks when passing a block to initialize the connection
Created by: Linuus
When I pass a block to initialize the Faraday object it breaks the refresh!
method, even if I only set the default adapter.
def access_token
OAuth2::AccessToken.new(client, @token, @opts)
end
def client
OAuth2::Client.new(
ENV["SOME_APP_ID"],
ENV["SOME_APP_SECRET"],
site: ENV["SOME_APP_URL"],
authorize_url: "login/oauth/authorize",
token_url: "login/oauth/token"
)
end
access_token.refresh!
# => Works!
def access_token
OAuth2::AccessToken.new(client, @token, @opts)
end
def client
OAuth2::Client.new(
ENV["SOME_APP_ID"],
ENV["SOME_APP_SECRET"],
site: ENV["SOME_APP_URL"],
authorize_url: "login/oauth/authorize",
token_url: "login/oauth/token"
) do |faraday|
faraday.adapter Faraday.default_adapter
end
end
acces_token.refresh!
# => undefined method bytesize for Hash
Any idea what's going on here?