Class: DAV4Rack::Carddav::AddressbookResource
- Inherits:
-
Resource
- Object
- Resource
- Resource
- DAV4Rack::Carddav::AddressbookResource
show all
- Defined in:
- lib/dav4rack_ext/carddav/resources/addressbook_resource.rb
Constant Summary
Constants inherited
from Resource
Resource::CARDAV_NS, Resource::PRIVILEGES
Instance Method Summary
collapse
Methods inherited from Resource
#current_user, #get_property, #initialize, #is_self?, #properties, #router_params, #user_agent
#define_properties, extended
Instance Method Details
#children ⇒ Object
116
117
118
119
120
121
122
|
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 116
def children
Logger.debug "ABR::children(#{public_path})"
@address_book.contacts.collect do |c|
Logger.debug "Trying to create this child (contact): #{c.uid.to_s}"
child(ContactResource, c, @address_book)
end
end
|
#collection? ⇒ Boolean
112
113
114
|
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 112
def collection?
true
end
|
#exist? ⇒ Boolean
108
109
110
|
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 108
def exist?
@address_book != nil
end
|
#find_child(uid) ⇒ Object
124
125
126
127
128
129
130
131
132
|
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 124
def find_child(uid)
uid = File.basename(uid, '.vcf')
c = @address_book.find_contact(uid)
if c
child(ContactResource, c)
else
nil
end
end
|
#setup ⇒ Object
103
104
105
106
|
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 103
def setup
super
@address_book = @options[:_object_] || current_user.current_addressbook()
end
|