Sha256: 4bae33ea54c8e89a41895f51fd09e220a80967a277d01801bdf83fd528fbe9f9
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module JSONiCal class LinksBuilder def initialize(event) @event = event end def call { 'google' => google, 'outlook' => outlook, 'lotus_note' => lotus_note, 'ical' => ical } end private attr_reader :event SERVICE_URI = 'https://jsonical.herokuapp.com/events'.freeze def google begin_date = format_date(event.begin_date) end_date = format_date(event.end_date) [ 'https://www.google.com/calendar/render', '?action=TEMPLATE', "&text=#{event.summary}", "&dates=#{begin_date}/#{end_date}", "&details=#{event.description.gsub("\n", '<br />')}", '&location=paris', '&sprop=&sprop=name:' ].join('') end def ics(vendor:) "#{SERVICE_URI}/#{CGI.escape(event.orn)}?vendor=#{vendor}" end def outlook ics(vendor: 'outlook') end def lotus_note ics(vendor: 'lotus_note') end def ical ics(vendor: 'ical') end def format_date(date) date.utc.strftime('%Y%m%dT%H%M%SZ') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
JSONiCal-1.0.0 | lib/jsonical/links_builder.rb |