rails Active_Shipping Fedex SmartPost问题

时间:2014-11-24 19:44:26

标签: ruby-on-rails fedex

我试图设置包含联邦快递智能邮政的运费计算器,但是当我运行请求时,不包括智能邮件(即使我已注册了它)。谁能告诉我我做错了什么? (我不认为我包括" SmartPostDetail"正确)

require 'active_shipping'
include ActiveMerchant::Shipping
destination = Location.new(country: 'US',
    state: 'CA',
    city: 'Beverly Hills',
    zip: '90210')
origin = Location.new(country: 'US',
    state: 'NC', 
    city: 'Burlington', 
    zip: '27217')
package = Package.new((16),[5, 4, 5],:units => :imperial)

fedex = FedEx.new(:key => 'KEY',
    :password => 'PASSWORD',
    :account => 'ACCOUNT#',
    :login => 'METER#',
    'SmartPostDetail' => {
        'Indicia' => 'PARCEL_SELECT', 
        'AncillaryEndorsement' => 'CARRIER_LEAVE_IF_NO_RESPONSE', 
        'SpecialServices' => 'USPS_DELIVERY_CONFIRMATION', 
        'HubId' => '5281'})

response_fedex = fedex.find_rates(origin, destination, package)
fedex_rates = response_fedex.rates.sort_by(&:price).collect {|rate| [rate.service_name, rate.price]}

输出:

[[" FedEx Ground Home Delivery",xxxx],[" FedEx Express Saver",xxxx],[" FedEx 2 Day",xxxx], ["联邦快递2天上午",xxxx],["联邦快递标准隔夜",xxxx],["联邦快递优先隔夜",xxxx],[&#34 ;联邦快递第一次过夜",xxxx]]

0 个答案:

没有答案