Sha256: 4e2bd0f7484ae26b189d7fe3138b382a283c67f56482a2d3b1347d1f4ffb8019

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

module FriendlyShipping
  module Services
    class UpsJson
      class ParseVoidResponse
        extend Dry::Monads::Result::Mixin

        class << self
          def call(request:, response:)
            parsed_response = ParseJsonResponse.call(
              request: request,
              response: response,
              expected_root_key: "VoidShipmentResponse"
            )

            parsed_response.bind do |void_response|
              result = void_response["VoidShipmentResponse"]
              Success(
                FriendlyShipping::ApiResult.new(
                  result,
                  original_request: request,
                  original_response: response
                )
              )
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
friendly_shipping-0.9.0 lib/friendly_shipping/services/ups_json/parse_void_response.rb