📄 08 - finding the cost to ship packages via ups or fedex.rb
字号:
require 'rubygems'require 'shipping'ship = Shipping::Base.new( :fedex_url => 'https://gatewaybeta.fedex.com/GatewayDC', :fedex_account => '123456789', :fedex_meter => '387878', :ups_account => '7B4F74E3075AEEFF', :ups_user => 'username', :ups_password => 'password', :sender_zip => 10001 # It's shipped from Manhattan.)ship.weight = 2 # It weighs two pounds.ship.city = 'Portland'ship.state = 'OR'ship.zip = 97202ship.ups.price # => 8.77ship.fedex.price # => 5.49ship.ups.valid_address? # => true#---fedex_url: https://gatewaybeta.fedex.com/GatewayDCfedex_account: 1234556fedex_meter: 387878ups_account: 7B4F74E3075AEEFFups_user: usernameups_password: password#---ship = Shipping::FedEx.new(:prefs => "#{RAILS_ROOT}/config/shipping.yml")ship.sender_zip = 10001ship.zip = 97202ship.state = 'OR'ship.weight = 2ship.price > ship.discount_price # => true#---
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -