Class: ActiveMerchant::Shipping::NewZealandPost

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

Defined Under Namespace

Classes: Domestic, International, NewZealandPostPackage, NewZealandPostRateResponse, RateRequest

Constant Summary collapse

URL =
"http://api.nzpost.co.nz/ratefinder"
@@name =
"New Zealand Post"

Instance Attribute Summary

Attributes inherited from Carrier

#last_request, #test_mode

Instance Method Summary collapse

Methods inherited from Carrier

#initialize, #maximum_weight, #valid_credentials?

Constructor Details

This class inherits a constructor from ActiveMerchant::Shipping::Carrier

Instance Method Details

#find_rates(origin, destination, packages, options = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 14

def find_rates(origin, destination, packages, options = {})
  options = @options.merge(options)
  request = RateRequest.from(origin, destination, packages, options)
  request.raw_responses = commit(request.urls) if request.new_zealand_origin?
  request.rate_response
end

#requirementsObject



10
11
12
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 10

def requirements
  [:key]
end