Class: FriendlyShipping::Services::UpsFreight::GenerateReferenceHash
- Inherits:
-
Object
- Object
- FriendlyShipping::Services::UpsFreight::GenerateReferenceHash
- Defined in:
- lib/friendly_shipping/services/ups_freight/generate_reference_hash.rb
Class Method Summary collapse
-
.call(reference_numbers:) ⇒ Hash
Reference hash suitable for JSON request.
Class Method Details
.call(reference_numbers:) ⇒ Hash
Returns Reference hash suitable for JSON request.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/friendly_shipping/services/ups_freight/generate_reference_hash.rb', line 10 def call(reference_numbers:) return {} unless reference_numbers references = reference_numbers.map do |reference_number| { Number: { Code: reference_number[:code], Value: reference_number[:value] } } end references.any? ? { Reference: references } : {} end |