Sha256: 379c2338812ae3b56816f92ac2e2d5d8a57f5d237f7e415bef3f5423fa300239

Contents?: true

Size: 477 Bytes

Versions: 5

Compression:

Stored size: 477 Bytes

Contents

# frozen_string_literal: true

module Savon
  class HTTPError < Error

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

    def initialize(http)
      @http = http
    end

    attr_reader :http

    def to_s
      String.new("HTTP error (#{@http.code})").tap do |str_error|
        str_error << ": #{@http.body}" unless @http.body.empty?
      end
    end

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

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
savon-2.15.1 lib/savon/http_error.rb
savon-2.15.0 lib/savon/http_error.rb
savon-2.14.0 lib/savon/http_error.rb
savon-2.13.1 lib/savon/http_error.rb
savon-2.13.0 lib/savon/http_error.rb