2017-06-13 27 views
0

試圖檢索印度郵政的運費,但不知道如何。我遵循Getting Started指南。如何獲得特定服務的費率 - EasyPost ruby​​?

to_address = EasyPost::Address.create(
    :name => 'Dr. Steve Brule', 
    :street1 => 'Ravindra Nath Tagore Marg', 
    :city => 'Nagpur', 
    :zip => '440001', 
    :country => 'IN', 
    :phone => '310-808-5243' 
) 
from_address = EasyPost::Address.create(
    :company => 'Bera', 
    :street1 => 'Johari Bazar 14', 
    :city => 'Jaipur', 
    :country => 'IN', 
    :zip => '302003', 
    :phone => '911800112011' 
) 

parcel = EasyPost::Parcel.create(
    :width => 15.2, 
    :length => 18, 
    :height => 9.5, 
    :weight => 35.1 
) 

shipment = EasyPost::Shipment.create(
    :to_address => to_address, 
    :from_address => from_address, 
    :parcel => parcel, 
) 

rate = shipment.lowest_rate(carriers = ['India Post'], services = ['First']) 

裝運不包含任何費率無法找出什麼是不正確的在這個例子。

回答

1
  1. 您是否通過EasyPost儀表板添加了印度郵政運營商賬戶。入門指南確實解釋:

    注意:除非您輸入了其他運營商的運營商信息,否則您只會收到USPS費率。

  2. 如果您希望貨件只返回一個承運人的費率,請將該承運人賬戶ID與Shipment.create呼叫一起傳遞。

    您可以通過傳遞carrier_accounts參數[source]

  3. EasyPost目前只支持追蹤IndiaPost,你可以看到this page限制使用評級CarrierAccounts。

今後,請嘗試通過電子郵件發送[email protected]以獲得最佳建議。

+0

不幸的是,印度郵政未在其他運營商列表中列出,我無法添加它(https://www.easypost.com/account/carriers)。 – djsmentya

+0

正如我所說,EasyPost只支持IndiaPost的Tracking。運營商賬戶在幾乎所有情況下都可以使用,以便您可以使用該運營商購買標籤,如果EasyPost支持爲該運營商購買標籤。 – KFunk

相關問題