Class: FriendlyShipping::Services::UpsFreight::GeneratePickupRequestHash

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb

Class Method Summary collapse

Class Method Details

.call(pickup_request_options:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/friendly_shipping/services/ups_freight/generate_pickup_request_hash.rb', line 8

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