Sha256: d9c786a165408d7f625a6964af7abcd39daaca2886bd417d9c94390149ce870e

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

module FriendlyShipping
  module Services
    class ShipEngine
      class SerializeAddressResidentialIndicator
        class << self
          # @param location [Physical::Location]
          # @return [Hash]
          def call(location)
            { address_residential_indicator: residential_indicator(location) }
          end

          private

          # @param location [Physical::Location]
          # @return [String]
          def residential_indicator(location)
            return "unknown" if location&.address_type.nil?

            location.address_type == "residential" ? "yes" : "no"
          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/ship_engine/serialize_address_residential_indicator.rb