Methods
Public Class
Public Instance
Protected Instance
Attributes
| oauth_session | [R] |
Public Class methods
new(*)
[show source]
# File lib/httpx/plugins/oauth.rb 242 def initialize(*) 243 super 244 245 @oauth_session = if @options.oauth_options 246 OAuthSession.new(**@options.oauth_options) 247 elsif @options.oauth_session 248 @oauth_session = @options.oauth_session.dup 249 end 250 end
Public Instance methods
initialize_dup(other)
[show source]
# File lib/httpx/plugins/oauth.rb 252 def initialize_dup(other) 253 super 254 @oauth_session = other.instance_variable_get(:@oauth_session).dup 255 end
oauth_auth(**args)
[show source]
# File lib/httpx/plugins/oauth.rb 257 def oauth_auth(**args) 258 warn "DEPRECATION WARNING: `#{__method__}` is deprecated. " \ 259 "Use `with(oauth_options: options)` instead." 260 261 with(oauth_options: args) 262 end
refresh_oauth_tokens!()
will eagerly negotiate new oauth tokens with the issuer
[show source]
# File lib/httpx/plugins/oauth.rb 265 def refresh_oauth_tokens! 266 return unless @oauth_session 267 268 @oauth_session.reset! 269 @oauth_session.fetch_access_token(self) 270 if (expires_at = @oauth_session.expires_at) 271 @auth_header_value_mtx.synchronize do 272 @auth_header_expires_at = expires_at 273 end 274 end 275 end
reset_auth_header_value!()
[show source]
# File lib/httpx/plugins/oauth.rb 291 def reset_auth_header_value! 292 super.tap do 293 @oauth_session.reset if @oauth_session 294 end 295 end
with_access_token()
TODO: deprecate
[show source]
# File lib/httpx/plugins/oauth.rb 278 def with_access_token 279 warn "DEPRECATION WARNING: `#{__method__}` is deprecated. " \ 280 "The session will automatically handle token lifecycles for you." 281 282 other_session = dup # : instance 283 oauth_session = other_session.oauth_session 284 oauth_session.fetch_access_token(other_session) 285 if (expires_at = oauth_session.expires_at) 286 @auth_header_expires_at = expires_at 287 end 288 other_session 289 end