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



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

def api
  :international
end

#api_paramsObject



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

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

#price(product) ⇒ Object



189
190
191
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 189

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

#ratesObject



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

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

#service_name(product) ⇒ Object



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

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