Class: ActiveShipping::NewZealandPost::Domestic

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, #rates_hash, #response_options, #response_params, #responses, #url

Constructor Details

This class inherits a constructor from ActiveShipping::NewZealandPost::RateRequest

Instance Method Details

#apiObject



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

def api
  :domestic
end

#api_paramsObject



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

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

#price(product) ⇒ Object



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

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

#service_name(product) ⇒ Object



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

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