Class: ActiveMerchant::Shipping::NewZealandPost::International

Inherits:
RateRequest show all
Defined in:
lib/active_shipping/shipping/carriers/new_zealand_post.rb

Instance Attribute Summary

Attributes inherited from RateRequest

#raw_responses, #urls

Instance Method Summary collapse

Methods inherited from RateRequest

from, #initialize, #new_zealand_origin?, #rate_response

Constructor Details

This class inherits a constructor from ActiveMerchant::Shipping::NewZealandPost::RateRequest

Instance Method Details

#apiObject


176
177
178
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 176

def api
  :international
end

#api_paramsObject


180
181
182
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 180

def api_params
  { :country_code => @destination.country_code }
end

#price(product) ⇒ Object


184
185
186
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 184

def price(product)
  product["price"].to_f
end

#ratesObject


167
168
169
170
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 167

def rates
  raise "New Zealand Post packages must originate in New Zealand" unless new_zealand_origin?
  super
end

#service_name(product) ⇒ Object


172
173
174
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 172

def service_name(product)
  [product["group"], product["name"]].join(" ")
end