Class: ActiveShipping::NewZealandPost
- Defined in:
- lib/active_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
Class Method Summary collapse
- .default_location ⇒ Object protected
Instance Method Summary collapse
- #commit(urls) ⇒ Object protected
- #find_rates(origin, destination, packages, options = {}) ⇒ Object
- #requirements ⇒ Object
Methods inherited from Carrier
#available_services, #cancel_shipment, #create_shipment, #find_tracking_info, #initialize, #maximum_address_field_length, #maximum_weight, #save_request, #timestamp_from_business_day, #valid_credentials?
Constructor Details
This class inherits a constructor from ActiveShipping::Carrier
Class Method Details
Instance Method Details
#commit(urls) ⇒ Object (protected)
21 22 23 |
# File 'lib/active_shipping/carriers/new_zealand_post.rb', line 21 def commit(urls) save_request(urls).map { |url| ssl_get(url) } end |
#find_rates(origin, destination, packages, options = {}) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/active_shipping/carriers/new_zealand_post.rb', line 12 def find_rates(origin, destination, packages, = {}) = @options.merge() request = RateRequest.from(origin, destination, packages, ) request.raw_responses = commit(request.urls) if request.new_zealand_origin? request.rate_response end |
#requirements ⇒ Object
8 9 10 |
# File 'lib/active_shipping/carriers/new_zealand_post.rb', line 8 def requirements [:key] end |