Sha256: d20cdd62e8ade53bbf8cade3964f82c762a6001b20bfcb5892dcaba98e5edaaa

Contents?: true

Size: 1.14 KB

Versions: 14

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module FriendlyShipping
  module Services
    class UpsFreight
      class GeneratePickupRequestHash
        class << self
          def call(pickup_request_options:)
            return unless pickup_request_options

            {
              AdditionalComments: pickup_request_options.comments,
              Requester: {
                ThirdPartyRequester: pickup_request_options.third_party_requester ? '' : nil,
                AttentionName: pickup_request_options.requester.name,
                EMailAddress: pickup_request_options.requester_email,
                Name: pickup_request_options.requester.company_name,
                Phone: {
                  Number: pickup_request_options.requester.phone
                }.compact
              }.compact,
              PickupDate: pickup_request_options.pickup_time_window.begin.strftime('%Y%m%d'),
              EarliestTimeReady: pickup_request_options.pickup_time_window.begin.strftime('%H%M'),
              LatestTimeReady: pickup_request_options.pickup_time_window.end.strftime('%H%M'),
            }.compact
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
friendly_shipping-0.9.0 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.8.1 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.8.0 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.7.3 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.7.2 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.7.1 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.7.0 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.6.5 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.6.4 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.6.3 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.6.2 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.6.1 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.6.0 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb
friendly_shipping-0.5.3 lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb