Class: Savon::HTTPError
Class Method Summary collapse
Instance Method Summary collapse
- #http ⇒ Object
-
#initialize(transport_response) ⇒ HTTPError
constructor
A new instance of HTTPError.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(transport_response) ⇒ HTTPError
Returns a new instance of HTTPError.
9 10 11 |
# File 'lib/savon/http_error.rb', line 9 def initialize(transport_response) @transport_response = transport_response end |
Class Method Details
.present?(http) ⇒ Boolean
5 6 7 |
# File 'lib/savon/http_error.rb', line 5 def self.present?(http) http.error? end |
Instance Method Details
#http ⇒ Object
13 14 15 |
# File 'lib/savon/http_error.rb', line 13 def http @transport_response end |
#to_hash ⇒ Object
23 24 25 |
# File 'lib/savon/http_error.rb', line 23 def to_hash { code: http.code, headers: http.headers, body: http.body } end |
#to_s ⇒ Object
17 18 19 20 21 |
# File 'lib/savon/http_error.rb', line 17 def to_s String.new("HTTP error (#{http.code})").tap do |str_error| str_error << ": #{http.body}" unless http.body.empty? end end |