class ActiveShipping::AustraliaPost::CalculateRequest
Attributes
service_code[R]
Public Class Methods
new(origin, destination, package, service_code, options)
click to toggle source
Calls superclass method
ActiveShipping::AustraliaPost::AustraliaPostRequest::new
# File lib/active_shipping/carriers/australia_post.rb, line 195 def initialize(origin, destination, package, service_code, options) super(origin, destination, package, options) @service_code = service_code @endpoints = PARCEL_ENDPOINTS[:calculate] end
Public Instance Methods
parse(data)
click to toggle source
Calls superclass method
ActiveShipping::AustraliaPost::AustraliaPostRequest#parse
# File lib/active_shipping/carriers/australia_post.rb, line 202 def parse(data) super postage_result = response['postage_result'] @rates = [{ service_name: postage_result['service'], service_code: service_code, total_price: postage_result['total_cost'].to_f, currency: 'AUD', delivery_time_text: postage_result['delivery_time'] }] end
Private Instance Methods
calculate_params()
click to toggle source
# File lib/active_shipping/carriers/australia_post.rb, line 217 def calculate_params { service_code: @service_code, option_code: @options[:option_code], suboption_code: @options[:suboption_code], extra_cover: @options[:extra_cover] }. # INFO: equivalent of .compact select { |_, value| !value.nil? } end
domestic_params()
click to toggle source
Calls superclass method
ActiveShipping::AustraliaPost::AustraliaPostRequest#domestic_params
# File lib/active_shipping/carriers/australia_post.rb, line 228 def domestic_params super.merge(calculate_params) end
international_params()
click to toggle source
Calls superclass method
ActiveShipping::AustraliaPost::AustraliaPostRequest#international_params
# File lib/active_shipping/carriers/australia_post.rb, line 232 def international_params super.merge(calculate_params) end