Sha256: 8bcf8ac2ba53a63c310459cee3c6025dc0fde48707777a7d8882c4be8258f312

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

require 'friendly_shipping/services/ship_engine_ltl/bad_request'

module FriendlyShipping
  module Services
    class ShipEngineLTL
      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

1 entries across 1 versions & 1 rubygems

Version Path
friendly_shipping-0.8.1 lib/friendly_shipping/services/ship_engine_ltl/bad_request_handler.rb