Sha256: c6ba95972bfe7442722b4f01069dcfb1f660556435983d7dc394bced85dcce79
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
= Canada Post Canada Post PHP Class will communicates with Canada Post Server and gets the shipping estimate. Its basic and can be extended. == How to Use As per Canada Post's specification, make sure Port 30000 is opened. At first require the gem. require 'canada_post' cPost = CanadaPost.new Set your manufacturer CPCID, postal code by calling the function setManufacturer merchant = { :merchantCPCID => 'CPC_DEMO_XML', :fromPostalCode => 'L1JK9', :turnAroundTime => 24, :itemsPrice => 14 } cPost.setMerchant merchant Then set the Customer address in the format shown below, again in associative array format. *Note*: city and provOrState are optional. Only Postal Code and country is required. customer = { :city => 'Brampton', :provOrState => 'Ontario', :country => 'CA', :postalCode => 'L1JK9' } cPost.setCustomer customer Then, add the products needed to be shipped (add as many as you want), in the format shown below: item = { :quantity => 1, :weight => 2, :length => 3, :width => 1, :height => 8, :description => 'some Description about Product' } cPost.addItem item Then, invoke the method below (returns XML format of details from Canada Post Server): response = cPost.getRates == License The gem is based on {CanadaPost PHP class}[http://github.com/itsalif/CanadaPost]. The script has been released under MIT License.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
canada_post-0.1.2 | README.rdoc |