Sha256: 41c044c7c2c14c24af7a96aa0765ace54d7e37c07170457cf3432169727d6a9d
Contents?: true
Size: 1002 Bytes
Versions: 2
Compression:
Stored size: 1002 Bytes
Contents
module SimpleShipping::Fedex # Knows how to convert {Package} model to SOAP element for FedEx. class PackageBuilder < SimpleShipping::Abstract::Builder # FedEx mapping for weight units. WEIGHT_UNITS = {:kg => 'KG', :lb => 'LB'} # FedEx mapping for dimension units. DIMENSION_UNITS = {:in => 'IN', :cm => 'CM'} # Build a SOAP package element as a hash for Savon. def build { 'Weight' => {'Units' => WEIGHT_UNITS[@model.weight_units], 'Value' => @model.weight, :order! => ['Units', 'Value']}, 'Dimensions' => {'Length' => @model.length, 'Width' => @model.width, 'Height' => @model.height, 'Units' => DIMENSION_UNITS[@model.dimension_units], :order! => ['Length', 'Width', 'Height', 'Units']}, :order! => ['Weight', 'Dimensions']} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_shipping-0.4.7 | lib/simple_shipping/fedex/package_builder.rb |
simple_shipping-0.4.6 | lib/simple_shipping/fedex/package_builder.rb |