Class: FriendlyShipping::Services::USPSShip::SerializeRateEstimatesRequest
- Inherits:
-
Object
- Object
- FriendlyShipping::Services::USPSShip::SerializeRateEstimatesRequest
- Defined in:
- lib/friendly_shipping/services/usps_ship/serialize_rate_estimates_request.rb
Class Method Summary collapse
-
.call(shipment:, package:, options:) ⇒ Hash
Serialize a rate estimates request.
Class Method Details
.call(shipment:, package:, options:) ⇒ Hash
Serialize a rate estimates request.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/friendly_shipping/services/usps_ship/serialize_rate_estimates_request.rb', line 14 def call(shipment:, package:, options:) length, width, height = package.dimensions.sort.reverse = .(package) { originZIPCode: shipment.origin.zip, destinationZIPCode: shipment.destination.zip, weight: package.weight.convert_to(:lbs).value.to_f.round(2), length: length.convert_to(:in).value.to_f.round(2), width: width.convert_to(:in).value.to_f.round(2), height: height.convert_to(:in).value.to_f.round(2), mailClass: .shipping_method.service_code, processingCategory: processing_category(package, ), rateIndicator: .rate_indicator, destinationEntryFacilityType: .destination_entry_facility_type, priceType: .price_type, mailingDate: .mailing_date.strftime("%Y-%m-%d") } end |