Sha256: b2705c8500b5abff28d948db619b64c6b6fa7c9737c3012859a603d487d7c1dc

Contents?: true

Size: 844 Bytes

Versions: 12

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

require 'friendly_shipping/services/ship_engine/bad_request'

module FriendlyShipping
  module Services
    class ShipEngine
      class BadRequestHandler
        extend Dry::Monads::Result::Mixin

        def self.call(error, original_request: nil, original_response: nil)
          if error.http_code == 400
            Failure(
              ApiFailure.new(
                BadRequest.new(error),
                original_request: original_request,
                original_response: original_response
              )
            )
          else
            Failure(
              ApiFailure.new(
                error,
                original_request: original_request,
                original_response: original_response
              )
            )
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
friendly_shipping-0.8.1 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.8.0 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.7.3 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.7.2 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.7.1 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.7.0 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.6.5 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.6.4 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.6.3 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.6.2 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.6.1 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb
friendly_shipping-0.6.0 lib/friendly_shipping/services/ship_engine/bad_request_handler.rb