Class: ActiveShipping::RateResponse
- Defined in:
- lib/active_shipping/rate_response.rb
Overview
Note:
Some carriers provide more information than others, so not all attributes will be set, depending on what carrier you are using.
The RateResponse
object is returned by the Carrier#find_rates
call. The most important method is #rates, which will return a list of possible
shipping options with an estimated price.
Direct Known Subclasses
CPPWSRateResponse, CanadaPost::CanadaPostRateResponse, Correios::CorreiosRateResponse, NewZealandPost::NewZealandPostRateResponse
Instance Attribute Summary collapse
-
#rates ⇒ Array<ActiveShipping::RateEstimate>
(also: #estimates, #rate_estimates)
The available rate options for the shipment, with an estimated price.
Attributes inherited from Response
#message, #params, #request, #test, #xml
Instance Method Summary collapse
-
#initialize(success, message, params = {}, options = {}) ⇒ RateResponse
constructor
Initializes a new RateResponse instance.
Methods inherited from Response
Constructor Details
#initialize(success, message, params = {}, options = {}) ⇒ RateResponse
Initializes a new RateResponse instance.
25 26 27 28 |
# File 'lib/active_shipping/rate_response.rb', line 25 def initialize(success, , params = {}, = {}) @rates = Array([:estimates] || [:rates] || [:rate_estimates]) super end |
Instance Attribute Details
#rates ⇒ Array<ActiveShipping::RateEstimate> Also known as: estimates, rate_estimates
The available rate options for the shipment, with an estimated price.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/active_shipping/rate_response.rb', line 13 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, , params = {}, = {}) @rates = Array([:estimates] || [:rates] || [:rate_estimates]) super end alias_method :estimates, :rates alias_method :rate_estimates, :rates end |