Class: KeycloakAdmin::Response
- Inherits:
-
String
- Object
- String
- KeycloakAdmin::Response
- Defined in:
- lib/keycloak-admin/client/response.rb
Overview
Wraps a Faraday::Response the way RestClient::Response used to: as the body string itself (RestClient::Response < String), so existing call sites that do JSON.parse(response) or response.to_i keep working, while .body/.headers/.status/.code/.reason_phrase stay available for call sites that need response metadata.
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#reason_phrase ⇒ Object
readonly
Returns the value of attribute reason_phrase.
-
#status ⇒ Object
(also: #code)
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(faraday_response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(faraday_response) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 14 |
# File 'lib/keycloak-admin/client/response.rb', line 9 def initialize(faraday_response) super(faraday_response.body.to_s) @status = faraday_response.status @reason_phrase = faraday_response.reason_phrase @headers = symbolize_headers(faraday_response.headers) end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/keycloak-admin/client/response.rb', line 7 def headers @headers end |
#reason_phrase ⇒ Object (readonly)
Returns the value of attribute reason_phrase.
7 8 9 |
# File 'lib/keycloak-admin/client/response.rb', line 7 def reason_phrase @reason_phrase end |
#status ⇒ Object (readonly) Also known as: code
Returns the value of attribute status.
7 8 9 |
# File 'lib/keycloak-admin/client/response.rb', line 7 def status @status end |