JSONiCal
This micro service provides an interface between your main application and calendar clients (e.g. outlook, lotus note, icalendar, etc.).
Requirements
This application needs:
- ruby 2.3.3
- docker
- docker-compose
Be careful
- This service use puma web server. The code in deps must be thread safe !
- This repo use auto deployment when commit is push on master !
How does it work ?
An actor (e.g. your main application) pushes messages into AMQP. Listen queues are jsonical.vevent.create
, jsonical.vevent.update
, jsonical.vevent.delete
.
Messages must be a stringified JSON, and must respect a strict schema.
Example:
{
"version": "v1",
"data": {
"orn": "orn:cockpit:pilotage:U3241834:action/A93489010",
"calendar_orn": "orn:cockpit:pilotage:U3241834:company/C823510948",
"summary": "My awesome event",
"description": "No idea",
"begin_date": "2016-12-15 14:30:00 +0100",
"end_date": "2016-12-15 15:00:00 +0100",
"uri": "https://cockpit.jobteaser.com/actions/orn:cockpit:pilotage:U3241834:action%2FA93489010",
"uid": "https://cockpit.jobteaser.com/actions/orn:cockpit:pilotage:U3241834:action%2FA93489010",
"klass": "PUBLIC",
"created": "2016-10-10 08:32:52 +0100",
"updated": "2016-10-10 08:32:52 +0100"
}
}
When an event is available in queue, the listener stores the event and acknowledges the message in AMQP.
Links
Install
Up Postgres and AMQP server with docker
$> docker-compose up
Create .env
$> cp .env.sample .env
Source enviroment
$> source .env
Run setup script
$> bin/setup
This will run bundler, create the database, run the migrations and seed it with
db/seed.rb
Start application
$> bundle exec foreman start
Seed
You can seed the database like that: ruby db/seed.rb
. The seed generates a calendar with many event between today ± 30 days. You can run the seed again when you need more calendars.
The seed script uses the faker gem to generate fake data. You can't run seed in production mode.
Test
$> bin/rspec
TODO
- [ ] Bump to ruby 2.4.0
- [ ] Write yard documentation