Sha256: a6d4760c653219254518d27275c2ddf5dc0a55e3adedd7354ec414996f2f169f

Contents?: true

Size: 788 Bytes

Versions: 18

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

module FriendlyShipping
  class ApiFailure
    attr_reader :failure, :original_request, :original_response

    # @param [Object] failure The API failure
    # @param [FriendlyShipping::Request] original_request The HTTP request (when debugging is enabled)
    # @param [FriendlyShipping::Response] original_response The HTTP response (when debugging is enabled)
    def initialize(failure, original_request:, original_response:)
      @failure = failure

      # We do not want to attach debugging information in every single response to save memory in production
      return unless original_request&.debug

      @original_request = original_request
      @original_response = original_response
    end

    def to_s
      failure.to_s
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
friendly_shipping-0.5.2 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.5.1 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.5 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.14 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.13 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.12 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.11 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.10 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.9 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.8 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.7 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.6 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.5 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.4 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.3 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.2 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.1 lib/friendly_shipping/api_failure.rb
friendly_shipping-0.4.0 lib/friendly_shipping/api_failure.rb