Class: Vpim::Agent::Calendars

Inherits:
Object
  • Object
show all
Defined in:
lib/vpim/agent/calendars.rb

Overview

Return calendar information based on RESTful (lovein’ the jargon…) paths. Input is a Vpim::Repo.

.../coding/month/atom
.../coding/events/month/ics              <- next month?
.../coding/events/month/2008-04/ics      <- a specified month?
.../coding/week/atom
.../year/atom

Defined Under Namespace

Classes: Calendar

Instance Method Summary collapse

Constructor Details

#initialize(repo) ⇒ Calendars

Returns a new instance of Calendars.



121
122
123
# File 'lib/vpim/agent/calendars.rb', line 121

def initialize(repo)
  @repo = repo
end

Instance Method Details

#get(path) ⇒ Object

Get object at this path. Return value is a tuple of data and mime content type.



157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/vpim/agent/calendars.rb', line 157

def get(path)
  case name = path.to_path.shift
  when nil
    list = ResourceList.new("Calendars:", @repo.map{|c| c.name})
    return list.get(path)
  else
    if cal = @repo.find{|c| c.name == name}
      return Calendar.new(cal).get(path)
    else
      raise NotFound.new(name, path)
    end
  end
end