Class: ActiveShipping::NewZealandPost::International

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

Instance Attribute Summary

Attributes inherited from RateRequest

#raw_responses, #urls

Instance Method Summary collapse

Methods inherited from RateRequest

domestic?, from, #initialize, new_zealand?, #new_zealand_origin?, #params, #parse_response, #product_arrays, #products_hash, #rate_options, #rate_response, #rates_hash, #response_options, #response_params, #responses, #url

Constructor Details

This class inherits a constructor from ActiveShipping::NewZealandPost::RateRequest

Instance Method Details

#apiObject



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

def api
  :international
end

#api_paramsObject



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

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

#price(product) ⇒ Object



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

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

#ratesObject



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

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

#service_name(product) ⇒ Object



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

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