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

#create_shipment, #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


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

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


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

def requirements
  [:key]
end