calibex v0.1.0 Calibex
Calibex allows you to handle ICal file format.
In the same way as the mailibex library, Calibex allows bijective coding/decoding :
making it possible to modify an ical and to keep all fields and struct of the initial ical.
The ICal elixir term is exactly a representation of the ICal file format : for instance :
[vcalendar: [[
prodid: "-//Google Inc//Google Calendar 70.9054//EN",
version: "2.0",
calscale: "GREGORIAN",
vevent: [[
dtstart: %DateTime{},
dtend: %DateTime{},
organizer: [cn: "My Name",value: "mailto:me@example.com"],
attendee: [cutype: "INDIVIDUAL",role: "REQ-PARTICIPANT",partstat: "NEEDS-ACTION",rsvp: true, cn: "Moi",
"x-num-guests": 0, value: "mailto:me@example.com"],
]]]]]
encode/1 and decode/1 parse and format an ICal from this terms : see
functions doc to find encoding rules.
Using this terms make it possible to handle all types of ICal files and any fields type. But the downside of this approach is that it can be cumbersome to create and handle this tree of keyword lists. To help you in this tasks, some helpers functions are provided :
Example usage : email event request generation
Calibex.request(dtstart: Timex.now, dtend: Timex.shift(Timex.now,hours: 1), summary: "Mon évènement",
organizer: "arnaud.wetzel@example.com", attendee: "jeanpierre@yahoo.fr", attendee: "jean@ya.fr")
|> Calibex.encode
Summary
Functions
return all available transformation rules. There are 2 types
Decode an ICal UTF8 binary into a tree of keywork list with the same rules as
encode/1, but inversed, excepted
Encode a tree of keyworks list with ICal rules
see new/2, default fill_attrs are
`[:prodid, :version, :calscale, :organizer, :attendee, :cutype, :role, :partstat, :rsvp, :x_num_guests]`
Complete an event keyword list to form an ical nested kwlists :
fill_attrs is a list of key atoms describing completion rules to be used
Complete an ical keyword list :
fill_attrs is a list of key atoms describing completion rules to be used
same as new/1, but with a REQUEST method in order to allow email request
ICS generation.
Default fill_attrs contains in addition [:uid,:last_modified,:sequence,:dtstamp,:created,:status]
same as new/2, but with a REQUEST method in order to allow email request
ICS generation
Functions
return all available transformation rules. There are 2 types :
- the ones which set a default value if not defined otherwise (DEFAULT)
- the ones which transform a given value if defined (TRANSFORM)
Available rules are :
:last_modified,:dtstamp,:created: DEFAULT to UTC now:sequence: DEFAULT to 0:uid: DEFAULT to all vals hexa sha1 of all event props:status: DEFAULT to :confirmed:version,:calscale,:prodid: DEFAULT to base ical attrs (2.0,GREGORIAN):cutype,:role,:partstat,:rsvp,:x_num_guests: DEFAULT to standard rsvp enabled attendee, waiting for event acceptance:organizerTRANSFORM an email string into a[cn: email,value: "mailto:"<>email]props value.:attendeeTRANSFORM an email string into a[cn: email,value: "mailto:"<>email]props value.
Decode an ICal UTF8 binary into a tree of keywork list with the same rules as
encode/1, but inversed, excepted :
- all leaf values are not decoded: kept as string.
Encode a tree of keyworks list with ICal rules :
KEY: [KW1,KW2]a list of keyword list is encoded as multipleBEGIN:KEY\nKW1\nEND:KEY\nBEGIN:KEY\nKW2\nEND:KEY[K1: V1, K2: V2]a keyword list is encoded as linesK1:V1\nK2:V2KEY: [K1, V1, K2: V2, value: VALUE]a keyword list as leaf value is encoded as key value line with props :KEY;K1=V1;K2=V2:VALUE%DateTime{}datetime values are encoded as UTC BasicISO string:atom1atom values are encoded as upercase stringATOM1:key_1atom keys are encoded as upercase string,_replaced with-:KEY-1
see new/2, default fill_attrs are
`[:prodid, :version, :calscale, :organizer, :attendee, :cutype, :role, :partstat, :rsvp, :x_num_guests]`
Complete an event keyword list to form an ical nested kwlists :
fill_attrs is a list of key atoms describing completion rules to be used.
see all_fill_attrs/0 doc to find allowed completion rules.
Complete an ical keyword list :
fill_attrs is a list of key atoms describing completion rules to be used.
see all_fill_attrs/0 doc to find allowed completion rules.
same as new/1, but with a REQUEST method in order to allow email request
ICS generation.
Default fill_attrs contains in addition [:uid,:last_modified,:sequence,:dtstamp,:created,:status]
same as new/2, but with a REQUEST method in order to allow email request
ICS generation.