如何在UST API的rails 3上使用ruby中的运输宝石?

时间:2011-08-23 15:10:13

标签: ruby-on-rails ruby-on-rails-3 gem usps

我在这里找到了shipping ruby​​ for gemy http://shipping.rubyforge.org/在google上搜索有关在Ruby on rails应用程序上集成USPS API的一些信息,但是当我安装gem并添加时当我尝试运行我的应用程序或rake taks时,我运行Gemfile我的bundle install,我收到以下错误:

/Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require': /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/shipping-1.6.0/lib/shipping/ups.rb:109: syntax error, unexpected ':', expecting keyword_then or ';' or '\n' (SyntaxError)
/Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/shipping-1.6.0/lib/shipping/ups.rb:437: syntax error, unexpected keyword_end, expecting $end
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `block in load_dependency'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/shipping-1.6.0/lib/shipping.rb:47:in `<top (required)>'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler.rb:120:in `require'
    from /Users/myusername/railsapps/dbh4/config/application.rb:7:in `<top (required)>'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:15:in `require'
    from /Users/myusername/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:15:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我已经删除了Gemfile中的gem并且我的应用程序启动并运行但是,我甚至不知道这个gem是否适用于Rails 3,或者即使这个gem适用于{{ 1}} API。

对此有何帮助?我需要将USPS Web Tools与我的Ruby on Rails 3应用程序集成。

感谢。

1 个答案:

答案 0 :(得分:2)

发货宝石旧了,无法使用rails 3(最后一个版本在October 2009中)

尝试https://github.com/Shopify/active_shipping

它支持:

  • UPS
  • USPS
  • 联邦快递
  • 加拿大邮报
  • 新西兰邮报