Class: Savon::HTTPError

Inherits:
Error
  • Object
show all
Defined in:
lib/savon/http_error.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http) ⇒ HTTPError

Returns a new instance of HTTPError.



10
11
12
# File 'lib/savon/http_error.rb', line 10

def initialize(http)
  @http = http
end

Instance Attribute Details

#httpObject (readonly)

Returns the value of attribute http.



14
15
16
# File 'lib/savon/http_error.rb', line 14

def http
  @http
end

Class Method Details

.present?(http) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/savon/http_error.rb', line 6

def self.present?(http)
  http.error?
end

Instance Method Details

#to_hashObject



22
23
24
# File 'lib/savon/http_error.rb', line 22

def to_hash
  { :code => @http.code, :headers => @http.headers, :body => @http.body }
end

#to_sObject



16
17
18
19
20
# File 'lib/savon/http_error.rb', line 16

def to_s
  message = "HTTP error (#{@http.code})"
  message << ": #{@http.body}" unless @http.body.empty?
  message
end