1

我有一个在我的电脑上运行良好的 heroku 应用程序,但是当它在 Heroku 上运行时它会抱怨

内部服务器错误

#<Icalendar::Calendar:0x00000000fe2c98> 的未定义方法 `bytesize'
WEBrick/1.3.1 (Ruby/1.9.2/2012-04-20) 在blooming-shore-6714.herokuapp.com:80

我使用命令 curl -v -H "Content-type: text/plain" --data-binary @invite.ics http://blooming-shore-6714.herokuapp.com/ics2event发送数据

文件@invite.ics 可以是您身边的任何 ics 文件。

当我尝试在 stringio 实例而不是文件实例上使用 icalendar 的 parse() 时,错误来了(我认为)。当我阅读文档时,StringIO 的实例应该与文件兼容。

作为参考,这是我的 web.rb 文件。

require 'sinatra'
require 'rubygems'
require 'icalendar'

get '/' do
  "new version"
end

get '/test' do
  "You've found me!"
end

post '/ics2event' do
  request.body.string

  invite = StringIO.new(request.body.string)

  cals = Icalendar.parse(invite)

  for each in cals do
    for eachEvent in each.events do
      eachEvent.summary
      eachEvent.description
      eachEvent.location
      eachEvent.status
      eachEvent.dtstart
      eachEvent.dtend
      eachEvent.organizer
      for eachAttendee in eachEvent.attendees do
        eachAttendee.to
      end
    end
  end

end

所以问题是,我如何让它消失?

4

0 回答 0