class Vpim::Agent::Ics

Public Instance Methods

atomize(caluri, feeduri) click to toggle source
# File lib/vpim/agent/ics.rb, line 24
def atomize(caluri, feeduri)
  repo = Vpim::Repo::Uri.new(caluri)
  cal = repo.find{true}
  cal = View.week(cal)
  feed = Agent::Atomize.calendar(cal, feeduri, caluri, cal.name)
  return feed.to_xml,  Agent::Atomize::MIME
end
get_atom(caluri) click to toggle source
When we support other forms..

get '/ics/:form' do

form = params[:form]
# File lib/vpim/agent/ics.rb, line 54
def get_atom(caluri)
  if caluri.empty?
    redirect script_url
  end

  feeduri = script_url + "/atom?" + caluri

  begin
    xml, xmltype = atomize(caluri, feeduri)
    content_type xmltype
    body xml
  rescue
    redirect script_url + "?" + caluri
  end
end
get_base(from) click to toggle source

Route handlers:

# File lib/vpim/agent/ics.rb, line 33
def get_base(from)
  @url_base = script_url   # agent mount point
  @url_ics  = from         # ics from here
  @url_atom = nil          # atom feed from here, if ics is accessible
  @url_error= nil          # error message, if is is not accessible

  if not from.empty?
    begin
      atomize(from, "http://example.com")
      @url_atom = @url_base + "/atom" + "?" + from
    rescue
      @url_error = CGI.escapeHTML($!.to_s)
    end
  end

  haml :"vpim/agent/ics/view"
end
get_style() click to toggle source
# File lib/vpim/agent/ics.rb, line 70
def get_style
  content_type 'text/css'
  css :"vpim/agent/ics/style"
end