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



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

def api
  :international
end

#api_paramsObject



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

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

#price(product) ⇒ Object



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

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

#ratesObject



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

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

#service_name(product) ⇒ Object



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

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