Class: DAV4Rack::Carddav::AddressbookResource
- 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
- #children ⇒ Object
- #collection? ⇒ Boolean
- #exist? ⇒ Boolean
-
#find_children(ids) ⇒ Object
{ href: uid }.
- #setup ⇒ Object
Methods inherited from Resource
#current_user, #get_property, #initialize, #is_self?, #properties, #router_params, #user_agent
Methods included from Helpers::Properties
Constructor Details
This class inherits a constructor from DAV4Rack::Carddav::Resource
Instance Method Details
#children ⇒ Object
122 123 124 125 126 127 128 |
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 122 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
118 119 120 |
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 118 def collection? true end |
#exist? ⇒ Boolean
114 115 116 |
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 114 def exist? @address_book != nil end |
#find_children(ids) ⇒ Object
{ href: uid }
131 132 133 134 135 136 137 |
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 131 def find_children(ids) @address_book.find_contacts(ids).each_with_object({}) do |(href, contact), ret| if contact ret[href] = child(ContactResource, contact) end end end |
#setup ⇒ Object
109 110 111 112 |
# File 'lib/dav4rack_ext/carddav/resources/addressbook_resource.rb', line 109 def setup super @address_book = @options[:_object_] || current_user.current_addressbook() end |