Class: KeycloakAdmin::Response

Inherits:
String
  • Object
show all
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

Instance Method Summary collapse

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

#headersObject (readonly)

Returns the value of attribute headers.



7
8
9
# File 'lib/keycloak-admin/client/response.rb', line 7

def headers
  @headers
end

#reason_phraseObject (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

#statusObject (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