Results 1 to 3 of 3

Thread: Question for Calendar and Curl Experts...(Using Ruby to Post Calendar Data To Zimbra)

  1. #1
    Chewie71 is offline Trained Alumni
    Join Date
    Sep 2006
    Location
    Illinois
    Posts
    374
    Rep Power
    8

    Default Question for Calendar and Curl Experts...(Using Ruby to Post Calendar Data To Zimbra)

    Hi,

    I'm working on a Ruby script that will take a students class schedule out of our campus LDAP system, convert it into ICS format, and then push that into their Zimbra account using the curl commands.

    I've gotten my Ruby code to the point where I can get the LDAP information I need (Ruby ActiveLdap), and convert the ldap data into ICS format (Ruby iCalendar). Is there a way to submit the ICS information to Zimbra without creating a physical ICS file on the system?

    I could create an ICS file with the Ruby iCalendar libraries, and then push it into zimbra with something like this...

    Code:
    results =`curl -u #{account}:password --data-binary @/tmp/somefile.ics http://#{mailhost}/service/home/#{account}/calendar?fmt=ics`
    ...but I'm wondering does the ICS have to be in a file? I have the ICS data in a calendar object I am passing into a function. Is there a way to tell curl to read the ICS data from the object....rather than having to print it out to a file first? It's an extra time consuming (and disk consuming) step that I don't want to do if I don't have to.

    If I need to clarify any of this let me know.

    Thanks,
    Matt

  2. #2
    Chewie71 is offline Trained Alumni
    Join Date
    Sep 2006
    Location
    Illinois
    Posts
    374
    Rep Power
    8

    Default

    I guess I should have read the curl manpage first....

    It looks like I might be able to use the --data-binary parameter without the @. I'll give that a go and see what happens.

    If somebody thinks this won't work and has another idea let me know.

    Thanks,
    Matt

  3. #3
    Chewie71 is offline Trained Alumni
    Join Date
    Sep 2006
    Location
    Illinois
    Posts
    374
    Rep Power
    8

    Default

    Using curl without the @ didn't seem to work.

    I see there is a Ruby Net/HTTP library that I could use to do a straight POST into Zimbra. This is the basic example from some Ruby documentation (Class: Net::HTTP)...
    Code:
    res = Net::HTTP.post_form(URI.parse('http://jack:pass@www.example.com/todo.cgi'),
                                            {'from'=>'2005-01-01', 'to'=>'2005-03-31'})
        puts res.body
    Can I use this to post calendar data into Zimbra or do I have to use curl? Anyone know how to POST an ics file into Zimbra? Something like this?

    Code:
    http://someuser:pass@our.mail.server/service/home/someuser/calendar?fmt=ics?data=icsdata
    I just don't know the parameter to use to POST the ICS data to that URL...anyone know?

    Thanks,
    Matt

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •