Class: ActiveMerchant::Shipping::NewZealandPost::Domestic

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

Instance Attribute Summary

Attributes inherited from RateRequest

#raw_responses, #urls

Instance Method Summary collapse

Methods inherited from RateRequest

from, #initialize, #new_zealand_origin?, #rate_response

Constructor Details

This class inherits a constructor from ActiveMerchant::Shipping::NewZealandPost::RateRequest

Instance Method Details

#apiObject


149
150
151
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 149

def api
  :domestic
end

#api_paramsObject


153
154
155
156
157
158
159
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 153

def api_params
  {
    :postcode_src => @origin.postal_code,
    :postcode_dest => @destination.postal_code,
    :carrier => "all"
  }
end

#price(product) ⇒ Object


161
162
163
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 161

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

#service_name(product) ⇒ Object


145
146
147
# File 'lib/active_shipping/shipping/carriers/new_zealand_post.rb', line 145

def service_name(product)
  [product["service_group_description"], product["description"]].join(" ")
end