Skip to content

Fork of gitlab.com/bravevision/auspost_api_client, used by TS

License

Notifications You must be signed in to change notification settings

red-ant/auspost_api_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AusPost API Client

Ruby gem for the Australia Post APIs. Currently not finished but it does support calculating shipping costs.

Install

Add to Gemfile

gem 'auspost_api_client', git: 'https://github.com/red-ant/auspost_api_client'

Usage

require 'auspost_api_client'

aus_post_client = AuspostApiClient::Client.new(<your_api_key>)

shipping_response = aus_post_client.postage.parcel.domestic.calculate(
  <from_postcode>,
  <to_postcode>,
  <length>,
  <width>,
  <height>,
  <weight>,
  <service_code>
)

# total in Australian Dollars
shipping_response.total_cost.to_f

Auspost API

Documentation

Example calculate domestic parcel shipping costs

GET https://digitalapi.auspost.com.au/postage/parcel/domestic/calculate.json?from_postcode=5000&to_postcode=2914&length=21.0&width=14.8&height=1.99&weight=0.492&service_code=AUS_PARCEL_REGULAR

{
  "postage_result": {
    "service": "Parcel Post",
    "delivery_time": "Delivered in 2-4 business days",
    "total_cost": "10.95",
    "costs": {
      "cost": {
        "item": "Parcel Post",
        "cost": "10.95"
      }
    }
  }
}

Run tests

API_KEY=<your_api_key> rake test

License

The gem is available as open source under the terms of the MIT License.

About

Fork of gitlab.com/bravevision/auspost_api_client, used by TS

Resources

License

Stars

Watchers

Forks

Packages

No packages published