Class: FriendlyShipping::Services::TForceFreight::GenerateLocationHash
- Inherits:
-
Object
- Object
- FriendlyShipping::Services::TForceFreight::GenerateLocationHash
- Defined in:
- lib/friendly_shipping/services/tforce_freight/generate_location_hash.rb
Overview
Generates a location hash for JSON serialization.
Class Method Summary collapse
-
.call(location:) ⇒ Hash
Location hash suitable for JSON request.
Class Method Details
.call(location:) ⇒ Hash
Returns location hash suitable for JSON request.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/friendly_shipping/services/tforce_freight/generate_location_hash.rb', line 11 def call(location:) { address: { city: location.city, stateProvinceCode: location.region&.code, postalCode: location.zip&.strip&.[](0..4), country: location.country&.code }.compact } end |