Class: Vpim::Agent::Calendars
- Inherits:
-
Object
- Object
- Vpim::Agent::Calendars
- 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
-
#get(path) ⇒ Object
Get object at this path.
-
#initialize(repo) ⇒ Calendars
constructor
A new instance of Calendars.
Constructor Details
#initialize(repo) ⇒ Calendars
Returns a new instance of Calendars.
122 123 124 |
# File 'lib/vpim/agent/calendars.rb', line 122 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.
158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/vpim/agent/calendars.rb', line 158 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 |