Class: RestClient::Exception
- Defined in:
- lib/fir/patches/rest_client_fix.rb
Instance Method Summary collapse
Instance Method Details
#http_code ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fir/patches/rest_client_fix.rb', line 10 def http_code # return integer for compatibility if @response # Handle case where @response is a String (e.g., "401 Unauthorized") # or when @response is a proper response object code = if @response.respond_to?(:code) @response.code else @response.to_s[/\d{3}/] end code.to_i else @initial_response_code end end |