lib/active_shipping/carriers/ups.rb in active_shipping-1.7.0 vs lib/active_shipping/carriers/ups.rb in active_shipping-1.7.1

- old
+ new

@@ -192,11 +192,11 @@ # one could make decisions based on the price or some such to avoid # surprises. This also has *no* error handling yet. xml = parse_ship_confirm(confirm_response) success = response_success?(xml) message = response_message(xml) - raise message unless success + raise ActiveShipping::ResponseContentError, StandardError.new(message) unless success digest = response_digest(xml) # STEP 2: Accept. Use shipment digest in first response to get the actual label. accept_request = build_accept_request(digest, options) logger.debug(accept_request) if logger @@ -746,10 +746,17 @@ # to 1 decimal place. xml.Weight(dry_ice[:weight]) end end end + + if package_value = package.options[:insured_value] + xml.InsuredValue do + xml.CurrencyCode(package.options[:currency] || 'USD') + xml.MonetaryValue(package_value.to_f) + end + end end # not implemented: * Shipment/Package/LargePackageIndicator element # * Shipment/Package/AdditionalHandling element end @@ -841,10 +848,10 @@ shipment_events = activities.map do |activity| description = activity.at('Status/StatusType/Description').text type_code = activity.at('Status/StatusType/Code').text zoneless_time = parse_ups_datetime(:time => activity.at('Time'), :date => activity.at('Date')) location = location_from_address_node(activity.at('ActivityLocation/Address')) - ShipmentEvent.new(description, zoneless_time, location, nil, type_code) + ShipmentEvent.new(description, zoneless_time, location, description, type_code) end shipment_events = shipment_events.sort_by(&:time) # UPS will sometimes archive a shipment, stripping all shipment activity except for the delivery