iCal (ics) parser in Ruby

Discussion in 'Ruby' started by Une Bévue, Sep 29, 2007.

  1. Une Bévue

    Une Bévue Guest

    does exists an iCalendar (ics extension) exists un ruby ?
    i do have to translate dose files into csv...

    any advice appreciated.
    --
    Une Bévue
    Une Bévue, Sep 29, 2007
    #1
    1. Advertising

  2. On Sat, Sep 29, 2007 at 10:15:05PM +0900, Une B?vue wrote:
    >
    > does exists an iCalendar (ics extension) exists un ruby ?
    > i do have to translate dose files into csv...
    >
    > any advice appreciated.


    Try out vpim. http://vpim.rubyforge.org/

    enjoy,

    -jeremy

    --
    ========================================================================
    Jeremy Hinegardner
    Jeremy Hinegardner, Sep 29, 2007
    #2
    1. Advertising

  3. Une Bévue

    Une Bévue Guest

    Jeremy Hinegardner <> wrote:

    > Try out vpim. http://vpim.rubyforge.org/


    fine ! thanks a lot, it's exactly what i needed !
    i'll use also the vCard par because i've another project "AB2Web" (for
    AddressBook to web) producing html pages from AB contents...
    --
    Une Bévue
    Une Bévue, Sep 30, 2007
    #3
  4. Une Bévue

    Une Bévue Guest

    Une Bévue <> wrote:

    > i'll use also the vCard par because i've another project "AB2Web" (for
    > AddressBook to web) producing html pages from AB contents...


    i'd like to say instead of vCards i'm using an xml version of those
    following the proposal : draft-dawson-vcard-xml-dtd-01.dtd.
    --
    Une Bévue
    Une Bévue, Sep 30, 2007
    #4
  5. Une Bévue

    Une Bévue Guest

    Jeremy Hinegardner <> wrote:

    > Try out vpim. http://vpim.rubyforge.org/


    i get it :

    ~%> sudo gem install vpim
    Password:
    Need to update 49 gems from http://gems.rubyforge.org
    ..................................................
    complete
    Successfully installed vpim-0.360
    Installing ri documentation for vpim-0.360...
    Installing RDoc documentation for vpim-0.360...
    Could not find main page README
    Could not find main page README
    Could not find main page README
    Could not find main page README



    --
    Une Bévue
    Une Bévue, Sep 30, 2007
    #5
  6. On Sun, Sep 30, 2007 at 08:55:19AM +0900, Une B?vue wrote:
    > Jeremy Hinegardner <> wrote:
    >
    > > Try out vpim. http://vpim.rubyforge.org/

    >
    > i get it :
    >
    > ~%> sudo gem install vpim
    > Password:
    > Need to update 49 gems from http://gems.rubyforge.org
    > .................................................
    > complete
    > Successfully installed vpim-0.360
    > Installing ri documentation for vpim-0.360...
    > Installing RDoc documentation for vpim-0.360...
    > Could not find main page README
    > Could not find main page README
    > Could not find main page README
    > Could not find main page README


    This all just means that the rdoc generation of the vpim gem has some
    incorrect generation options. The the library itself is still
    installed.

    enjoy,

    -jeremy

    --
    ========================================================================
    Jeremy Hinegardner
    Jeremy Hinegardner, Sep 30, 2007
    #6
  7. Une Bévue

    Une Bévue Guest

    Jeremy Hinegardner <> wrote:

    >
    > This all just means that the rdoc generation of the vpim gem has some
    > incorrect generation options. The the library itself is still
    > installed.


    OK, i've tried one of your first example :

    ----------------------------------------------------------------
    #!/usr/bin/env ruby

    require 'vpim/vcard'
    require 'vpim/icalendar'

    $in = ARGV.first ? File.open(ARGV.shift) : $stdin
    $out = ARGV.first ? File.open(ARGV.shift, 'w') : $stdout

    cal = Vpim::Icalendar.create

    Vpim::Vcard.decode($in).each do |card|
    if card.birthday
    cal.push Vpim::Icalendar::Vevent.create_yearly(
    card.birthday,
    "Birthday for #{card['fn'].strip}"
    )
    $stderr.puts "#{card['fn']} -> bday #{cal.events.last.dtstart}"
    end
    end

    puts cal.encode
    ----------------------------------------------------------------

    calling it by :
    ../vcf-to-ics.rb Anais.vcf Anais.ics

    having an error :
    ~/work/Ruby/vpim-0.9/essais%> ./vcf-to-ics.rb Anais.vcf Anais.ics
    ../vcf-to-ics.rb:12: undefined method `birthday' for
    #<Vpim::Vcard:0x10d81c0> (NoMethodError)
    from ./vcf-to-ics.rb:11:in `each'
    from ./vcf-to-ics.rb:11

    the vCard i've exported being with a birthdat field, name in french :
    "date de naissance"

    do you think this could be the prob (ie french localisation of
    AddressBook) ???
    --
    Une Bévue
    Une Bévue, Sep 30, 2007
    #7
  8. On Mon, Oct 01, 2007 at 01:45:12AM +0900, Une B?vue wrote:
    > Jeremy Hinegardner <> wrote:
    >
    > >
    > > This all just means that the rdoc generation of the vpim gem has some
    > > incorrect generation options. The the library itself is still
    > > installed.

    >
    > OK, i've tried one of your first example :


    These aren't my examles. I had nothing to do with the development of
    vpim. I've used it once or twice to test some things out, but that's
    about it. I just knew it existed.

    > ----------------------------------------------------------------
    > #!/usr/bin/env ruby
    >
    > require 'vpim/vcard'
    > require 'vpim/icalendar'
    >
    > $in = ARGV.first ? File.open(ARGV.shift) : $stdin
    > $out = ARGV.first ? File.open(ARGV.shift, 'w') : $stdout
    >
    > cal = Vpim::Icalendar.create
    >
    > Vpim::Vcard.decode($in).each do |card|
    > if card.birthday
    > cal.push Vpim::Icalendar::Vevent.create_yearly(
    > card.birthday,
    > "Birthday for #{card['fn'].strip}"
    > )
    > $stderr.puts "#{card['fn']} -> bday #{cal.events.last.dtstart}"
    > end
    > end
    >
    > puts cal.encode
    > ----------------------------------------------------------------
    >
    > calling it by :
    > ./vcf-to-ics.rb Anais.vcf Anais.ics
    >
    > having an error :
    > ~/work/Ruby/vpim-0.9/essais%> ./vcf-to-ics.rb Anais.vcf Anais.ics
    > ./vcf-to-ics.rb:12: undefined method `birthday' for
    > #<Vpim::Vcard:0x10d81c0> (NoMethodError)
    > from ./vcf-to-ics.rb:11:in `each'
    > from ./vcf-to-ics.rb:11
    >
    > the vCard i've exported being with a birthdat field, name in french :
    > "date de naissance"
    >
    > do you think this could be the prob (ie french localisation of
    > AddressBook) ???


    Sounds plausible to me. How bout posting it to the vpim mailing list
    and see if the authors can help out.

    http://rubyforge.org/mail/?group_id=218

    enjoy,

    -jeremy

    --
    ========================================================================
    Jeremy Hinegardner
    Jeremy Hinegardner, Oct 1, 2007
    #8
  9. Une Bévue

    Une Bévue Guest

    Jeremy Hinegardner <> wrote:

    > Sounds plausible to me. How bout posting it to the vpim mailing list
    > and see if the authors can help out.
    >
    > http://rubyforge.org/mail/?group_id=218


    U're right, done !
    --
    Une Bévue
    Une Bévue, Oct 1, 2007
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael
    Replies:
    0
    Views:
    462
    Michael
    Sep 1, 2003
  2. The Night Blogger
    Replies:
    5
    Views:
    308
    Max M
    Dec 18, 2006
  3. SonOfGrey

    C++ ics calendar file parser

    SonOfGrey, Jan 17, 2007, in forum: C++
    Replies:
    0
    Views:
    770
    SonOfGrey
    Jan 17, 2007
  4. Grant Edwards

    What module to parse/generate ical files?

    Grant Edwards, Jun 21, 2010, in forum: Python
    Replies:
    1
    Views:
    339
    Michael Crute
    Jun 21, 2010
  5. Jerry Yang

    Date formatting to iCal Standard.

    Jerry Yang, Sep 6, 2008, in forum: ASP General
    Replies:
    3
    Views:
    149
    Jerry Yang
    Sep 7, 2008
Loading...

Share This Page