Sha256: 8ad483cb02057cda0bf9e3b7544f594e39869bb994a30fa36910af90ec497ca4

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

module ActiveMerchant #:nodoc:
  module Shipping
    # This is UPS specific for now; the hash is not at all generic
    # or common between carriers.

    class LabelResponse < Response
      attr :params # maybe?

      def initialize(success, message, params = {}, options = {})
        @params = params
        super
      end

      def labels
        return @labels if @labels
        packages = params["ShipmentResults"]["PackageResults"]
        packages = [packages] if Hash === packages
        @labels  = packages.map do |package|
          { :tracking_number => package["TrackingNumber"],
            :image           => package["LabelImage"] }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_shipping-0.12.6 lib/active_shipping/shipping/label_response.rb
active_shipping-0.12.5 lib/active_shipping/shipping/label_response.rb