Class: ActiveShipping::AustraliaPost::CalculateRequest
- Inherits:
-
AustraliaPostRequest
- Object
- AustraliaPostRequest
- ActiveShipping::AustraliaPost::CalculateRequest
- Defined in:
- lib/active_shipping/carriers/australia_post.rb
Instance Attribute Summary collapse
-
#service_code ⇒ Object
readonly
Returns the value of attribute service_code.
Attributes inherited from AustraliaPostRequest
#rates, #raw_response, #response
Instance Method Summary collapse
-
#initialize(origin, destination, package, service_code, options) ⇒ CalculateRequest
constructor
A new instance of CalculateRequest.
- #parse(data) ⇒ Object
Methods inherited from AustraliaPostRequest
Constructor Details
#initialize(origin, destination, package, service_code, options) ⇒ CalculateRequest
Returns a new instance of CalculateRequest.
195 196 197 198 199 200 |
# File 'lib/active_shipping/carriers/australia_post.rb', line 195 def initialize(origin, destination, package, service_code, ) super(origin, destination, package, ) @service_code = service_code @endpoints = PARCEL_ENDPOINTS[:calculate] end |
Instance Attribute Details
#service_code ⇒ Object (readonly)
Returns the value of attribute service_code.
193 194 195 |
# File 'lib/active_shipping/carriers/australia_post.rb', line 193 def service_code @service_code end |
Instance Method Details
#parse(data) ⇒ Object
202 203 204 205 206 207 208 209 210 211 212 213 |
# 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 |