Method: ActiveShipping::RateResponse#initialize

Defined in:
lib/active_shipping/rate_response.rb

#initialize(success, message, params = {}, options = {}) ⇒ RateResponse

Initializes a new RateResponse instance.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

  • success (Boolean)

    Whether the request was considered successful, i.e. this response object will have the expected data set.

  • message (String)

    A status message. Usuaully set when success is false, but can also be set for successful responses.

  • params (Hash) (defaults to: {})

    Response parameters

Options Hash (options):

  • :rates (Array<ActiveShipping::RateEstimate>)

    The rate estimates to populate the #rates method with.

  • :test (Boolean) — default: default: false

    Whether this reponse was a result of a request executed against the sandbox or test environment of the carrier's API.

  • :xml (String)

    The raw XML of the response.

  • :request (String)

    The payload of the request.

  • :allow_failure (Boolean)

    Allows a failed response without raising.



25
26
27
28
# File 'lib/active_shipping/rate_response.rb', line 25

def initialize(success, message, params = {}, options = {})
  @rates = Array(options[:estimates] || options[:rates] || options[:rate_estimates])
  super
end