Sha256: 1b035b0a0d20e0396bca6012c85ff11ec4d08e759e92b19a79f45e655a4e1a11

Contents?: true

Size: 1.27 KB

Versions: 33

Compression:

Stored size: 1.27 KB

Contents

module ActiveShipping

  # The `RateResponse` object is returned by the {ActiveShipping::Carrier#find_rates}
  # call. The most important method is {#rates}, which will return a list of possible
  # shipping options with ane stiated price.
  #
  # @note Some carriers provide more information that others, so not all attributes
  #   will be set, depending on what carrier you are using.
  #
  # @!attribute rates
  #    The available rate options for the shipment, with an estimated price.
  #    @return [Array<ActiveShipping::RateEstimate>]
  class RateResponse < Response

    attr_reader :rates

    # Initializes a new RateResponse instance.
    #
    # @param success (see ActiveShipping::Response#initialize)
    # @param message (see ActiveShipping::Response#initialize)
    # @param params (see ActiveShipping::Response#initialize)
    # @option options (see ActiveShipping::Response#initialize)
    # @option options [Array<ActiveShipping::RateEstimate>] :rates The rate estimates to
    #   populate the {#rates} method with.
    def initialize(success, message, params = {}, options = {})
      @rates = Array(options[:estimates] || options[:rates] || options[:rate_estimates])
      super
    end

    alias_method :estimates, :rates
    alias_method :rate_estimates, :rates
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
active_shipping-1.8.5 lib/active_shipping/rate_response.rb
active_shipping-1.8.4 lib/active_shipping/rate_response.rb
active_shipping-1.8.3 lib/active_shipping/rate_response.rb
active_shipping-1.8.2 lib/active_shipping/rate_response.rb
active_shipping-1.8.1 lib/active_shipping/rate_response.rb
active_shipping-1.8.0 lib/active_shipping/rate_response.rb
active_shipping-1.7.3 lib/active_shipping/rate_response.rb
active_shipping-1.7.2 lib/active_shipping/rate_response.rb
active_shipping-1.7.1 lib/active_shipping/rate_response.rb
active_shipping-1.7.0 lib/active_shipping/rate_response.rb
active_shipping-1.6.5 lib/active_shipping/rate_response.rb
active_shipping-1.6.4 lib/active_shipping/rate_response.rb
active_shipping-1.6.3 lib/active_shipping/rate_response.rb
active_shipping-1.6.2 lib/active_shipping/rate_response.rb
active_shipping-1.6.1 lib/active_shipping/rate_response.rb
active_shipping-1.6.0 lib/active_shipping/rate_response.rb
active_shipping-1.5.0 lib/active_shipping/rate_response.rb
active_shipping-1.4.3 lib/active_shipping/rate_response.rb
active_shipping-1.4.2 lib/active_shipping/rate_response.rb
active_shipping-1.4.1 lib/active_shipping/rate_response.rb