Class: EY::GateKeeper::Client::ServerResponse
- Inherits:
-
Rack::Response
- Object
- Rack::Response
- EY::GateKeeper::Client::ServerResponse
- Defined in:
- lib/ey_gatekeeper/client/server_response.rb
Instance Method Summary collapse
- #indicates_any_auth_error?(*messages) ⇒ Boolean
-
#initialize(response) ⇒ ServerResponse
constructor
A new instance of ServerResponse.
- #is_gatekeeper_unauthorized? ⇒ Boolean
- #needs_gatekeeper_token_refresh? ⇒ Boolean
- #to_rack ⇒ Object
- #unauthorized? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ ServerResponse
Returns a new instance of ServerResponse.
6 7 8 9 |
# File 'lib/ey_gatekeeper/client/server_response.rb', line 6 def initialize(response) status, headers, body = response super(body, status, headers) end |
Instance Method Details
#indicates_any_auth_error?(*messages) ⇒ Boolean
19 20 21 22 23 24 25 |
# File 'lib/ey_gatekeeper/client/server_response.rb', line 19 def indicates_any_auth_error?(*) if auth_error_header = headers['X-Gatekeeper-Authentication-Error'] .map { || EY::GateKeeper::Responses.string() }.include?(auth_error_header) else false end end |
#is_gatekeeper_unauthorized? ⇒ Boolean
15 16 17 |
# File 'lib/ey_gatekeeper/client/server_response.rb', line 15 def ( && headers['X-Gatekeeper-Authentication-Error']) ? true : false end |
#needs_gatekeeper_token_refresh? ⇒ Boolean
27 28 29 |
# File 'lib/ey_gatekeeper/client/server_response.rb', line 27 def needs_gatekeeper_token_refresh? && indicates_any_auth_error?(:expired_token, :expired_impersonation_token) end |
#to_rack ⇒ Object
31 32 33 |
# File 'lib/ey_gatekeeper/client/server_response.rb', line 31 def to_rack [status, headers, body] end |
#unauthorized? ⇒ Boolean
11 12 13 |
# File 'lib/ey_gatekeeper/client/server_response.rb', line 11 def status == 401 end |